diff --git a/numass-control/magnet/src/main/kotlin/inr/numass/control/magnet/LambdaHub.kt b/numass-control/magnet/src/main/kotlin/inr/numass/control/magnet/LambdaHub.kt index eec18653..5e06e38a 100644 --- a/numass-control/magnet/src/main/kotlin/inr/numass/control/magnet/LambdaHub.kt +++ b/numass-control/magnet/src/main/kotlin/inr/numass/control/magnet/LambdaHub.kt @@ -76,7 +76,7 @@ class LambdaHub(context: Context, meta: Meta) : DeviceHub, AbstractDevice(contex } override fun optDevice(name: Name): Optional = - magnets.stream().filter { it.name == name.toUnescaped() }.map { it as Device }.findFirst() + magnets.stream().filter { it.name == name.unescaped }.map { it as Device }.findFirst() override val deviceNames: Stream get() = magnets.stream().map { Name.ofSingle(it.name) } 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 7aabd150..72e8e176 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 @@ -63,7 +63,7 @@ class VacCollectorDevice(context: Context, meta: Meta, val sensors: Collection = - Optional.ofNullable(sensors.find { it.name == name.toUnescaped() }) + Optional.ofNullable(sensors.find { it.name == name.unescaped }) override val deviceNames: Stream get() = sensors.stream().map { Name.ofSingle(it.name) } @@ -142,7 +142,7 @@ class VacCollectorDevice(context: Context, meta: Meta, val sensors: Collection p.putValue(n.toUnescaped(), Value.NULL) } + deviceNames.forEach { n -> p.putValue(n.unescaped, Value.NULL) } return p.build() } 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 dfb0d1e6..e1276170 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 @@ -21,7 +21,7 @@ class NumassDataFactory : DataFactory(NumassSet::class.java) { val storage = context.load(StorageManager::class.java, Meta.empty()).buildStorage(newMeta) StorageUtils.loaderStream(storage).forEach { loader -> if (loader is NumassSet) { - builder.putStatic(loader.fullName.toUnescaped(), loader as NumassSet) + builder.putStatic(loader.fullName.unescaped, loader as NumassSet) } } } diff --git a/numass-core/src/main/kotlin/inr/numass/data/storage/NumassDataLoader.kt b/numass-core/src/main/kotlin/inr/numass/data/storage/NumassDataLoader.kt index 3aa3a468..1e2428e1 100644 --- a/numass-core/src/main/kotlin/inr/numass/data/storage/NumassDataLoader.kt +++ b/numass-core/src/main/kotlin/inr/numass/data/storage/NumassDataLoader.kt @@ -28,7 +28,6 @@ import hep.dataforge.storage.commons.DummyStorage import hep.dataforge.storage.filestorage.FileStorage import hep.dataforge.storage.loaders.AbstractLoader import hep.dataforge.tables.Table -import hep.dataforge.toList import inr.numass.data.api.NumassPoint import inr.numass.data.api.NumassSet import inr.numass.data.legacy.NumassFileEnvelope @@ -43,6 +42,7 @@ import java.time.Instant import java.util.* import java.util.function.Supplier import java.util.stream.Stream +import kotlin.streams.toList /** diff --git a/numass-core/src/main/kotlin/inr/numass/data/storage/ProtoNumassPoint.kt b/numass-core/src/main/kotlin/inr/numass/data/storage/ProtoNumassPoint.kt index a4576274..ace5869f 100644 --- a/numass-core/src/main/kotlin/inr/numass/data/storage/ProtoNumassPoint.kt +++ b/numass-core/src/main/kotlin/inr/numass/data/storage/ProtoNumassPoint.kt @@ -4,7 +4,6 @@ import hep.dataforge.context.Context import hep.dataforge.context.Global import hep.dataforge.io.envelopes.Envelope import hep.dataforge.meta.Meta -import hep.dataforge.toList import inr.numass.data.NumassProto import inr.numass.data.api.* import inr.numass.data.dataStream @@ -15,6 +14,7 @@ import java.time.Duration import java.time.Instant import java.util.stream.IntStream import java.util.stream.Stream +import kotlin.streams.toList /** * Protobuf based numass point diff --git a/numass-main/src/main/java/inr/numass/models/GunTailSpectrum.java b/numass-main/src/main/java/inr/numass/models/GunTailSpectrum.java index c465bd2d..886bc191 100644 --- a/numass-main/src/main/java/inr/numass/models/GunTailSpectrum.java +++ b/numass-main/src/main/java/inr/numass/models/GunTailSpectrum.java @@ -16,7 +16,6 @@ package inr.numass.models; import hep.dataforge.exceptions.NotDefinedException; -import hep.dataforge.names.Names; import hep.dataforge.values.ValueProvider; import hep.dataforge.values.Values; import org.apache.commons.math3.analysis.UnivariateFunction; diff --git a/numass-main/src/main/kotlin/inr/numass/models/NumassModels.kt b/numass-main/src/main/kotlin/inr/numass/models/NumassModels.kt index de8c4882..88e468b6 100644 --- a/numass-main/src/main/kotlin/inr/numass/models/NumassModels.kt +++ b/numass-main/src/main/kotlin/inr/numass/models/NumassModels.kt @@ -1,7 +1,7 @@ package inr.numass.models import hep.dataforge.maths.integration.UnivariateIntegrator -import hep.dataforge.names.Names +import hep.dataforge.names.NameList import hep.dataforge.stat.models.Model import hep.dataforge.stat.models.ModelFactory import hep.dataforge.stat.parametric.AbstractParametricFunction @@ -24,7 +24,7 @@ fun model(name: String,factory: ContextMetaFactory): ModelFactory { * Calculate sum of two parametric functions */ operator fun ParametricFunction.plus(func: ParametricFunction): ParametricFunction { - val mergedNames = Names.of(Stream.concat(names.stream(), func.names.stream()).distinct()) + val mergedNames = NameList(Stream.concat(names.stream(), func.names.stream()).distinct()) return object : AbstractParametricFunction(mergedNames) { override fun derivValue(parName: String, x: Double, set: Values): Double { return func.derivValue(parName, x, set) + this@plus.derivValue(parName, x, set) @@ -42,7 +42,7 @@ operator fun ParametricFunction.plus(func: ParametricFunction): ParametricFuncti } operator fun ParametricFunction.minus(func: ParametricFunction): ParametricFunction { - val mergedNames = Names.of(Stream.concat(names.stream(), func.names.stream()).distinct()) + val mergedNames = NameList(Stream.concat(names.stream(), func.names.stream()).distinct()) return object : AbstractParametricFunction(mergedNames) { override fun derivValue(parName: String, x: Double, set: Values): Double { return func.derivValue(parName, x, set) - this@minus.derivValue(parName, x, set) @@ -64,7 +64,7 @@ operator fun ParametricFunction.minus(func: ParametricFunction): ParametricFunct * */ operator fun ParametricFunction.times(func: ParametricFunction): ParametricFunction { - val mergedNames = Names.of(Stream.concat(names.stream(), func.names.stream()).distinct()) + val mergedNames = NameList(Stream.concat(names.stream(), func.names.stream()).distinct()) return object : AbstractParametricFunction(mergedNames) { override fun derivValue(parName: String, x: Double, set: Values): Double { return this@times.value(x, set) * func.derivValue(parName, x, set) + this@times.derivValue(parName, x, set) * func.value(x, set) @@ -113,7 +113,7 @@ fun ParametricFunction.convolute( integrator: UnivariateIntegrator<*> = NumassIntegrator.getDefaultIntegrator(), support: Values.(String, Double) -> Pair ): ParametricFunction { - val mergedNames = Names.of(Stream.concat(names.stream(), func.names.stream()).distinct()) + val mergedNames = NameList(Stream.concat(names.stream(), func.names.stream()).distinct()) return object : AbstractParametricFunction(mergedNames) { override fun derivValue(parName: String, x: Double, set: Values): Double { val (a, b) = set.support(parName, x) diff --git a/numass-main/src/main/kotlin/inr/numass/scripts/InversedChain.kt b/numass-main/src/main/kotlin/inr/numass/scripts/InversedChain.kt index ce0fb1dd..2d7c06d3 100644 --- a/numass-main/src/main/kotlin/inr/numass/scripts/InversedChain.kt +++ b/numass-main/src/main/kotlin/inr/numass/scripts/InversedChain.kt @@ -66,7 +66,7 @@ fun main(args: Array) { for (hv in arrayOf(14000.0, 14500.0, 15000.0, 15500.0, 16050.0)) { val frame = displayChart("integral[$hv]").apply { - this.plots.descriptor = Descriptors.forType(DataPlot::class) + this.plots.descriptor = Descriptors.forType("plot", DataPlot::class) this.plots.configureValue("showLine", true) } diff --git a/numass-main/src/main/kotlin/inr/numass/scripts/InversedChainProto.kt b/numass-main/src/main/kotlin/inr/numass/scripts/InversedChainProto.kt index 49ddcdae..0bdab02e 100644 --- a/numass-main/src/main/kotlin/inr/numass/scripts/InversedChainProto.kt +++ b/numass-main/src/main/kotlin/inr/numass/scripts/InversedChainProto.kt @@ -47,7 +47,7 @@ fun main(args: Array) { val point = ProtoNumassPoint.readFile(Paths.get("D:\\Work\\Numass\\data\\2017_05_frames\\Fill_3_events\\set_33\\p36(30s)(HV1=17000).df")) val frame = displayChart("integral").apply { - this.plots.descriptor = Descriptors.forType(DataPlot::class) + this.plots.descriptor = Descriptors.forType("plot", DataPlot::class) this.plots.configureValue("showLine", true) } diff --git a/numass-main/src/main/kotlin/inr/numass/scripts/models/DifferentialSpectrum.kt b/numass-main/src/main/kotlin/inr/numass/scripts/models/DifferentialSpectrum.kt index f03f5b84..6c8ee17f 100644 --- a/numass-main/src/main/kotlin/inr/numass/scripts/models/DifferentialSpectrum.kt +++ b/numass-main/src/main/kotlin/inr/numass/scripts/models/DifferentialSpectrum.kt @@ -60,7 +60,7 @@ fun main(args: Array) { } val frame = displayChart("differential").apply { - this.plots.descriptor = Descriptors.forType(DataPlot::class) + this.plots.descriptor = Descriptors.forType("plot", DataPlot::class) this.plots.configureValue("showLine", true) }