diff --git a/numass-control/cryotemp/src/main/kotlin/inr/numass/control/cryotemp/PKT8VirtualPort.kt b/numass-control/cryotemp/src/main/kotlin/inr/numass/control/cryotemp/PKT8VirtualPort.kt index 9777d510..b07c0897 100644 --- a/numass-control/cryotemp/src/main/kotlin/inr/numass/control/cryotemp/PKT8VirtualPort.kt +++ b/numass-control/cryotemp/src/main/kotlin/inr/numass/control/cryotemp/PKT8VirtualPort.kt @@ -29,7 +29,7 @@ class PKT8VirtualPort(private val portName: String, meta: Meta) : VirtualPort(me "s" -> { val letters = arrayOf("a", "b", "c", "d", "e", "f", "g", "h") for (letter in letters) { - val channelMeta = MetaUtils.findNodeByValue(meta, "channel", "letter", Value.of(letter)).orElse(Meta.empty()) + val channelMeta = MetaUtils.findNodeByValue(meta, "channel", "letter", Value.parseValue(letter)).orElse(Meta.empty()) val average: Double val sigma: Double 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 6be249cd..71c4cc8d 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 @@ -24,8 +24,8 @@ 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.tables.ValueMap import hep.dataforge.utils.DateTimeUtils +import hep.dataforge.values.ValueMap import hep.dataforge.values.ValueType import hep.dataforge.values.Values import inr.numass.control.DeviceView diff --git a/numass-core/src/main/kotlin/inr/numass/NumassEnvelopeType.kt b/numass-core/src/main/kotlin/inr/numass/NumassEnvelopeType.kt index 1656afcd..ae8100ba 100644 --- a/numass-core/src/main/kotlin/inr/numass/NumassEnvelopeType.kt +++ b/numass-core/src/main/kotlin/inr/numass/NumassEnvelopeType.kt @@ -2,6 +2,7 @@ package inr.numass import hep.dataforge.io.envelopes.* import hep.dataforge.values.Value +import hep.dataforge.values.parseValue import inr.numass.data.legacy.NumassFileEnvelope.Companion.LEGACY_END_SEQUENCE import inr.numass.data.legacy.NumassFileEnvelope.Companion.LEGACY_START_SEQUENCE import org.slf4j.LoggerFactory @@ -60,7 +61,7 @@ class NumassEnvelopeType : EnvelopeType { val metaType = MetaType.resolve(metaTypeCode) if (metaType != null) { - res[Envelope.META_TYPE_PROPERTY] = Value.of(metaType.name) + res[Envelope.META_TYPE_PROPERTY] = metaType.name.parseValue() } else { LoggerFactory.getLogger(EnvelopeTag::class.java).warn("Could not resolve meta type. Using default") } diff --git a/numass-core/src/main/kotlin/inr/numass/data/SpectrumAdapter.kt b/numass-core/src/main/kotlin/inr/numass/data/SpectrumAdapter.kt index 12b2b8a6..c1f7a92a 100644 --- a/numass-core/src/main/kotlin/inr/numass/data/SpectrumAdapter.kt +++ b/numass-core/src/main/kotlin/inr/numass/data/SpectrumAdapter.kt @@ -19,10 +19,11 @@ import hep.dataforge.meta.Meta import hep.dataforge.meta.MetaBuilder import hep.dataforge.tables.Adapters.* import hep.dataforge.tables.BasicAdapter -import hep.dataforge.tables.ValueMap import hep.dataforge.tables.ValuesAdapter import hep.dataforge.values.Value +import hep.dataforge.values.ValueMap import hep.dataforge.values.Values +import hep.dataforge.values.asValue import java.util.* import java.util.stream.Stream @@ -51,7 +52,7 @@ class SpectrumAdapter : BasicAdapter { } fun getTime(point: Values): Double { - return this.optComponent(point, POINT_LENGTH_NAME).map { it.getDouble() }.orElse(1.0) + return this.optComponent(point, POINT_LENGTH_NAME).map { it.double }.orElse(1.0) } fun buildSpectrumDataPoint(x: Double, count: Long, t: Double): Values { @@ -69,21 +70,19 @@ class SpectrumAdapter : BasicAdapter { when (component) { "count" -> return super.optComponent(values, Y_VALUE_KEY) Y_VALUE_KEY -> return super.optComponent(values, Y_VALUE_KEY) - .map { it -> it.getDouble() / getTime(values) } - .map { Value.of(it) } + .map { it -> it.double / getTime(values) } + .map { it.asValue() } Y_ERROR_KEY -> { val err = super.optComponent(values, Y_ERROR_KEY) return if (err.isPresent) { - Optional.of(Value.of(err.get().getDouble() / getTime(values))) + Optional.of(Value.of(err.get().double / getTime(values))) } else { - val y = getComponent(values, Y_VALUE_KEY).getDouble() - if (y < 0) { - Optional.empty() - } else if (y == 0.0) { - //avoid infinite weights - Optional.of(Value.of(1.0 / getTime(values))) - } else { - Optional.of(Value.of(Math.sqrt(y) / getTime(values))) + val y = getComponent(values, Y_VALUE_KEY).double + when { + y < 0 -> Optional.empty() + y == 0.0 -> //avoid infinite weights + Optional.of(Value.of(1.0 / getTime(values))) + else -> Optional.of(Value.of(Math.sqrt(y) / getTime(values))) } } } diff --git a/numass-core/src/main/kotlin/inr/numass/data/analyzers/NumassAnalyzer.kt b/numass-core/src/main/kotlin/inr/numass/data/analyzers/NumassAnalyzer.kt index e71e7e6d..8999e434 100644 --- a/numass-core/src/main/kotlin/inr/numass/data/analyzers/NumassAnalyzer.kt +++ b/numass-core/src/main/kotlin/inr/numass/data/analyzers/NumassAnalyzer.kt @@ -20,6 +20,7 @@ import hep.dataforge.meta.Meta import hep.dataforge.tables.* import hep.dataforge.tables.Adapters.* import hep.dataforge.values.Value +import hep.dataforge.values.ValueMap import hep.dataforge.values.Values import inr.numass.data.api.NumassBlock import inr.numass.data.api.NumassEvent diff --git a/numass-core/src/main/kotlin/inr/numass/data/analyzers/SimpleAnalyzer.kt b/numass-core/src/main/kotlin/inr/numass/data/analyzers/SimpleAnalyzer.kt index a8cfad59..790eb88f 100644 --- a/numass-core/src/main/kotlin/inr/numass/data/analyzers/SimpleAnalyzer.kt +++ b/numass-core/src/main/kotlin/inr/numass/data/analyzers/SimpleAnalyzer.kt @@ -17,7 +17,7 @@ package inr.numass.data.analyzers import hep.dataforge.meta.Meta -import hep.dataforge.tables.ValueMap +import hep.dataforge.values.ValueMap import hep.dataforge.values.Values import inr.numass.data.api.NumassBlock import inr.numass.data.api.SignalProcessor diff --git a/numass-core/src/main/kotlin/inr/numass/data/analyzers/SmartAnalyzer.kt b/numass-core/src/main/kotlin/inr/numass/data/analyzers/SmartAnalyzer.kt index ea92048a..6b9d59b8 100644 --- a/numass-core/src/main/kotlin/inr/numass/data/analyzers/SmartAnalyzer.kt +++ b/numass-core/src/main/kotlin/inr/numass/data/analyzers/SmartAnalyzer.kt @@ -18,8 +18,8 @@ package inr.numass.data.analyzers import hep.dataforge.meta.Meta import hep.dataforge.tables.TableFormat -import hep.dataforge.tables.ValueMap import hep.dataforge.values.Value +import hep.dataforge.values.ValueMap import hep.dataforge.values.Values import inr.numass.data.api.NumassBlock import inr.numass.data.api.NumassEvent @@ -54,7 +54,7 @@ class SmartAnalyzer(processor: SignalProcessor? = null) : AbstractAnalyzer(proce override fun analyze(block: NumassBlock, config: Meta): Values { val analyzer = getAnalyzer(config) - val map = analyzer.analyze(block, config).asMap() + val map = analyzer.analyze(block, config).asMap().toMutableMap() map.putIfAbsent(TimeAnalyzer.T0_KEY, Value.of(0.0)) return ValueMap(map) } diff --git a/numass-core/src/main/kotlin/inr/numass/data/analyzers/TimeAnalyzer.kt b/numass-core/src/main/kotlin/inr/numass/data/analyzers/TimeAnalyzer.kt index 7de5e732..afd86191 100644 --- a/numass-core/src/main/kotlin/inr/numass/data/analyzers/TimeAnalyzer.kt +++ b/numass-core/src/main/kotlin/inr/numass/data/analyzers/TimeAnalyzer.kt @@ -22,8 +22,8 @@ import hep.dataforge.meta.Meta import hep.dataforge.tables.Adapters.* import hep.dataforge.tables.TableFormat import hep.dataforge.tables.TableFormatBuilder -import hep.dataforge.tables.ValueMap import hep.dataforge.values.Value +import hep.dataforge.values.ValueMap import hep.dataforge.values.ValueType import hep.dataforge.values.Values import inr.numass.data.api.NumassBlock diff --git a/numass-core/src/main/kotlin/inr/numass/data/storage/ClassicNumassPoint.kt b/numass-core/src/main/kotlin/inr/numass/data/storage/ClassicNumassPoint.kt index 07ff693b..ccdd7d37 100644 --- a/numass-core/src/main/kotlin/inr/numass/data/storage/ClassicNumassPoint.kt +++ b/numass-core/src/main/kotlin/inr/numass/data/storage/ClassicNumassPoint.kt @@ -39,7 +39,7 @@ class ClassicNumassPoint(private val envelope: Envelope) : NumassPoint { override val startTime: Instant get() = if (meta.hasValue("start_time")) { - meta.getValue("start_time").getTime() + meta.getValue("start_time").time } else { super.startTime } 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 038619e5..638d6ad0 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 @@ -118,7 +118,7 @@ class NumassDataLoader( } override val startTime: Instant - get() = meta.optValue("start_time").map { it.getTime() }.orElseGet { super.startTime } + get() = meta.optValue("start_time").map { it.time }.orElseGet { super.startTime } override val isOpen: Boolean @@ -188,7 +188,7 @@ class NumassDataLoader( */ private fun readTime(meta: Meta): Instant { return if (meta.hasValue("start_time")) { - meta.getValue("start_time").getTime() + meta.getValue("start_time").time } else { Instant.EPOCH } diff --git a/numass-main/src/main/groovy/inr/numass/scripts/times/TestProto.groovy b/numass-main/src/main/groovy/inr/numass/scripts/times/TestProto.groovy index 3a298ab8..cba6aa7e 100644 --- a/numass-main/src/main/groovy/inr/numass/scripts/times/TestProto.groovy +++ b/numass-main/src/main/groovy/inr/numass/scripts/times/TestProto.groovy @@ -4,7 +4,7 @@ import hep.dataforge.context.Context import hep.dataforge.context.Global import hep.dataforge.grind.GrindShell import hep.dataforge.grind.helpers.PlotHelper -import hep.dataforge.tables.ValueMap +import hep.dataforge.values.ValueMap import inr.numass.NumassPlugin import inr.numass.data.PointAnalyzer import inr.numass.data.analyzers.NumassAnalyzer diff --git a/numass-main/src/main/java/inr/numass/actions/AdjustErrorsAction.java b/numass-main/src/main/java/inr/numass/actions/AdjustErrorsAction.java index cdb76ad8..71afe26d 100644 --- a/numass-main/src/main/java/inr/numass/actions/AdjustErrorsAction.java +++ b/numass-main/src/main/java/inr/numass/actions/AdjustErrorsAction.java @@ -12,7 +12,7 @@ import hep.dataforge.meta.Laminate; import hep.dataforge.meta.Meta; import hep.dataforge.tables.ListTable; import hep.dataforge.tables.Table; -import hep.dataforge.tables.ValueMap; +import hep.dataforge.values.ValueMap; import hep.dataforge.values.Values; import java.util.ArrayList; diff --git a/numass-main/src/main/java/inr/numass/actions/MonitorCorrectAction.java b/numass-main/src/main/java/inr/numass/actions/MonitorCorrectAction.java index 508ee7b7..322ff89d 100644 --- a/numass-main/src/main/java/inr/numass/actions/MonitorCorrectAction.java +++ b/numass-main/src/main/java/inr/numass/actions/MonitorCorrectAction.java @@ -23,8 +23,8 @@ import hep.dataforge.meta.Laminate; import hep.dataforge.meta.Meta; import hep.dataforge.tables.ListTable; import hep.dataforge.tables.Table; -import hep.dataforge.tables.ValueMap; import hep.dataforge.values.Value; +import hep.dataforge.values.ValueMap; import hep.dataforge.values.Values; import inr.numass.NumassUtils; import inr.numass.data.analyzers.NumassAnalyzer; diff --git a/numass-main/src/main/java/inr/numass/actions/SubstractSpectrumAction.java b/numass-main/src/main/java/inr/numass/actions/SubstractSpectrumAction.java index 8f6aecb1..50e029e2 100644 --- a/numass-main/src/main/java/inr/numass/actions/SubstractSpectrumAction.java +++ b/numass-main/src/main/java/inr/numass/actions/SubstractSpectrumAction.java @@ -13,7 +13,7 @@ import hep.dataforge.meta.Laminate; import hep.dataforge.meta.Meta; import hep.dataforge.tables.ListTable; import hep.dataforge.tables.Table; -import hep.dataforge.tables.ValueMap; +import hep.dataforge.values.ValueMap; import hep.dataforge.values.Values; import inr.numass.NumassUtils; diff --git a/numass-main/src/main/java/inr/numass/utils/DataModelUtils.java b/numass-main/src/main/java/inr/numass/utils/DataModelUtils.java index 3196c389..b674f029 100644 --- a/numass-main/src/main/java/inr/numass/utils/DataModelUtils.java +++ b/numass-main/src/main/java/inr/numass/utils/DataModelUtils.java @@ -17,7 +17,7 @@ package inr.numass.utils; import hep.dataforge.tables.ListTable; import hep.dataforge.tables.Table; -import hep.dataforge.tables.ValueMap; +import hep.dataforge.values.ValueMap; import hep.dataforge.values.Values; import java.util.Scanner; @@ -38,7 +38,7 @@ public class DataModelUtils { for (int i = 0; i < numpoints; i++) { // формула работает даже в том случае когда порядок точек обратный double x = from + (to - from) / (numpoints - 1) * i; - Values point = ValueMap.of(list, x, time); + Values point = ValueMap.Companion.of(list, x, time); res.row(point); } @@ -52,7 +52,7 @@ public class DataModelUtils { while (scan.hasNextLine()) { double x = scan.nextDouble(); int time = scan.nextInt(); - res.row(ValueMap.of(list, x, time)); + res.row(ValueMap.Companion.of(list, x, time)); } return res.build(); } diff --git a/numass-main/src/main/java/inr/numass/utils/OldDataReader.java b/numass-main/src/main/java/inr/numass/utils/OldDataReader.java index 4ee0612c..28a893f3 100644 --- a/numass-main/src/main/java/inr/numass/utils/OldDataReader.java +++ b/numass-main/src/main/java/inr/numass/utils/OldDataReader.java @@ -20,7 +20,7 @@ import hep.dataforge.meta.Meta; import hep.dataforge.tables.Adapters; import hep.dataforge.tables.ListTable; import hep.dataforge.tables.Table; -import hep.dataforge.tables.ValueMap; +import hep.dataforge.values.ValueMap; import hep.dataforge.values.Values; import inr.numass.data.SpectrumAdapter; @@ -53,7 +53,7 @@ public class OldDataReader { if (lineScan.hasNextDouble()) { ushift = lineScan.nextDouble(); } - Values point = ValueMap.of(list, u, time, ushift); + Values point = ValueMap.Companion.of(list, u, time, ushift); res.row(point); } return res.build(); diff --git a/numass-main/src/main/java/inr/numass/utils/UnderflowCorrection.java b/numass-main/src/main/java/inr/numass/utils/UnderflowCorrection.java index d768d2ca..95ac5a08 100644 --- a/numass-main/src/main/java/inr/numass/utils/UnderflowCorrection.java +++ b/numass-main/src/main/java/inr/numass/utils/UnderflowCorrection.java @@ -9,7 +9,7 @@ import hep.dataforge.meta.Meta; import hep.dataforge.tables.ListTable; import hep.dataforge.tables.Table; import hep.dataforge.tables.TableTransform; -import hep.dataforge.tables.ValueMap; +import hep.dataforge.values.ValueMap; import hep.dataforge.values.Values; import inr.numass.data.analyzers.NumassAnalyzer; import inr.numass.data.analyzers.NumassAnalyzerKt; @@ -85,7 +85,7 @@ public class UnderflowCorrection { double a = fitRes[0]; double sigma = fitRes[1]; - return ValueMap.of(pointNames, point.getVoltage(), a, sigma, a * sigma * Math.exp(xLow / sigma) / norm + 1d); + return ValueMap.Companion.of(pointNames, point.getVoltage(), a, sigma, a * sigma * Math.exp(xLow / sigma) / norm + 1d); } public Table fitAllPoints(Iterable data, int xLow, int xHigh, int upper, int binning) { diff --git a/numass-main/src/main/kotlin/inr/numass/NumassUtils.kt b/numass-main/src/main/kotlin/inr/numass/NumassUtils.kt index 0d45bb19..c8ff6406 100644 --- a/numass-main/src/main/kotlin/inr/numass/NumassUtils.kt +++ b/numass-main/src/main/kotlin/inr/numass/NumassUtils.kt @@ -31,7 +31,7 @@ import hep.dataforge.meta.MetaBuilder import hep.dataforge.plots.jfreechart.JFreeChartFrame import hep.dataforge.tables.ListTable import hep.dataforge.tables.Table -import hep.dataforge.tables.ValueMap +import hep.dataforge.values.ValueMap import hep.dataforge.values.ValueType import hep.dataforge.values.Values import inr.numass.data.analyzers.NumassAnalyzer diff --git a/numass-main/src/main/kotlin/inr/numass/actions/MergeDataAction.kt b/numass-main/src/main/kotlin/inr/numass/actions/MergeDataAction.kt index b68a8f7b..62302502 100644 --- a/numass-main/src/main/kotlin/inr/numass/actions/MergeDataAction.kt +++ b/numass-main/src/main/kotlin/inr/numass/actions/MergeDataAction.kt @@ -23,7 +23,11 @@ import hep.dataforge.description.NodeDef import hep.dataforge.description.TypedActionDef import hep.dataforge.meta.Laminate import hep.dataforge.meta.Meta -import hep.dataforge.tables.* +import hep.dataforge.tables.ListTable +import hep.dataforge.tables.MetaTableFormat +import hep.dataforge.tables.Table +import hep.dataforge.tables.TableTransform +import hep.dataforge.values.ValueMap import hep.dataforge.values.Values import inr.numass.NumassUtils import inr.numass.data.analyzers.NumassAnalyzer diff --git a/numass-main/src/main/kotlin/inr/numass/actions/SummaryAction.kt b/numass-main/src/main/kotlin/inr/numass/actions/SummaryAction.kt index 972d5e2a..64d19436 100644 --- a/numass-main/src/main/kotlin/inr/numass/actions/SummaryAction.kt +++ b/numass-main/src/main/kotlin/inr/numass/actions/SummaryAction.kt @@ -27,8 +27,8 @@ import hep.dataforge.stat.fit.FitState import hep.dataforge.tables.ListTable import hep.dataforge.tables.MetaTableFormat import hep.dataforge.tables.Table -import hep.dataforge.tables.ValueMap import hep.dataforge.values.Value +import hep.dataforge.values.ValueMap import inr.numass.NumassUtils import java.util.* @@ -76,7 +76,7 @@ object SummaryAction : ManyToOneAction() { input.forEach { key: String, value: FitState -> val values = arrayOfNulls(names.size) - values[0] = Value.of(key) + values[0] = Value.parseValue(key) for (i in parNames.indices) { val `val` = Value.of(value.parameters.getDouble(parNames[i])) values[2 * i + 1] = `val` @@ -92,7 +92,7 @@ object SummaryAction : ManyToOneAction() { } val averageValues = arrayOfNulls(names.size) - averageValues[0] = Value.of("average") + averageValues[0] = Value.parseValue("average") averageValues[averageValues.size - 1] = Value.of(0) for (i in parNames.indices) { 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 0062973c..30464556 100644 --- a/numass-main/src/main/kotlin/inr/numass/subthreshold/Threshold.kt +++ b/numass-main/src/main/kotlin/inr/numass/subthreshold/Threshold.kt @@ -5,12 +5,11 @@ import hep.dataforge.data.DataNode import hep.dataforge.data.DataSet import hep.dataforge.kodex.buildMeta import hep.dataforge.kodex.pipe -import hep.dataforge.kodex.toList import hep.dataforge.meta.Meta import hep.dataforge.storage.commons.StorageUtils import hep.dataforge.tables.ListTable import hep.dataforge.tables.Table -import hep.dataforge.tables.ValueMap +import hep.dataforge.values.ValueMap import hep.dataforge.values.Values import inr.numass.data.analyzers.NumassAnalyzer.Companion.CHANNEL_KEY import inr.numass.data.analyzers.NumassAnalyzer.Companion.COUNT_RATE_KEY diff --git a/numass-main/src/main/kotlin/inr/numass/tasks/NumassFitScanTask.kt b/numass-main/src/main/kotlin/inr/numass/tasks/NumassFitScanTask.kt index effa2061..77af7a4e 100644 --- a/numass-main/src/main/kotlin/inr/numass/tasks/NumassFitScanTask.kt +++ b/numass-main/src/main/kotlin/inr/numass/tasks/NumassFitScanTask.kt @@ -35,7 +35,7 @@ object NumassFitScanTask : AbstractTask() { .collect(Collectors.toList()) ) } else { - config.getValue("hep/dataforge/values", Value.of("[2.5e5, 1e6, 2.25e6, 4e6, 6.25e6, 9e6]")) + config.getValue("hep/dataforge/values", Value.parseValue("[2.5e5, 1e6, 2.25e6, 4e6, 6.25e6, 9e6]")) } val action = FitAction() diff --git a/numass-test/src/main/groovy/inr/numass/scripts/TestStorageAccess.groovy b/numass-test/src/main/groovy/inr/numass/scripts/TestStorageAccess.groovy index 2f03f7e1..503f9560 100644 --- a/numass-test/src/main/groovy/inr/numass/scripts/TestStorageAccess.groovy +++ b/numass-test/src/main/groovy/inr/numass/scripts/TestStorageAccess.groovy @@ -12,7 +12,7 @@ import hep.dataforge.meta.Meta import hep.dataforge.meta.MetaBuilder import hep.dataforge.storage.commons.LoaderFactory import hep.dataforge.storage.commons.StorageManager -import hep.dataforge.tables.ValueMap +import hep.dataforge.values.ValueMap import inr.numass.client.NumassClient new StorageManager().startGlobal(); diff --git a/numass-viewer/src/main/kotlin/inr/numass/viewer/HVView.kt b/numass-viewer/src/main/kotlin/inr/numass/viewer/HVView.kt index 97141f3e..b056cfbd 100644 --- a/numass-viewer/src/main/kotlin/inr/numass/viewer/HVView.kt +++ b/numass-viewer/src/main/kotlin/inr/numass/viewer/HVView.kt @@ -58,7 +58,7 @@ class HVView : View(title = "High voltage time plot", icon = ImageView(dfIcon)) hvData?.let { for (dp in it) { val plot: TimePlot = frame[change.key] as TimePlot? ?: TimePlot(change.key).apply { frame.add(this) } - plot.put(dp.getValue("timestamp").getTime(), dp.getValue("value")) + plot.put(dp.getValue("timestamp").time, dp.getValue("value")) } } container.progress = 1.0; diff --git a/numass-web/src/main/kotlin/inr/numass/server/Interceptors.kt b/numass-web/src/main/kotlin/inr/numass/server/Interceptors.kt index b78de839..5a38f541 100644 --- a/numass-web/src/main/kotlin/inr/numass/server/Interceptors.kt +++ b/numass-web/src/main/kotlin/inr/numass/server/Interceptors.kt @@ -2,17 +2,18 @@ package inr.numass.server import hep.dataforge.control.DeviceManager import hep.dataforge.providers.Path -import hep.dataforge.server.* +import hep.dataforge.server.InterceptorFactory +import hep.dataforge.server.ServerInterceptor +import hep.dataforge.server.asJson +import hep.dataforge.server.jsonObject import hep.dataforge.storage.api.TableLoader import hep.dataforge.storage.commons.StorageManager -import hep.dataforge.storage.commons.StorageUtils import hep.dataforge.values.Value import io.ktor.application.ApplicationCall import io.ktor.application.call import io.ktor.http.ContentType import io.ktor.response.respondText import io.ktor.routing.get -import javax.json.JsonObjectBuilder private suspend fun ApplicationCall.error(type: String, message: String) { @@ -64,8 +65,8 @@ val storageInterceptor = InterceptorFactory { context, meta -> if (loaderObject.isPresent) { val loader = loaderObject.get(); if (loader is TableLoader) { - val from = Value.of(call.request.queryParameters["from"] ?: "") - val to = Value.of(call.request.queryParameters["to"] ?: "") + val from = Value.parseValue(call.request.queryParameters["from"] ?: "") + val to = Value.parseValue(call.request.queryParameters["to"] ?: "") val maxItems = (call.request.queryParameters["maxItems"] ?: "1000").toInt() call.json { add("path", loader.path.toString())