From 61aef39670754569271e87e4fd1b25c1219d4c58 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Sat, 17 Nov 2018 20:02:37 +0300 Subject: [PATCH] Migrating to new coroutines and kotlin 1.3 --- build.gradle | 30 +++++++------- numass-control/build.gradle | 8 ++-- numass-control/control-room/build.gradle | 4 +- numass-control/cryotemp/build.gradle | 2 +- numass-control/dante/build.gradle | 4 +- .../inr/numass/control/dante/DanteClient.kt | 10 +---- .../inr/numass/control/dante/DanteTest.kt | 1 - numass-control/magnet/build.gradle | 2 +- .../inr/numass/control/magnet/LambdaMagnet.kt | 10 ----- .../numass/control/magnet/fx/MagnetDisplay.kt | 7 +--- numass-control/msp/build.gradle | 2 +- numass-control/vac/build.gradle | 2 +- .../inr/numass/control/readvac/ConsoleVac.kt | 1 - .../control/readvac/VacCollectorDevice.kt | 18 -------- numass-core/build.gradle | 8 ++-- .../numass/data/storage/NumassDataFactory.kt | 4 +- .../inr/numass/data/storage/NumassStorage.kt | 1 - numass-main/build.gradle | 16 ++++---- .../src/main/kotlin/inr/numass/NumassUtils.kt | 3 -- .../kotlin/inr/numass/data/NumassGenerator.kt | 5 +-- .../kotlin/inr/numass/data/PileUpSimulator.kt | 1 - .../inr/numass/models/misc/LossCalculator.kt | 41 +++++++++++++------ .../models/sterile/NumassTransmission.kt | 21 +--------- .../sterile/ParametricBiFunctionCache.kt | 39 ++++++++++++++++++ .../models/sterile/SterileNeutrinoSpectrum.kt | 7 +++- .../main/kotlin/inr/numass/scripts/Bunches.kt | 5 +-- .../numass/scripts/models/IntegralSpectrum.kt | 9 ++-- .../scripts/timeanalysis/TestAnalyzer.kt | 3 +- .../numass/scripts/timeanalysis/TestBunch.kt | 7 ++-- .../numass/scripts/tristan/AnalyzeTristan.kt | 1 - .../inr/numass/scripts/utils/ScanTree.kt | 1 - .../inr/numass/subthreshold/Threshold.kt | 4 +- numass-server/build.gradle | 8 ++-- numass-viewer/build.gradle | 6 +-- .../main/kotlin/inr/numass/viewer/Cache.kt | 7 +--- .../main/kotlin/inr/numass/viewer/MainView.kt | 9 +--- .../kotlin/inr/numass/viewer/PointInfoView.kt | 7 +--- .../kotlin/inr/numass/viewer/StorageView.kt | 2 - .../inr/numass/viewer/test/ComponentTest.kt | 3 +- numass-web/build.gradle | 8 ++-- 40 files changed, 145 insertions(+), 182 deletions(-) create mode 100644 numass-main/src/main/kotlin/inr/numass/models/sterile/ParametricBiFunctionCache.kt diff --git a/build.gradle b/build.gradle index e609d342..a8d7f9ea 100644 --- a/build.gradle +++ b/build.gradle @@ -1,10 +1,7 @@ buildscript { - ext.kotlin_version = "1.2.70" + ext.kotlin_version = "1.3.10" repositories { jcenter() - maven { - url = "https://dl.bintray.com/kotlin/kotlin-eap" - } } dependencies { @@ -28,36 +25,37 @@ allprojects { //maven { url = "https://jitpack.io" } maven { url = "http://dl.bintray.com/kotlin/ktor" } maven { url = "https://dl.bintray.com/kotlin/kotlinx" } - maven { url = "https://dl.bintray.com/kotlin/kotlin-eap"} } dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" - compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" - testCompile group: 'junit', name: 'junit', version: '4.+' + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" + implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" + testImplementation group: 'junit', name: 'junit', version: '4.+' } compileKotlin { kotlinOptions { - freeCompilerArgs = ['-Xjvm-default=enable'] jvmTarget = "1.8" javaParameters = true + freeCompilerArgs += [ + '-Xjvm-default=enable', + "-progressive", + "-Xuse-experimental=kotlin.Experimental" + ] } } compileTestKotlin { kotlinOptions { - freeCompilerArgs = ['-Xjvm-default=enable'] jvmTarget = "1.8" javaParameters = true - } - } - - kotlin { - experimental { - coroutines "enable" + freeCompilerArgs += [ + '-Xjvm-default=enable', + "-progressive", + "-Xuse-experimental=kotlin.Experimental" + ] } } } \ No newline at end of file diff --git a/numass-control/build.gradle b/numass-control/build.gradle index cbf2f947..7e8230af 100644 --- a/numass-control/build.gradle +++ b/numass-control/build.gradle @@ -16,12 +16,12 @@ allprojects { } dependencies { - compile "hep.dataforge:plots-jfc" // project(':dataforge-plots:plots-jfc') - compile "hep.dataforge:dataforge-control" //project(':dataforge-control') - compile "hep.dataforge:dataforge-gui" + implementation "hep.dataforge:plots-jfc" // project(':dataforge-plots:plots-jfc') + implementation "hep.dataforge:dataforge-control" //project(':dataforge-control') + implementation "hep.dataforge:dataforge-gui" // https://mvnrepository.com/artifact/commons-cli/commons-cli - compile group: 'commons-cli', name: 'commons-cli', version: '1.4' + implementation group: 'commons-cli', name: 'commons-cli', version: '1.4' } diff --git a/numass-control/control-room/build.gradle b/numass-control/control-room/build.gradle index 24a8919b..19c8e98a 100644 --- a/numass-control/control-room/build.gradle +++ b/numass-control/control-room/build.gradle @@ -22,8 +22,8 @@ configurations { dependencies { //DataForge dependencies - compile project(':numass-control') - //compile project(':numass-server') + implementation project(':numass-control') + //implementation project(':numass-server') // optional device classpath devices project(':numass-control:cryotemp') diff --git a/numass-control/cryotemp/build.gradle b/numass-control/cryotemp/build.gradle index 2f3112ad..a45537f3 100644 --- a/numass-control/cryotemp/build.gradle +++ b/numass-control/cryotemp/build.gradle @@ -11,7 +11,7 @@ version = "0.2.0"; //mainClassName = "inr.numass.readvac.Main" dependencies { - compile project(':numass-control') + implementation project(':numass-control') } task testDevice(dependsOn: classes, type: JavaExec) { diff --git a/numass-control/dante/build.gradle b/numass-control/dante/build.gradle index 5289c705..00b67661 100644 --- a/numass-control/dante/build.gradle +++ b/numass-control/dante/build.gradle @@ -17,6 +17,6 @@ version = "0.1.0" dependencies { - compile project(':numass-control') - compile project(':numass-core') + implementation project(':numass-control') + implementation project(':numass-core') } \ No newline at end of file diff --git a/numass-control/dante/src/main/kotlin/inr/numass/control/dante/DanteClient.kt b/numass-control/dante/src/main/kotlin/inr/numass/control/dante/DanteClient.kt index f2a72ea7..901870cd 100644 --- a/numass-control/dante/src/main/kotlin/inr/numass/control/dante/DanteClient.kt +++ b/numass-control/dante/src/main/kotlin/inr/numass/control/dante/DanteClient.kt @@ -18,15 +18,10 @@ package inr.numass.control.dante import hep.dataforge.meta.Meta import hep.dataforge.meta.buildMeta -import hep.dataforge.orElse import inr.numass.control.dante.DanteClient.Companion.CommandType.* import inr.numass.control.dante.DanteClient.Companion.Register.* -import inr.numass.data.NumassProto import inr.numass.data.api.NumassPoint import inr.numass.data.storage.ProtoNumassPoint -import kotlinx.coroutines.experimental.* -import kotlinx.coroutines.experimental.channels.Channel -import org.slf4j.LoggerFactory import java.io.DataInputStream import java.io.OutputStream import java.lang.Math.pow @@ -38,7 +33,6 @@ import java.time.Instant import java.util.* import java.util.concurrent.atomic.AtomicLong import kotlin.collections.HashMap -import kotlin.coroutines.experimental.buildSequence import kotlin.math.ceil internal val Byte.positive @@ -254,7 +248,7 @@ class DanteClient(val ip: String, chainLength: Int) : AutoCloseable { message = comChannel.receive() } - return buildSequence { + return sequence { val intBuffer = ByteBuffer.wrap(message.payload).asIntBuffer() while (intBuffer.hasRemaining()) { yield(intBuffer.get()) @@ -543,7 +537,7 @@ class DanteClient(val ip: String, chainLength: Int) : AutoCloseable { * Escape the sequence using DANTE convention */ private fun ByteArray.escape(): ByteArray { - return buildSequence { + return sequence { this@escape.forEach { yield(it) if (it == 0xdd.toByte()) { diff --git a/numass-control/dante/src/main/kotlin/inr/numass/control/dante/DanteTest.kt b/numass-control/dante/src/main/kotlin/inr/numass/control/dante/DanteTest.kt index 1c109657..00638ddf 100644 --- a/numass-control/dante/src/main/kotlin/inr/numass/control/dante/DanteTest.kt +++ b/numass-control/dante/src/main/kotlin/inr/numass/control/dante/DanteTest.kt @@ -30,7 +30,6 @@ import inr.numass.data.analyzers.SimpleAnalyzer import inr.numass.data.analyzers.withBinning import inr.numass.data.api.NumassBlock import inr.numass.data.channel -import kotlinx.coroutines.experimental.runBlocking fun main(args: Array) { val client = DanteClient("192.168.111.120", 8) diff --git a/numass-control/magnet/build.gradle b/numass-control/magnet/build.gradle index ea7023b2..66e3450f 100644 --- a/numass-control/magnet/build.gradle +++ b/numass-control/magnet/build.gradle @@ -8,7 +8,7 @@ if (!hasProperty('mainClass')) { mainClassName = mainClass dependencies { - compile project(':numass-control') + implementation project(':numass-control') } task talkToServer(type: JavaExec) { diff --git a/numass-control/magnet/src/main/kotlin/inr/numass/control/magnet/LambdaMagnet.kt b/numass-control/magnet/src/main/kotlin/inr/numass/control/magnet/LambdaMagnet.kt index 3f9a872e..73de07b2 100644 --- a/numass-control/magnet/src/main/kotlin/inr/numass/control/magnet/LambdaMagnet.kt +++ b/numass-control/magnet/src/main/kotlin/inr/numass/control/magnet/LambdaMagnet.kt @@ -15,23 +15,13 @@ */ package inr.numass.control.magnet -import hep.dataforge.context.Context import hep.dataforge.control.devices.AbstractDevice import hep.dataforge.control.ports.Port import hep.dataforge.control.ports.PortFactory -import hep.dataforge.description.ValueDef import hep.dataforge.exceptions.ControlException import hep.dataforge.exceptions.PortException -import hep.dataforge.meta.Meta -import hep.dataforge.meta.buildMeta -import hep.dataforge.states.StateDef -import hep.dataforge.states.StateDefs -import hep.dataforge.states.valueState -import hep.dataforge.utils.DateTimeUtils -import hep.dataforge.values.ValueType.* import inr.numass.control.DeviceView import inr.numass.control.magnet.fx.MagnetDisplay -import kotlinx.coroutines.experimental.runBlocking import java.time.Duration import java.time.Instant import java.time.temporal.ChronoUnit diff --git a/numass-control/magnet/src/main/kotlin/inr/numass/control/magnet/fx/MagnetDisplay.kt b/numass-control/magnet/src/main/kotlin/inr/numass/control/magnet/fx/MagnetDisplay.kt index 624ad705..ac93e466 100644 --- a/numass-control/magnet/src/main/kotlin/inr/numass/control/magnet/fx/MagnetDisplay.kt +++ b/numass-control/magnet/src/main/kotlin/inr/numass/control/magnet/fx/MagnetDisplay.kt @@ -16,8 +16,6 @@ package inr.numass.control.magnet.fx import hep.dataforge.exceptions.PortException -import hep.dataforge.fx.asDoubleProperty -import hep.dataforge.states.ValueState import inr.numass.control.DeviceDisplayFX import inr.numass.control.magnet.LambdaMagnet import javafx.application.Platform @@ -26,7 +24,6 @@ import javafx.beans.value.ObservableValue import javafx.scene.control.* import javafx.scene.layout.AnchorPane import javafx.scene.paint.Color -import tornadofx.* /** * FXML Controller class @@ -61,13 +58,13 @@ class MagnetDisplay : DeviceDisplayFX() { init { - targetIField.textProperty().addListener { observable: ObservableValue, oldValue: String, newValue: String -> + targetIField.textProperty().addListener { _: ObservableValue, oldValue: String, newValue: String -> if (!newValue.matches("\\d*(\\.)?\\d*".toRegex())) { targetIField.text = oldValue } } - magnetSpeedField.textProperty().addListener { observable: ObservableValue, oldValue: String, newValue: String -> + magnetSpeedField.textProperty().addListener { _: ObservableValue, oldValue: String, newValue: String -> if (!newValue.matches("\\d*(\\.)?\\d*".toRegex())) { magnetSpeedField.text = oldValue } diff --git a/numass-control/msp/build.gradle b/numass-control/msp/build.gradle index c60bd867..b76c1a45 100644 --- a/numass-control/msp/build.gradle +++ b/numass-control/msp/build.gradle @@ -9,5 +9,5 @@ mainClassName = mainClass dependencies { - compile project(':numass-control') + implementation project(':numass-control') } \ No newline at end of file diff --git a/numass-control/vac/build.gradle b/numass-control/vac/build.gradle index dbb783d8..793d84b0 100644 --- a/numass-control/vac/build.gradle +++ b/numass-control/vac/build.gradle @@ -8,7 +8,7 @@ if (!hasProperty('mainClass')) { mainClassName = mainClass dependencies { - compile project(':numass-control') + implementation project(':numass-control') } task testDevice(dependsOn: classes, type: JavaExec) { diff --git a/numass-control/vac/src/main/kotlin/inr/numass/control/readvac/ConsoleVac.kt b/numass-control/vac/src/main/kotlin/inr/numass/control/readvac/ConsoleVac.kt index 27624611..dedbc349 100644 --- a/numass-control/vac/src/main/kotlin/inr/numass/control/readvac/ConsoleVac.kt +++ b/numass-control/vac/src/main/kotlin/inr/numass/control/readvac/ConsoleVac.kt @@ -2,7 +2,6 @@ package inr.numass.control.readvac import hep.dataforge.control.devices.Sensor import hep.dataforge.control.devices.Sensor.Companion.RESULT_VALUE -import kotlinx.coroutines.experimental.runBlocking import org.apache.commons.cli.DefaultParser import org.apache.commons.cli.HelpFormatter import org.apache.commons.cli.Options diff --git a/numass-control/vac/src/main/kotlin/inr/numass/control/readvac/VacCollectorDevice.kt b/numass-control/vac/src/main/kotlin/inr/numass/control/readvac/VacCollectorDevice.kt index 72e8e176..79f34b20 100644 --- a/numass-control/vac/src/main/kotlin/inr/numass/control/readvac/VacCollectorDevice.kt +++ b/numass-control/vac/src/main/kotlin/inr/numass/control/readvac/VacCollectorDevice.kt @@ -5,9 +5,6 @@ */ package inr.numass.control.readvac -import hep.dataforge.connections.Connection -import hep.dataforge.connections.RoleDef -import hep.dataforge.context.Context import hep.dataforge.control.collectors.RegularPointCollector import hep.dataforge.control.connections.Roles import hep.dataforge.control.devices.Device @@ -15,24 +12,9 @@ import hep.dataforge.control.devices.DeviceHub import hep.dataforge.control.devices.DeviceListener import hep.dataforge.control.devices.PortSensor.Companion.CONNECTED_STATE import hep.dataforge.control.devices.Sensor -import hep.dataforge.description.ValueDef import hep.dataforge.exceptions.ControlException -import hep.dataforge.meta.Meta -import hep.dataforge.names.Name -import hep.dataforge.states.StateDef -import hep.dataforge.storage.api.TableLoader -import hep.dataforge.storage.commons.LoaderFactory -import hep.dataforge.storage.commons.StorageConnection -import hep.dataforge.tables.TableFormatBuilder -import hep.dataforge.utils.DateTimeUtils -import hep.dataforge.values.Value -import hep.dataforge.values.ValueMap -import hep.dataforge.values.ValueType -import hep.dataforge.values.Values import inr.numass.control.DeviceView import inr.numass.control.StorageHelper -import kotlinx.coroutines.experimental.launch -import kotlinx.coroutines.experimental.time.delay import java.time.Duration import java.time.Instant import java.util.* diff --git a/numass-core/build.gradle b/numass-core/build.gradle index 8cb3dc4a..56bc2e7b 100644 --- a/numass-core/build.gradle +++ b/numass-core/build.gradle @@ -13,12 +13,12 @@ description = "A bse package with minimal dependencies for numass" dependencies { - compile "hep.dataforge:dataforge-storage2" - compile "hep.dataforge:dataforge-json" - compile 'com.google.protobuf:protobuf-java:3.5.0' + implementation "hep.dataforge:dataforge-storage2" + implementation "hep.dataforge:dataforge-json" + implementation 'com.google.protobuf:protobuf-java:3.5.0' // https://mvnrepository.com/artifact/com.github.robtimus/sftp-fs - compile group: 'com.github.robtimus', name: 'sftp-fs', version: '1.1.3' + implementation group: 'com.github.robtimus', name: 'sftp-fs', version: '1.1.3' } protobuf { diff --git a/numass-core/src/main/kotlin/inr/numass/data/storage/NumassDataFactory.kt b/numass-core/src/main/kotlin/inr/numass/data/storage/NumassDataFactory.kt index 567df77a..c488c573 100644 --- a/numass-core/src/main/kotlin/inr/numass/data/storage/NumassDataFactory.kt +++ b/numass-core/src/main/kotlin/inr/numass/data/storage/NumassDataFactory.kt @@ -8,8 +8,6 @@ import hep.dataforge.names.Name import hep.dataforge.storage.Storage import hep.dataforge.storage.StorageElement import inr.numass.data.api.NumassSet -import kotlinx.coroutines.experimental.runBlocking -import kotlin.coroutines.experimental.buildSequence /** * Created by darksnake on 03-Feb-17. @@ -22,7 +20,7 @@ class NumassDataFactory : DataFactory(NumassSet::class.java) { * Build the sequence of name */ private fun Storage.sequence(prefix: Name = Name.empty()): Sequence> { - return buildSequence { + return sequence { runBlocking { getChildren() }.forEach { val newName = prefix + it.name yield(Pair(newName, it)) diff --git a/numass-core/src/main/kotlin/inr/numass/data/storage/NumassStorage.kt b/numass-core/src/main/kotlin/inr/numass/data/storage/NumassStorage.kt index 5f31621a..7201a030 100644 --- a/numass-core/src/main/kotlin/inr/numass/data/storage/NumassStorage.kt +++ b/numass-core/src/main/kotlin/inr/numass/data/storage/NumassStorage.kt @@ -24,7 +24,6 @@ import hep.dataforge.storage.StorageElement import hep.dataforge.storage.files.FileStorage import hep.dataforge.storage.files.FileStorageElement import inr.numass.NumassEnvelopeType -import kotlinx.coroutines.experimental.runBlocking import java.nio.file.Files import java.nio.file.Path diff --git a/numass-main/build.gradle b/numass-main/build.gradle index bdd6a545..6ed7aba6 100644 --- a/numass-main/build.gradle +++ b/numass-main/build.gradle @@ -27,16 +27,16 @@ compileGroovy.dependsOn(compileKotlin) compileGroovy.classpath += files(compileKotlin.destinationDir) dependencies { - compile group: 'commons-cli', name: 'commons-cli', version: '1.+' - compile group: 'commons-io', name: 'commons-io', version: '2.+' - compile project(':numass-core') - compile "hep.dataforge:dataforge-minuit" //project(':dataforge-stat:dataforge-minuit') - compile "hep.dataforge:grind-terminal" //project(':dataforge-grind:grind-terminal') - compile "hep.dataforge:dataforge-gui" - //compile "hep.dataforge:dataforge-html" + implementation group: 'commons-cli', name: 'commons-cli', version: '1.+' + implementation group: 'commons-io', name: 'commons-io', version: '2.+' + implementation project(':numass-core') + implementation "hep.dataforge:dataforge-minuit" //project(':dataforge-stat:dataforge-minuit') + implementation "hep.dataforge:grind-terminal" //project(':dataforge-grind:grind-terminal') + implementation "hep.dataforge:dataforge-gui" + //implementation "hep.dataforge:dataforge-html" // https://mvnrepository.com/artifact/org.ehcache/ehcache - //compile group: 'org.ehcache', name: 'ehcache', version: '3.4.0' + //implementation group: 'org.ehcache', name: 'ehcache', version: '3.4.0' } diff --git a/numass-main/src/main/kotlin/inr/numass/NumassUtils.kt b/numass-main/src/main/kotlin/inr/numass/NumassUtils.kt index e9752064..9b76e35c 100644 --- a/numass-main/src/main/kotlin/inr/numass/NumassUtils.kt +++ b/numass-main/src/main/kotlin/inr/numass/NumassUtils.kt @@ -37,12 +37,9 @@ import inr.numass.data.api.NumassPoint import inr.numass.data.api.NumassSet import inr.numass.models.FSS import inr.numass.utils.ExpressionUtils -import kotlinx.coroutines.experimental.runBlocking import org.apache.commons.math3.analysis.UnivariateFunction import org.jfree.chart.plot.IntervalMarker import org.jfree.chart.ui.RectangleInsets -import org.slf4j.Logger -import tornadofx.* import java.awt.Color import java.awt.Font import java.io.IOException diff --git a/numass-main/src/main/kotlin/inr/numass/data/NumassGenerator.kt b/numass-main/src/main/kotlin/inr/numass/data/NumassGenerator.kt index 0df6bf51..a768af61 100644 --- a/numass-main/src/main/kotlin/inr/numass/data/NumassGenerator.kt +++ b/numass-main/src/main/kotlin/inr/numass/data/NumassGenerator.kt @@ -10,9 +10,6 @@ import inr.numass.data.analyzers.NumassAnalyzer.Companion.COUNT_RATE_KEY import inr.numass.data.api.NumassBlock import inr.numass.data.api.OrphanNumassEvent import inr.numass.data.api.SimpleBlock -import kotlinx.coroutines.experimental.channels.asReceiveChannel -import kotlinx.coroutines.experimental.channels.takeWhile -import kotlinx.coroutines.experimental.channels.toList import org.apache.commons.math3.distribution.EnumeratedRealDistribution import org.apache.commons.math3.random.RandomGenerator import java.time.Duration @@ -28,7 +25,7 @@ private fun RandomGenerator.nextDeltaTime(cr: Double): Long { suspend fun Sequence.generateBlock(start: Instant, length: Long): NumassBlock { return SimpleBlock.produce(start, Duration.ofNanos(length)) { - asReceiveChannel().takeWhile { it.timeOffset < length }.toList() + takeWhile { it.timeOffset < length }.toList() } } diff --git a/numass-main/src/main/kotlin/inr/numass/data/PileUpSimulator.kt b/numass-main/src/main/kotlin/inr/numass/data/PileUpSimulator.kt index 20aa209c..f508a8d6 100644 --- a/numass-main/src/main/kotlin/inr/numass/data/PileUpSimulator.kt +++ b/numass-main/src/main/kotlin/inr/numass/data/PileUpSimulator.kt @@ -25,7 +25,6 @@ import hep.dataforge.maths.chain.Chain import inr.numass.data.api.NumassBlock import inr.numass.data.api.OrphanNumassEvent import inr.numass.data.api.SimpleBlock -import kotlinx.coroutines.experimental.runBlocking import org.apache.commons.math3.random.RandomGenerator import java.lang.Math.max import java.time.Duration diff --git a/numass-main/src/main/kotlin/inr/numass/models/misc/LossCalculator.kt b/numass-main/src/main/kotlin/inr/numass/models/misc/LossCalculator.kt index d5950f41..f4e7862d 100644 --- a/numass-main/src/main/kotlin/inr/numass/models/misc/LossCalculator.kt +++ b/numass-main/src/main/kotlin/inr/numass/models/misc/LossCalculator.kt @@ -21,14 +21,9 @@ import hep.dataforge.plots.PlotFrame import hep.dataforge.plots.data.XYFunctionPlot import hep.dataforge.utils.Misc import hep.dataforge.values.Values -import kotlinx.coroutines.experimental.CompletableDeferred -import kotlinx.coroutines.experimental.Deferred -import kotlinx.coroutines.experimental.async -import kotlinx.coroutines.experimental.runBlocking import org.apache.commons.math3.analysis.BivariateFunction import org.apache.commons.math3.analysis.UnivariateFunction import org.apache.commons.math3.exception.OutOfRangeException -import org.slf4j.LoggerFactory import java.lang.Math.exp import java.util.* @@ -41,6 +36,23 @@ import java.util.* object LossCalculator { private val cache = HashMap>() + private const val ION_POTENTIAL = 15.4//eV + + val adjustX = true + + + private fun getX(set: Values, eIn: Double): Double { + return if (adjustX) { + //From our article + set.getDouble("X") * Math.log(eIn / ION_POTENTIAL) * eIn * ION_POTENTIAL / 1.9580741410115568e6 + } else { + set.getDouble("X") + } + } + + fun p0(set: Values, eIn: Double): Double { + return LossCalculator.getLossProbability(0, getX(set, eIn)) + } fun getGunLossProbabilities(X: Double): List { val res = ArrayList() @@ -72,7 +84,7 @@ object LossCalculator { } - private fun getCachedSpectrum(order: Int): Deferred { + private fun CoroutineScope.getCachedSpectrum(order: Int): Deferred { return when { order <= 0 -> error("Non-positive loss cache order") order == 1 -> CompletableDeferred(singleScatterFunction) @@ -235,23 +247,24 @@ object LossCalculator { * порядков * * @param X - * @param Ei - * @param Ef + * @param eIn + * @param eOut * @return */ - fun getTotalLossDeriv(X: Double, Ei: Double, Ef: Double): Double { + fun getTotalLossDeriv(X: Double, eIn: Double, eOut: Double): Double { val probs = getLossProbDerivs(X) var sum = 0.0 for (i in 1 until probs.size) { - sum += probs[i] * getLossValue(i, Ei, Ef) + sum += probs[i] * getLossValue(i, eIn, eOut) } return sum } - fun getTotalLossDerivBivariateFunction(X: Double): BivariateFunction { - return BivariateFunction { Ei: Double, Ef: Double -> getTotalLossDeriv(X, Ei, Ef) } - } + fun getTotalLossDeriv(pars: Values, eIn: Double, eOut: Double) = getTotalLossDeriv(getX(pars, eIn), eIn, eOut) + + fun getTotalLossDerivBivariateFunction(X: Double) = BivariateFunction { Ei: Double, Ef: Double -> getTotalLossDeriv(X, Ei, Ef) } + /** * Значение полной функции потерь с учетом всех неисчезающих порядков @@ -272,6 +285,8 @@ object LossCalculator { } } + fun getTotalLossValue(pars: Values, Ei: Double, Ef: Double): Double = getTotalLossValue(getX(pars, Ei), Ei, Ef) + /** * порог по вероятности, до которого вычисляются компоненты функции потерь diff --git a/numass-main/src/main/kotlin/inr/numass/models/sterile/NumassTransmission.kt b/numass-main/src/main/kotlin/inr/numass/models/sterile/NumassTransmission.kt index 345b4714..e6a14158 100644 --- a/numass-main/src/main/kotlin/inr/numass/models/sterile/NumassTransmission.kt +++ b/numass-main/src/main/kotlin/inr/numass/models/sterile/NumassTransmission.kt @@ -13,7 +13,6 @@ import hep.dataforge.values.Values import inr.numass.models.misc.LossCalculator import inr.numass.utils.ExpressionUtils import org.apache.commons.math3.analysis.BivariateFunction -import org.slf4j.LoggerFactory import java.util.* /** @@ -44,23 +43,10 @@ class NumassTransmission(context: Context, meta: Meta) : AbstractParametricBiFun } } - private fun getX(eIn: Double, set: Values): Double { - return if (adjustX) { - //From our article - set.getDouble("X") * Math.log(eIn / ION_POTENTIAL) * eIn * ION_POTENTIAL / 1.9580741410115568e6 - } else { - set.getDouble("X") - } - } - - fun p0(eIn: Double, set: Values): Double { - return LossCalculator.getLossProbability(0, getX(eIn, set)) - } - override fun derivValue(parName: String, eIn: Double, eOut: Double, set: Values): Double { return when (parName) { "trap" -> trapFunc.value(eIn, eOut) - "X" -> LossCalculator.getTotalLossDeriv(getX(eIn, set), eIn, eOut) + "X" -> LossCalculator.getTotalLossDeriv(set, eIn, eOut) else -> super.derivValue(parName, eIn, eOut, set) } } @@ -70,10 +56,8 @@ class NumassTransmission(context: Context, meta: Meta) : AbstractParametricBiFun } override fun value(eIn: Double, eOut: Double, set: Values): Double { - //calculate X taking into account its energy dependence - val X = getX(eIn, set) // loss part - val loss = LossCalculator.getTotalLossValue(X, eIn, eOut) + val loss = LossCalculator.getTotalLossValue(set, eIn, eOut) // double loss; // // if(eIn-eOut >= 300){ @@ -94,7 +78,6 @@ class NumassTransmission(context: Context, meta: Meta) : AbstractParametricBiFun companion object { private val list = arrayOf("trap", "X") - private const val ION_POTENTIAL = 15.4//eV } } diff --git a/numass-main/src/main/kotlin/inr/numass/models/sterile/ParametricBiFunctionCache.kt b/numass-main/src/main/kotlin/inr/numass/models/sterile/ParametricBiFunctionCache.kt new file mode 100644 index 00000000..c52a94c9 --- /dev/null +++ b/numass-main/src/main/kotlin/inr/numass/models/sterile/ParametricBiFunctionCache.kt @@ -0,0 +1,39 @@ +/* + * Copyright 2018 Alexander Nozik. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package inr.numass.models.sterile + +import hep.dataforge.names.NameList +import hep.dataforge.stat.parametric.ParametricBiFunction +import hep.dataforge.values.Values + +class ParametricBiFunctionCache(val function: ParametricBiFunction): ParametricBiFunction { + override fun derivValue(parName: String?, x: Double, y: Double, set: Values?): Double { + TODO("not implemented") //To change body of created functions use File | Settings | File Templates. + } + + override fun getNames(): NameList { + TODO("not implemented") //To change body of created functions use File | Settings | File Templates. + } + + override fun value(x: Double, y: Double, set: Values?): Double { + TODO("not implemented") //To change body of created functions use File | Settings | File Templates. + } + + override fun providesDeriv(name: String?): Boolean { + TODO("not implemented") //To change body of created functions use File | Settings | File Templates. + } +} \ No newline at end of file diff --git a/numass-main/src/main/kotlin/inr/numass/models/sterile/SterileNeutrinoSpectrum.kt b/numass-main/src/main/kotlin/inr/numass/models/sterile/SterileNeutrinoSpectrum.kt index 64a0318c..2dcf279b 100644 --- a/numass-main/src/main/kotlin/inr/numass/models/sterile/SterileNeutrinoSpectrum.kt +++ b/numass-main/src/main/kotlin/inr/numass/models/sterile/SterileNeutrinoSpectrum.kt @@ -20,6 +20,7 @@ import hep.dataforge.values.ValueType.BOOLEAN import hep.dataforge.values.Values import inr.numass.getFSS import inr.numass.models.FSS +import inr.numass.models.misc.LossCalculator import inr.numass.utils.NumassIntegrator /** @@ -46,7 +47,7 @@ class SterileNeutrinoSpectrum @JvmOverloads constructor( context: Context, configuration: Meta, val source: ParametricBiFunction = NumassBeta(), - val transmission: NumassTransmission = NumassTransmission(context, configuration.getMetaOrEmpty("transmission")), + val transmission: ParametricBiFunction = NumassTransmission(context, configuration.getMetaOrEmpty("transmission")), val resolution: ParametricBiFunction = NumassResolution(context, configuration.getMeta("resolution", Meta.empty())) ) : AbstractParametricFunction(*list) { @@ -119,6 +120,8 @@ class SterileNeutrinoSpectrum @JvmOverloads constructor( } } + + private inner class TransRes : AbstractParametricBiFunction(arrayOf("X", "trap")) { override fun providesDeriv(name: String): Boolean { @@ -135,7 +138,7 @@ class SterileNeutrinoSpectrum @JvmOverloads constructor( override fun value(eIn: Double, u: Double, set: Values): Double { - val p0 = transmission.p0(eIn, set) + val p0 = LossCalculator.p0(set, eIn) return p0 * resolution.value(eIn, u, set) + lossRes(transmission, eIn, u, set) } diff --git a/numass-main/src/main/kotlin/inr/numass/scripts/Bunches.kt b/numass-main/src/main/kotlin/inr/numass/scripts/Bunches.kt index 06ff8170..7a87aff7 100644 --- a/numass-main/src/main/kotlin/inr/numass/scripts/Bunches.kt +++ b/numass-main/src/main/kotlin/inr/numass/scripts/Bunches.kt @@ -5,9 +5,6 @@ import inr.numass.actions.TimeAnalyzerAction import inr.numass.data.NumassGenerator import inr.numass.data.api.SimpleNumassPoint import inr.numass.data.generateBlock -import kotlinx.coroutines.experimental.channels.produce -import kotlinx.coroutines.experimental.channels.toList -import kotlinx.coroutines.experimental.runBlocking import java.time.Instant fun main(args: Array) { @@ -17,7 +14,7 @@ fun main(args: Array) { val start = Instant.now() - val blockchannel = produce { + val blockchannel = GlobalScope.produce { (1..num).forEach { val regularChain = NumassGenerator.generateEvents(cr) val bunchChain = NumassGenerator.generateBunches(40.0, 0.01, 5.0) diff --git a/numass-main/src/main/kotlin/inr/numass/scripts/models/IntegralSpectrum.kt b/numass-main/src/main/kotlin/inr/numass/scripts/models/IntegralSpectrum.kt index a16dc067..6a60261b 100644 --- a/numass-main/src/main/kotlin/inr/numass/scripts/models/IntegralSpectrum.kt +++ b/numass-main/src/main/kotlin/inr/numass/scripts/models/IntegralSpectrum.kt @@ -38,7 +38,6 @@ import inr.numass.data.SpectrumAdapter import inr.numass.data.SpectrumGenerator import inr.numass.models.NBkgSpectrum import inr.numass.models.sterile.SterileNeutrinoSpectrum -import kotlinx.coroutines.experimental.launch import java.io.PrintWriter import kotlin.math.sqrt @@ -136,7 +135,7 @@ fun main(args: Array) { } plots.setType() +plotResidual("trap", "trap" to 0.99) - launch { + context.launch(Dispatchers.Main) { try { +plotFitResidual("trap_fit", "trap" to 0.99) } catch (ex: Exception) { @@ -144,15 +143,15 @@ fun main(args: Array) { } } +plotResidual("X", "X" to 0.11) - launch { + context.launch(Dispatchers.Main) { +plotFitResidual("X_fit", "X" to 0.11) } +plotResidual("sterile_1", "U2" to 1e-3) - launch { + context.launch(Dispatchers.Main) { +plotFitResidual("sterile_1_fit", "U2" to 1e-3) } +plotResidual("sterile_3", "msterile2" to (3000 * 3000).toDouble(), "U2" to 1e-3) - launch { + context.launch(Dispatchers.Main) { +plotFitResidual("sterile_3_fit", "msterile2" to (3000 * 3000).toDouble(), "U2" to 1e-3) } diff --git a/numass-main/src/main/kotlin/inr/numass/scripts/timeanalysis/TestAnalyzer.kt b/numass-main/src/main/kotlin/inr/numass/scripts/timeanalysis/TestAnalyzer.kt index 0f558b7a..bb58b64f 100644 --- a/numass-main/src/main/kotlin/inr/numass/scripts/timeanalysis/TestAnalyzer.kt +++ b/numass-main/src/main/kotlin/inr/numass/scripts/timeanalysis/TestAnalyzer.kt @@ -1,7 +1,6 @@ package inr.numass.scripts.timeanalysis import hep.dataforge.context.Global -import hep.dataforge.coroutineContext import hep.dataforge.fx.output.FXOutputManager import hep.dataforge.goals.generate import hep.dataforge.goals.join @@ -39,7 +38,7 @@ fun main(args: Array) { .withDeadTime { (dt * 1000).toLong() } .generateBlock(start.plusNanos(it * length), length) } - }.join(Global.coroutineContext) { blocks -> + }.join(Global) { blocks -> SimpleNumassPoint(blocks, 12000.0) }.get() diff --git a/numass-main/src/main/kotlin/inr/numass/scripts/timeanalysis/TestBunch.kt b/numass-main/src/main/kotlin/inr/numass/scripts/timeanalysis/TestBunch.kt index cd0e4cc2..13658c9a 100644 --- a/numass-main/src/main/kotlin/inr/numass/scripts/timeanalysis/TestBunch.kt +++ b/numass-main/src/main/kotlin/inr/numass/scripts/timeanalysis/TestBunch.kt @@ -17,7 +17,6 @@ package inr.numass.scripts.timeanalysis import hep.dataforge.context.Global -import hep.dataforge.coroutineContext import hep.dataforge.fx.output.FXOutputManager import hep.dataforge.goals.generate import hep.dataforge.goals.join @@ -37,7 +36,7 @@ fun main(args: Array) { NumassPlugin().startGlobal() val cr = 3.0 - val length = (30000 *1e9).toLong() + val length = (30000 * 1e9).toLong() val num = 10 val dt = 6.5 @@ -52,14 +51,14 @@ fun main(args: Array) { .generateBunches(6.0, 0.01, 5.0) val discharges = NumassGenerator - .generateBunches(50.0,0.001,0.1) + .generateBunches(50.0, 0.001, 0.1) NumassGenerator .mergeEventChains(events, bunches, discharges) .withDeadTime { (dt * 1000).toLong() } .generateBlock(start.plusNanos(it * length), length) } - }.join(Global.coroutineContext) { blocks -> + }.join(Global) { blocks -> SimpleNumassPoint(blocks, 18000.0) }.get() diff --git a/numass-main/src/main/kotlin/inr/numass/scripts/tristan/AnalyzeTristan.kt b/numass-main/src/main/kotlin/inr/numass/scripts/tristan/AnalyzeTristan.kt index d3cfa110..0484d396 100644 --- a/numass-main/src/main/kotlin/inr/numass/scripts/tristan/AnalyzeTristan.kt +++ b/numass-main/src/main/kotlin/inr/numass/scripts/tristan/AnalyzeTristan.kt @@ -4,7 +4,6 @@ import inr.numass.data.channel import inr.numass.data.plotAmplitudeSpectrum import inr.numass.data.storage.ProtoNumassPoint import inr.numass.data.transformChain -import kotlinx.coroutines.experimental.runBlocking import java.io.File fun main(args: Array) { diff --git a/numass-main/src/main/kotlin/inr/numass/scripts/utils/ScanTree.kt b/numass-main/src/main/kotlin/inr/numass/scripts/utils/ScanTree.kt index 0a5c46da..5a7f7ff4 100644 --- a/numass-main/src/main/kotlin/inr/numass/scripts/utils/ScanTree.kt +++ b/numass-main/src/main/kotlin/inr/numass/scripts/utils/ScanTree.kt @@ -10,7 +10,6 @@ import hep.dataforge.storage.Storage import hep.dataforge.useValue import inr.numass.data.storage.NumassDataLoader import inr.numass.data.storage.NumassDirectory -import kotlinx.coroutines.experimental.runBlocking import java.io.File private suspend fun createSummaryNode(storage: Storage): MetaBuilder { diff --git a/numass-main/src/main/kotlin/inr/numass/subthreshold/Threshold.kt b/numass-main/src/main/kotlin/inr/numass/subthreshold/Threshold.kt index 22a1349c..6aed8857 100644 --- a/numass-main/src/main/kotlin/inr/numass/subthreshold/Threshold.kt +++ b/numass-main/src/main/kotlin/inr/numass/subthreshold/Threshold.kt @@ -22,13 +22,11 @@ import inr.numass.data.api.NumassSet import inr.numass.data.api.SimpleNumassPoint import inr.numass.data.storage.NumassDataLoader import inr.numass.data.storage.NumassDirectory -import kotlinx.coroutines.experimental.runBlocking import org.apache.commons.math3.analysis.ParametricUnivariateFunction import org.apache.commons.math3.exception.DimensionMismatchException import org.apache.commons.math3.fitting.SimpleCurveFitter import org.apache.commons.math3.fitting.WeightedObservedPoint import java.util.stream.Collectors -import kotlin.coroutines.experimental.buildSequence object Threshold { @@ -39,7 +37,7 @@ object Threshold { val storage = NumassDirectory.read(context, meta.getString("data.dir")) as Storage fun Storage.loaders(): Sequence{ - return buildSequence { + return sequence { print("Reading ${this@loaders.fullName}") runBlocking { this@loaders.getChildren()}.forEach { if(it is NumassDataLoader){ diff --git a/numass-server/build.gradle b/numass-server/build.gradle index c39b86a8..0a80818d 100644 --- a/numass-server/build.gradle +++ b/numass-server/build.gradle @@ -17,10 +17,10 @@ apply plugin: 'com.github.johnrengelman.shadow' mainClassName = "inr.numass.server.ServerRunner" dependencies { - compile project(':numass-core') - compile "hep.dataforge:storage-server" // project(':dataforge-storage:storage-servlet') - compile "hep.dataforge:dataforge-messages" - compile 'commons-daemon:commons-daemon:1.+' + implementation project(':numass-core') + implementation "hep.dataforge:storage-server" // project(':dataforge-storage:storage-servlet') + implementation "hep.dataforge:dataforge-messages" + implementation 'commons-daemon:commons-daemon:1.+' } //processResources { diff --git a/numass-viewer/build.gradle b/numass-viewer/build.gradle index 3a4c54b1..0a531623 100644 --- a/numass-viewer/build.gradle +++ b/numass-viewer/build.gradle @@ -18,8 +18,8 @@ description = "The viewer for numass data" dependencies { - compile project(':numass-core') - compile "hep.dataforge:plots-jfc" //project(':dataforge-plots:plots-jfc') - compile "hep.dataforge:dataforge-gui" + implementation project(':numass-core') + implementation "hep.dataforge:plots-jfc" //project(':dataforge-plots:plots-jfc') + implementation "hep.dataforge:dataforge-gui" } diff --git a/numass-viewer/src/main/kotlin/inr/numass/viewer/Cache.kt b/numass-viewer/src/main/kotlin/inr/numass/viewer/Cache.kt index c3bfdc32..5a2ef20b 100644 --- a/numass-viewer/src/main/kotlin/inr/numass/viewer/Cache.kt +++ b/numass-viewer/src/main/kotlin/inr/numass/viewer/Cache.kt @@ -22,9 +22,6 @@ import inr.numass.data.analyzers.SimpleAnalyzer import inr.numass.data.api.NumassBlock import inr.numass.data.api.NumassPoint import inr.numass.data.api.NumassSet -import kotlinx.coroutines.experimental.CoroutineStart -import kotlinx.coroutines.experimental.Deferred -import kotlinx.coroutines.experimental.async private val analyzer = SimpleAnalyzer() @@ -35,11 +32,11 @@ class CachedPoint(val point: NumassPoint) : NumassPoint by point { override val meta: Meta = point.meta - val channelSpectra: Deferred> = async(start = CoroutineStart.LAZY) { + val channelSpectra: Deferred> = GlobalScope.async(start = CoroutineStart.LAZY) { point.channels.mapValues { (_, value) -> analyzer.getAmplitudeSpectrum(value) } } - val spectrum: Deferred = async(start = CoroutineStart.LAZY) { analyzer.getAmplitudeSpectrum(point) } + val spectrum: Deferred
= GlobalScope.async(start = CoroutineStart.LAZY) { analyzer.getAmplitudeSpectrum(point) } } class CachedSet(set: NumassSet) : NumassSet by set { diff --git a/numass-viewer/src/main/kotlin/inr/numass/viewer/MainView.kt b/numass-viewer/src/main/kotlin/inr/numass/viewer/MainView.kt index 2e47b839..569c3a98 100644 --- a/numass-viewer/src/main/kotlin/inr/numass/viewer/MainView.kt +++ b/numass-viewer/src/main/kotlin/inr/numass/viewer/MainView.kt @@ -3,9 +3,6 @@ package inr.numass.viewer import hep.dataforge.context.Context import hep.dataforge.context.Global import hep.dataforge.fx.dfIconView -import hep.dataforge.fx.except -import hep.dataforge.fx.runGoal -import hep.dataforge.fx.ui import hep.dataforge.storage.Storage import inr.numass.NumassProperties import inr.numass.data.api.NumassPoint @@ -19,8 +16,6 @@ import javafx.scene.layout.Priority import javafx.scene.text.Font import javafx.stage.DirectoryChooser import javafx.stage.FileChooser -import org.controlsfx.control.StatusBar -import tornadofx.* import java.io.File import java.nio.file.Files import java.nio.file.Path @@ -65,7 +60,7 @@ class MainView(val context: Context = Global.getContext("viewer")) : View(title if (rootDir != null) { NumassProperties.setNumassProperty("numass.viewer.lastPath", rootDir.absolutePath) - kotlinx.coroutines.experimental.launch { + GlobalScope.launch { runLater { path = rootDir.toPath() } @@ -94,7 +89,7 @@ class MainView(val context: Context = Global.getContext("viewer")) : View(title val file = chooser.showOpenDialog(primaryStage.scene.window) if (file != null) { NumassProperties.setNumassProperty("numass.viewer.lastPath", file.parentFile.absolutePath) - kotlinx.coroutines.experimental.launch { + GlobalScope.launch { runLater { path = file.toPath() } diff --git a/numass-viewer/src/main/kotlin/inr/numass/viewer/PointInfoView.kt b/numass-viewer/src/main/kotlin/inr/numass/viewer/PointInfoView.kt index 39d70a7c..1c96a88a 100644 --- a/numass-viewer/src/main/kotlin/inr/numass/viewer/PointInfoView.kt +++ b/numass-viewer/src/main/kotlin/inr/numass/viewer/PointInfoView.kt @@ -3,11 +3,6 @@ package inr.numass.viewer import hep.dataforge.fx.meta.MetaViewer import inr.numass.data.analyzers.NumassAnalyzer import javafx.beans.property.SimpleIntegerProperty -import kotlinx.coroutines.experimental.async -import org.controlsfx.glyphfont.FontAwesome -import tornadofx.* -import tornadofx.controlsfx.borders -import tornadofx.controlsfx.toGlyph class PointInfoView(val point: CachedPoint) : MetaViewer(point.meta) { @@ -24,7 +19,7 @@ class PointInfoView(val point: CachedPoint) : MetaViewer(point.meta) { row { button(graphic = FontAwesome.Glyph.REFRESH.toGlyph()) { action { - async { + GlobalScope.launch { val res = point.spectrum.await().sumBy { it.getValue(NumassAnalyzer.COUNT_KEY).int } runLater { count = res } } diff --git a/numass-viewer/src/main/kotlin/inr/numass/viewer/StorageView.kt b/numass-viewer/src/main/kotlin/inr/numass/viewer/StorageView.kt index 63546ce8..b9e8c5a0 100644 --- a/numass-viewer/src/main/kotlin/inr/numass/viewer/StorageView.kt +++ b/numass-viewer/src/main/kotlin/inr/numass/viewer/StorageView.kt @@ -14,8 +14,6 @@ import inr.numass.data.storage.NumassDataLoader import javafx.beans.property.SimpleBooleanProperty import javafx.scene.control.ContextMenu import javafx.scene.control.TreeItem -import kotlinx.coroutines.experimental.runBlocking -import tornadofx.* class StorageView(val storage: Storage) : View(title = "Numass storage", icon = dfIconView) { diff --git a/numass-viewer/src/main/kotlin/inr/numass/viewer/test/ComponentTest.kt b/numass-viewer/src/main/kotlin/inr/numass/viewer/test/ComponentTest.kt index 80cebf57..e4159ef9 100644 --- a/numass-viewer/src/main/kotlin/inr/numass/viewer/test/ComponentTest.kt +++ b/numass-viewer/src/main/kotlin/inr/numass/viewer/test/ComponentTest.kt @@ -10,7 +10,6 @@ import inr.numass.data.storage.NumassDirectory import inr.numass.viewer.* import javafx.application.Application import javafx.scene.image.ImageView -import tornadofx.* import java.io.File import java.util.concurrent.ConcurrentHashMap @@ -33,7 +32,7 @@ class ViewerComponentsTest : View(title = "Numass viewer test", icon = ImageView top { button("Click me!") { action { - kotlinx.coroutines.experimental.launch { + GlobalScope.launch { val set: NumassSet = NumassDirectory.INSTANCE.read(Global, File("D:\\Work\\Numass\\data\\2017_05\\Fill_2").toPath()) ?.provide("loader::set_2", NumassSet::class.java).nullable ?: kotlin.error("Error") diff --git a/numass-web/build.gradle b/numass-web/build.gradle index f06762f2..6a30e7f8 100644 --- a/numass-web/build.gradle +++ b/numass-web/build.gradle @@ -9,10 +9,10 @@ description = 'kodex/ktor based server' //mainClassName = "inr.numass.server.ServerRunner" dependencies { - compile "hep.dataforge:kodex-server" - compile "hep.dataforge:dataforge-storage" - compile "hep.dataforge:dataforge-control" - compile project(":numass-core") + implementation "hep.dataforge:kodex-server" + implementation "hep.dataforge:dataforge-storage" + implementation "hep.dataforge:dataforge-control" + implementation project(":numass-core") } compileKotlin {