diff --git a/numass-control/cryotemp/src/main/kotlin/inr/numass/control/cryotemp/PKT8Device.kt b/numass-control/cryotemp/src/main/kotlin/inr/numass/control/cryotemp/PKT8Device.kt index e23141d6..17e52c94 100644 --- a/numass-control/cryotemp/src/main/kotlin/inr/numass/control/cryotemp/PKT8Device.kt +++ b/numass-control/cryotemp/src/main/kotlin/inr/numass/control/cryotemp/PKT8Device.kt @@ -53,8 +53,8 @@ import java.util.* RoleDef(name = Roles.STORAGE_ROLE), RoleDef(name = Roles.VIEW_ROLE) ) -@ValueDef(name = "port", def = "virtual", info = "The name of the port for this PKT8") -@StateDef(value = ValueDef(name = "storing", info = "Define if this device is currently writes to storage"), writable = true) +@ValueDef(key = "port", def = "virtual", info = "The name of the port for this PKT8") +@StateDef(value = ValueDef(key = "storing", info = "Define if this device is currently writes to storage"), writable = true) @DeviceView(PKT8Display::class) class PKT8Device(context: Context, meta: Meta) : PortSensor(context, meta) { /** 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 8f1e0fdc..ad05a2ac 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 @@ -21,7 +21,7 @@ import java.util.* import java.util.stream.Stream import kotlin.collections.ArrayList -@StateDef(value = ValueDef(name = "address", type = arrayOf(ValueType.NUMBER), info = "Current active magnet")) +@StateDef(value = ValueDef(key = "address", type = arrayOf(ValueType.NUMBER), info = "Current active magnet")) @DeviceView(LambdaHubDisplay::class) class LambdaHub(context: Context, meta: Meta) : DeviceHub, AbstractDevice(context, meta) { 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 f3c71d36..ba709891 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 @@ -42,16 +42,16 @@ import java.util.concurrent.Future */ @StateDefs( - StateDef(value = ValueDef(name = "current", type = arrayOf(NUMBER), def = "-1", info = "Current current")), - StateDef(value = ValueDef(name = "voltage", type = arrayOf(NUMBER), def = "-1", info = "Current voltage")), - StateDef(value = ValueDef(name = "outCurrent", type = arrayOf(NUMBER), def = "0", info = "Target current"), writable = true), - StateDef(value = ValueDef(name = "outVoltage", type = arrayOf(NUMBER), def = "5.0", info = "Target voltage"), writable = true), - StateDef(value = ValueDef(name = "output", type = arrayOf(BOOLEAN), def = "false", info = "Weather output on or off"), writable = true), - StateDef(value = ValueDef(name = "lastUpdate", type = arrayOf(TIME), def = "0", info = "Time of the last update"), writable = true), - StateDef(value = ValueDef(name = "updating", type = arrayOf(BOOLEAN), def = "false", info = "Shows if current ramping in progress"), writable = true), - StateDef(value = ValueDef(name = "monitoring", type = arrayOf(BOOLEAN), def = "false", info = "Shows if monitoring task is running"), writable = true), - StateDef(value = ValueDef(name = "speed", type = arrayOf(NUMBER), def = "5", info = "Current change speed in Ampere per minute"), writable = true), - StateDef(ValueDef(name = "status", type = [STRING], def = "INIT", enumeration = LambdaMagnet.MagnetStatus::class, info = "Current state of magnet operation")) + StateDef(value = ValueDef(key = "current", type = arrayOf(NUMBER), def = "-1", info = "Current current")), + StateDef(value = ValueDef(key = "voltage", type = arrayOf(NUMBER), def = "-1", info = "Current voltage")), + StateDef(value = ValueDef(key = "outCurrent", type = arrayOf(NUMBER), def = "0", info = "Target current"), writable = true), + StateDef(value = ValueDef(key = "outVoltage", type = arrayOf(NUMBER), def = "5.0", info = "Target voltage"), writable = true), + StateDef(value = ValueDef(key = "output", type = arrayOf(BOOLEAN), def = "false", info = "Weather output on or off"), writable = true), + StateDef(value = ValueDef(key = "lastUpdate", type = arrayOf(TIME), def = "0", info = "Time of the last update"), writable = true), + StateDef(value = ValueDef(key = "updating", type = arrayOf(BOOLEAN), def = "false", info = "Shows if current ramping in progress"), writable = true), + StateDef(value = ValueDef(key = "monitoring", type = arrayOf(BOOLEAN), def = "false", info = "Shows if monitoring task is running"), writable = true), + StateDef(value = ValueDef(key = "speed", type = arrayOf(NUMBER), def = "5", info = "Current change speed in Ampere per minute"), writable = true), + StateDef(ValueDef(key = "status", type = [STRING], def = "INIT", enumeration = LambdaMagnet.MagnetStatus::class, info = "Current state of magnet operation")) ) @DeviceView(MagnetDisplay::class) class LambdaMagnet(private val controller: LambdaPortController, meta: Meta) : AbstractDevice(controller.context, meta) { diff --git a/numass-control/msp/src/main/kotlin/inr/numass/control/msp/MspDevice.kt b/numass-control/msp/src/main/kotlin/inr/numass/control/msp/MspDevice.kt index 2c901b6b..0957a937 100644 --- a/numass-control/msp/src/main/kotlin/inr/numass/control/msp/MspDevice.kt +++ b/numass-control/msp/src/main/kotlin/inr/numass/control/msp/MspDevice.kt @@ -52,13 +52,13 @@ import java.util.* RoleDef(name = Roles.VIEW_ROLE) ) @StateDefs( - StateDef(value = ValueDef(name = "controlled", info = "Connection with the device itself"), writable = true), - StateDef(ValueDef(name = SELECTED_STATE)), - StateDef(value = ValueDef(name = "storing", info = "Define if this device is currently writes to storage"), writable = true), - StateDef(value = ValueDef(name = "filament", info = "The number of filament in use"), writable = true), - StateDef(value = ValueDef(name = "filamentOn", info = "Mass-spectrometer filament on"), writable = true), - StateDef(ValueDef(name = "filamentStatus", info = "Filament status")), - StateDef(ValueDef(name = "peakJump.zero", type = [ValueType.NUMBER], info = "Peak jump zero reading")) + StateDef(value = ValueDef(key = "controlled", info = "Connection with the device itself"), writable = true), + StateDef(ValueDef(key = SELECTED_STATE)), + StateDef(value = ValueDef(key = "storing", info = "Define if this device is currently writes to storage"), writable = true), + StateDef(value = ValueDef(key = "filament", info = "The number of filament in use"), writable = true), + StateDef(value = ValueDef(key = "filamentOn", info = "Mass-spectrometer filament on"), writable = true), + StateDef(ValueDef(key = "filamentStatus", info = "Filament status")), + StateDef(ValueDef(key = "peakJump.zero", type = [ValueType.NUMBER], info = "Peak jump zero reading")) ) @DeviceView(MspDisplay::class) class MspDevice(context: Context, meta: Meta) : PortSensor(context, meta) { diff --git a/numass-control/vac/src/main/kotlin/inr/numass/control/readvac/MKSBaratronDevice.kt b/numass-control/vac/src/main/kotlin/inr/numass/control/readvac/MKSBaratronDevice.kt index 379c2ff7..ffebdf2a 100644 --- a/numass-control/vac/src/main/kotlin/inr/numass/control/readvac/MKSBaratronDevice.kt +++ b/numass-control/vac/src/main/kotlin/inr/numass/control/readvac/MKSBaratronDevice.kt @@ -20,9 +20,9 @@ import inr.numass.control.DeviceView /** * @author Alexander Nozik */ -@ValueDef(name = "channel") +@ValueDef(key = "channel") @DeviceView(VacDisplay::class) -@StateDef(value = ValueDef(name = "channel", type = [ValueType.NUMBER], def = "2"), writable = true) +@StateDef(value = ValueDef(key = "channel", type = [ValueType.NUMBER], def = "2"), writable = true) class MKSBaratronDevice(context: Context, meta: Meta) : PortSensor(context, meta) { var channel by valueState("channel").intDelegate diff --git a/numass-control/vac/src/main/kotlin/inr/numass/control/readvac/MKSVacDevice.kt b/numass-control/vac/src/main/kotlin/inr/numass/control/readvac/MKSVacDevice.kt index 81e1452f..c681d832 100644 --- a/numass-control/vac/src/main/kotlin/inr/numass/control/readvac/MKSVacDevice.kt +++ b/numass-control/vac/src/main/kotlin/inr/numass/control/readvac/MKSVacDevice.kt @@ -26,12 +26,12 @@ import java.util.regex.Pattern * @author Alexander Nozik */ @ValueDefs( - ValueDef(name = "address", def = "253"), - ValueDef(name = "channel", def = "5"), - ValueDef(name = "powerButton", type = arrayOf(BOOLEAN), def = "true") + ValueDef(key = "address", def = "253"), + ValueDef(key = "channel", def = "5"), + ValueDef(key = "powerButton", type = arrayOf(BOOLEAN), def = "true") ) @StateDefs( - StateDef(value = ValueDef(name = "power", info = "Device powered up"), writable = true) + StateDef(value = ValueDef(key = "power", info = "Device powered up"), writable = true) // StateDef(value = ValueDef(name = "channel", info = "Measurement channel", type = arrayOf(NUMBER), def = "5"), writable = true) ) @DeviceView(VacDisplay::class) diff --git a/numass-control/vac/src/main/kotlin/inr/numass/control/readvac/MeradatVacDevice.kt b/numass-control/vac/src/main/kotlin/inr/numass/control/readvac/MeradatVacDevice.kt index c1a06a71..24b827f5 100644 --- a/numass-control/vac/src/main/kotlin/inr/numass/control/readvac/MeradatVacDevice.kt +++ b/numass-control/vac/src/main/kotlin/inr/numass/control/readvac/MeradatVacDevice.kt @@ -23,7 +23,7 @@ import java.util.regex.Pattern /** * @author Alexander Nozik */ -@StateDef(value = ValueDef(name = "address", type = [NUMBER], def = "1", info = "A modbus address"), writable = true) +@StateDef(value = ValueDef(key = "address", type = [NUMBER], def = "1", info = "A modbus address"), writable = true) class MeradatVacDevice(context: Context, meta: Meta) : PortSensor(context, meta) { var address by valueState("address").intDelegate 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 bc5ef7ce..7aabd150 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 @@ -42,7 +42,7 @@ import java.util.stream.Stream * @author [Alexander Nozik](mailto:altavir@gmail.com) */ @RoleDef(name = Roles.STORAGE_ROLE, objectType = StorageConnection::class, info = "Storage for acquired points") -@StateDef(value = ValueDef(name = "storing", info = "Define if this device is currently writes to storage"), writable = true) +@StateDef(value = ValueDef(key = "storing", info = "Define if this device is currently writes to storage"), writable = true) @DeviceView(VacCollectorDisplay::class) class VacCollectorDevice(context: Context, meta: Meta, val sensors: Collection) : Sensor(context, meta), DeviceHub { 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 412b4202..a93aee61 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 @@ -45,11 +45,14 @@ import kotlin.streams.toList * An analyzer which uses time information from events * Created by darksnake on 11.07.2017. */ -class TimeAnalyzer @JvmOverloads constructor(private val processor: SignalProcessor? = null) : AbstractAnalyzer(processor) { +@ValueDefs( + ValueDef(key = "separateParallelBlocks", type = [ValueType.BOOLEAN], info = "If true, then parallel blocks will be forced to be evaluated separately") +) +class TimeAnalyzer(processor: SignalProcessor? = null) : AbstractAnalyzer(processor) { override fun analyze(block: NumassBlock, config: Meta): Values { //In case points inside points - if (block is ParentBlock && config.getBoolean("separateBlocks", false)) { + if (block is ParentBlock && (block.isSequential || config.getBoolean("separateParallelBlocks", false))) { return analyzeParent(block, config) } @@ -130,9 +133,9 @@ class TimeAnalyzer @JvmOverloads constructor(private val processor: SignalProces } @ValueDefs( - ValueDef(name = "t0", type = arrayOf(ValueType.NUMBER), info = "Constant t0 cut"), - ValueDef(name = "t0.crFraction", type = arrayOf(ValueType.NUMBER), info = "The relative fraction of events that should be removed by time cut"), - ValueDef(name = "t0.min", type = arrayOf(ValueType.NUMBER), def = "0", info = "Minimal t0") + ValueDef(key = "t0", type = arrayOf(ValueType.NUMBER), info = "Constant t0 cut"), + ValueDef(key = "t0.crFraction", type = arrayOf(ValueType.NUMBER), info = "The relative fraction of events that should be removed by time cut"), + ValueDef(key = "t0.min", type = arrayOf(ValueType.NUMBER), def = "0", info = "Minimal t0") ) private fun getT0(block: NumassBlock, meta: Meta): Int { return if (meta.hasValue("t0")) { @@ -168,7 +171,15 @@ class TimeAnalyzer @JvmOverloads constructor(private val processor: SignalProces */ fun getEventsWithDelay(block: NumassBlock, config: Meta): Sequence> { val inverted = config.getBoolean("inverted", true) - return super.getEvents(block, config).asSequence().zipWithNext { prev, next -> + val events: Stream = super.getEvents(block, config).let { + if (block is ParentBlock && !block.isSequential) { + it.sorted(compareBy { it.timeOffset }) + } else { + it + } + } + + return events.asSequence().zipWithNext { prev, next -> val delay = Math.max(next.timeOffset - prev.timeOffset, 0) if (inverted) { Pair(next, delay) diff --git a/numass-core/src/main/kotlin/inr/numass/data/api/MetaBlock.kt b/numass-core/src/main/kotlin/inr/numass/data/api/MetaBlock.kt index 5b003755..0ce13ea2 100644 --- a/numass-core/src/main/kotlin/inr/numass/data/api/MetaBlock.kt +++ b/numass-core/src/main/kotlin/inr/numass/data/api/MetaBlock.kt @@ -6,6 +6,12 @@ import java.util.stream.Stream interface ParentBlock : NumassBlock { val blocks: List + + /** + * If true, the sub-blocks a considered to be isSequential, if not, the sub-blocks are parallel + */ + val isSequential: Boolean + get() = true } /** diff --git a/numass-core/src/main/kotlin/inr/numass/data/api/NumassPoint.kt b/numass-core/src/main/kotlin/inr/numass/data/api/NumassPoint.kt index 2dae90cb..41ca5af1 100644 --- a/numass-core/src/main/kotlin/inr/numass/data/api/NumassPoint.kt +++ b/numass-core/src/main/kotlin/inr/numass/data/api/NumassPoint.kt @@ -107,6 +107,10 @@ interface NumassPoint : Metoid, ParentBlock, Provider { override val frames: Stream get() = blocks.stream().flatMap { it.frames } + + override val isSequential: Boolean + get() = channels.size == 1 + companion object { const val NUMASS_BLOCK_TARGET = "block" const val NUMASS_CHANNEL_TARGET = "channel" 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 c7cd4017..8c12f6fa 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 @@ -56,7 +56,6 @@ class ProtoNumassPoint(override val meta: Meta, val protoBuilder: () -> NumassPr super.length } - companion object { fun readFile(path: Path): ProtoNumassPoint { return fromEnvelope(NumassFileEnvelope.open(path, true)) @@ -102,7 +101,7 @@ class ProtoBlock(val channel: Int, private val block: NumassProto.Point.Channel. override val events: Stream get() = if (block.hasEvents()) { val events = block.events - if(events.timesCount!= events.amplitudesCount){ + if (events.timesCount != events.amplitudesCount) { LoggerFactory.getLogger(javaClass).error("The block is broken. Number of times is ${events.timesCount} and number of amplitudes is ${events.amplitudesCount}") } IntStream.range(0, events.timesCount).mapToObj { i -> NumassEvent(events.getAmplitudes(i).toShort(), events.getTimes(i), this) } diff --git a/numass-main/src/main/java/hep/dataforge/plotfit/PlotFitResultAction.java b/numass-main/src/main/java/hep/dataforge/plotfit/PlotFitResultAction.java index 7034a541..88ccec0e 100644 --- a/numass-main/src/main/java/hep/dataforge/plotfit/PlotFitResultAction.java +++ b/numass-main/src/main/java/hep/dataforge/plotfit/PlotFitResultAction.java @@ -38,7 +38,7 @@ import java.util.stream.StreamSupport; * @author darksnake */ @TypedActionDef(name = "plotFit", info = "Plot fit result", inputType = FitState.class, outputType = FitState.class) -@NodeDef(name = "adapter", info = "adapter for DataSet being fitted. By default is taken from model.") +@NodeDef(key = "adapter", info = "adapter for DataSet being fitted. By default is taken from model.") public class PlotFitResultAction extends OneToOneAction { @Override diff --git a/numass-main/src/main/kotlin/inr/numass/actions/AnalyzeDataAction.kt b/numass-main/src/main/kotlin/inr/numass/actions/AnalyzeDataAction.kt index e44a4f9b..7e3e3421 100644 --- a/numass-main/src/main/kotlin/inr/numass/actions/AnalyzeDataAction.kt +++ b/numass-main/src/main/kotlin/inr/numass/actions/AnalyzeDataAction.kt @@ -19,8 +19,8 @@ import inr.numass.data.api.NumassSet */ @TypedActionDef(name = "numass.analyze", inputType = NumassSet::class, outputType = Table::class) @ValueDefs( - ValueDef(name = "window.lo", type = arrayOf(NUMBER, STRING), def = "0", info = "Lower bound for window"), - ValueDef(name = "window.up", type = arrayOf(NUMBER, STRING), def = "10000", info = "Upper bound for window") + ValueDef(key = "window.lo", type = arrayOf(NUMBER, STRING), def = "0", info = "Lower bound for window"), + ValueDef(key = "window.up", type = arrayOf(NUMBER, STRING), def = "10000", info = "Upper bound for window") ) class AnalyzeDataAction : OneToOneAction() { override fun execute(context: Context, name: String, input: NumassSet, inputMeta: Laminate): Table { 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 a5656d06..0d06c85e 100644 --- a/numass-main/src/main/kotlin/inr/numass/actions/MergeDataAction.kt +++ b/numass-main/src/main/kotlin/inr/numass/actions/MergeDataAction.kt @@ -38,7 +38,7 @@ import java.util.* * @author Darksnake */ @TypedActionDef(name = "numass.merge", inputType = Table::class, outputType = Table::class, info = "Merge different numass data files into one.") -@NodeDef(name = "grouping", info = "The definition of grouping rule for this merge", from = "method::hep.dataforge.actions.GroupBuilder.byMeta") +@NodeDef(key = "grouping", info = "The definition of grouping rule for this merge", from = "method::hep.dataforge.actions.GroupBuilder.byMeta") class MergeDataAction : ManyToOneAction() { private val parnames = arrayOf(NumassPoint.HV_KEY, NumassPoint.LENGTH_KEY, NumassAnalyzer.COUNT_KEY, NumassAnalyzer.COUNT_RATE_KEY, NumassAnalyzer.COUNT_RATE_ERROR_KEY) 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 7aa97f39..5bd45e1f 100644 --- a/numass-main/src/main/kotlin/inr/numass/actions/SummaryAction.kt +++ b/numass-main/src/main/kotlin/inr/numass/actions/SummaryAction.kt @@ -38,7 +38,7 @@ import kotlin.collections.ArrayList * @author Darksnake */ @TypedActionDef(name = "summary", inputType = FitState::class, outputType = Table::class, info = "Generate summary for fit results of different datasets.") -@ValueDef(name = "parnames", multiple = true, required = true, info = "List of names of parameters for which summary should be done") +@ValueDef(key = "parnames", multiple = true, required = true, info = "List of names of parameters for which summary should be done") object SummaryAction : ManyToOneAction() { const val SUMMARY_NAME = "sumName" diff --git a/numass-main/src/main/kotlin/inr/numass/actions/TimeAnalyzerAction.kt b/numass-main/src/main/kotlin/inr/numass/actions/TimeAnalyzerAction.kt index 97b8cb84..5d8096ae 100644 --- a/numass-main/src/main/kotlin/inr/numass/actions/TimeAnalyzerAction.kt +++ b/numass-main/src/main/kotlin/inr/numass/actions/TimeAnalyzerAction.kt @@ -22,16 +22,16 @@ import kotlin.streams.asStream * Plot time analysis graphics */ @ValueDefs( - ValueDef(name = "normalize", type = arrayOf(ValueType.BOOLEAN), def = "true", info = "Normalize t0 dependencies"), - ValueDef(name = "t0", type = arrayOf(ValueType.NUMBER), def = "30e3", info = "The default t0 in nanoseconds"), - ValueDef(name = "window.lo", type = arrayOf(ValueType.NUMBER), def = "0", info = "Lower boundary for amplitude window"), - ValueDef(name = "window.up", type = arrayOf(ValueType.NUMBER), def = "10000", info = "Upper boundary for amplitude window"), - ValueDef(name = "binNum", type = arrayOf(ValueType.NUMBER), def = "1000", info = "Number of bins for time histogram"), - ValueDef(name = "binSize", type = arrayOf(ValueType.NUMBER), info = "Size of bin for time histogram. By default is defined automatically") + ValueDef(key = "normalize", type = arrayOf(ValueType.BOOLEAN), def = "true", info = "Normalize t0 dependencies"), + ValueDef(key = "t0", type = arrayOf(ValueType.NUMBER), def = "30e3", info = "The default t0 in nanoseconds"), + ValueDef(key = "window.lo", type = arrayOf(ValueType.NUMBER), def = "0", info = "Lower boundary for amplitude window"), + ValueDef(key = "window.up", type = arrayOf(ValueType.NUMBER), def = "10000", info = "Upper boundary for amplitude window"), + ValueDef(key = "binNum", type = arrayOf(ValueType.NUMBER), def = "1000", info = "Number of bins for time histogram"), + ValueDef(key = "binSize", type = arrayOf(ValueType.NUMBER), info = "Size of bin for time histogram. By default is defined automatically") ) @NodeDefs( - NodeDef(name = "histogram", info = "Configuration for histogram plots"), - NodeDef(name = "plot", info = "Configuration for stat plots") + NodeDef(key = "histogram", info = "Configuration for histogram plots"), + NodeDef(key = "plot", info = "Configuration for stat plots") ) @TypedActionDef(name = "timeSpectrum", inputType = NumassPoint::class, outputType = Table::class) class TimeAnalyzerAction : OneToOneAction() { @@ -54,7 +54,7 @@ class TimeAnalyzerAction : OneToOneAction() { .fill(analyzer .getEventsWithDelay(input, inputMeta) .asStream() - .mapToDouble { it.second / 1000.0 } + .mapToDouble { it.second.toDouble() / 1000.0 } ).asTable() //.histogram(input, loChannel, upChannel, binSize, binNum).asTable(); @@ -88,7 +88,7 @@ class TimeAnalyzerAction : OneToOneAction() { histPlot.add( XYFunctionPlot.plot(name + "_theory", 0.0, binSize * binNum) { - trueCR * Math.exp(-it * trueCR / 1e6) * binSize + trueCR/1e6 * initialEstimate.getInt(NumassAnalyzer.COUNT_KEY) * Math.exp( - it * trueCR / 1e6) } ) } diff --git a/numass-main/src/main/kotlin/inr/numass/actions/TimeSpectrumAction.kt b/numass-main/src/main/kotlin/inr/numass/actions/TimeSpectrumAction.kt index 8cdd9897..53a6dc9d 100644 --- a/numass-main/src/main/kotlin/inr/numass/actions/TimeSpectrumAction.kt +++ b/numass-main/src/main/kotlin/inr/numass/actions/TimeSpectrumAction.kt @@ -21,16 +21,16 @@ import kotlin.streams.asStream * Plot time analysis graphics */ @ValueDefs( - ValueDef(name = "normalize", type = arrayOf(ValueType.BOOLEAN), def = "true", info = "Normalize t0 dependencies"), - ValueDef(name = "t0", type = arrayOf(ValueType.NUMBER), def = "30e3", info = "The default t0 in nanoseconds"), - ValueDef(name = "window.lo", type = arrayOf(ValueType.NUMBER), def = "500", info = "Lower boundary for amplitude window"), - ValueDef(name = "window.up", type = arrayOf(ValueType.NUMBER), def = "10000", info = "Upper boundary for amplitude window"), - ValueDef(name = "binNum", type = arrayOf(ValueType.NUMBER), def = "1000", info = "Number of bins for time histogram"), - ValueDef(name = "binSize", type = arrayOf(ValueType.NUMBER), info = "Size of bin for time histogram. By default is defined automatically") + ValueDef(key = "normalize", type = arrayOf(ValueType.BOOLEAN), def = "true", info = "Normalize t0 dependencies"), + ValueDef(key = "t0", type = arrayOf(ValueType.NUMBER), def = "30e3", info = "The default t0 in nanoseconds"), + ValueDef(key = "window.lo", type = arrayOf(ValueType.NUMBER), def = "500", info = "Lower boundary for amplitude window"), + ValueDef(key = "window.up", type = arrayOf(ValueType.NUMBER), def = "10000", info = "Upper boundary for amplitude window"), + ValueDef(key = "binNum", type = arrayOf(ValueType.NUMBER), def = "1000", info = "Number of bins for time histogram"), + ValueDef(key = "binSize", type = arrayOf(ValueType.NUMBER), info = "Size of bin for time histogram. By default is defined automatically") ) @NodeDefs( - NodeDef(name = "histogram", info = "Configuration for histogram plots"), - NodeDef(name = "plot", info = "Configuration for stat plots") + NodeDef(key = "histogram", info = "Configuration for histogram plots"), + NodeDef(key = "plot", info = "Configuration for stat plots") ) @TypedActionDef(name = "numass.timeSpectrum", inputType = NumassPoint::class, outputType = Table::class) class TimeSpectrumAction : OneToOneAction() { diff --git a/numass-main/src/main/kotlin/inr/numass/actions/TransformDataAction.kt b/numass-main/src/main/kotlin/inr/numass/actions/TransformDataAction.kt index 40608c64..9cfc634c 100644 --- a/numass-main/src/main/kotlin/inr/numass/actions/TransformDataAction.kt +++ b/numass-main/src/main/kotlin/inr/numass/actions/TransformDataAction.kt @@ -31,10 +31,10 @@ import java.util.* */ @TypedActionDef(name = "numass.transform", inputType = Table::class, outputType = Table::class) @ValueDefs( - ValueDef(name = "correction", info = "An expression to correct count number depending on potential `U`, point length `T` and point itself as `point`"), - ValueDef(name = "utransform", info = "Expression for voltage transformation. Uses U as input") + ValueDef(key = "correction", info = "An expression to correct count number depending on potential `U`, point length `T` and point itself as `point`"), + ValueDef(key = "utransform", info = "Expression for voltage transformation. Uses U as input") ) -@NodeDef(name = "correction", multiple = true, from = "method::inr.numass.actions.TransformDataAction.makeCorrection") +@NodeDef(key = "correction", multiple = true, from = "method::inr.numass.actions.TransformDataAction.makeCorrection") class TransformDataAction : OneToOneAction() { override fun execute(context: Context, name: String, input: Table, meta: Laminate): Table { @@ -109,8 +109,8 @@ class TransformDataAction : OneToOneAction() { @ValueDefs( - ValueDef(name = "value", type = arrayOf(NUMBER, STRING), info = "Value or function to multiply count rate"), - ValueDef(name = "err", type = arrayOf(NUMBER, STRING), info = "error of the value") + ValueDef(key = "value", type = arrayOf(NUMBER, STRING), info = "Value or function to multiply count rate"), + ValueDef(key = "err", type = arrayOf(NUMBER, STRING), info = "error of the value") ) private fun makeCorrection(corrMeta: Meta): Correction { val expr = corrMeta.getString("value") 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 62335835..645b0cc8 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 @@ -28,12 +28,12 @@ import inr.numass.utils.NumassIntegrator * @author Alexander Nozik */ @NodeDefs( - NodeDef(name = "resolution"), - NodeDef(name = "transmission") + NodeDef(key = "resolution"), + NodeDef(key = "transmission") ) @ValueDefs( - ValueDef(name = "fssFile", info = "The name for external FSS file. By default internal FSS file is used"), - ValueDef(name = "useFSS", type = arrayOf(BOOLEAN)) + ValueDef(key = "fssFile", info = "The name for external FSS file. By default internal FSS file is used"), + ValueDef(key = "useFSS", type = arrayOf(BOOLEAN)) ) /** diff --git a/numass-main/src/main/kotlin/inr/numass/scripts/timeanalysis/AnalyzePoint.kt b/numass-main/src/main/kotlin/inr/numass/scripts/timeanalysis/AnalyzePoint.kt index eeb69f2b..a1070175 100644 --- a/numass-main/src/main/kotlin/inr/numass/scripts/timeanalysis/AnalyzePoint.kt +++ b/numass-main/src/main/kotlin/inr/numass/scripts/timeanalysis/AnalyzePoint.kt @@ -19,15 +19,14 @@ fun main(args: Array) { dataDir = "D:\\Work\\Numass\\data\\2018_04" } - val storage = NumassStorageFactory.buildLocal(context, "Fill_2", true, false); + val storage = NumassStorageFactory.buildLocal(context, "Fill_4", true, false); val meta = buildMeta { "t0" to 3000 "binNum" to 200 "t0Step" to 100 "chunkSize" to 3000 - "sort" to true -// "separateBlocks" to true +// "separateParallelBlocks" to true node("window") { "lo" to 0 "up" to 4000 diff --git a/numass-main/src/main/kotlin/inr/numass/tasks/NumassTasks.kt b/numass-main/src/main/kotlin/inr/numass/tasks/NumassTasks.kt index fd1b10e0..528074b9 100644 --- a/numass-main/src/main/kotlin/inr/numass/tasks/NumassTasks.kt +++ b/numass-main/src/main/kotlin/inr/numass/tasks/NumassTasks.kt @@ -66,8 +66,8 @@ val analyzeTask = task("analyze") { } @ValueDefs( - ValueDef(name = "showPlot", type = [ValueType.BOOLEAN], info = "Show plot after complete"), - ValueDef(name = "monitorVoltage", type = [ValueType.NUMBER], info = "The voltage for monitor point") + ValueDef(key = "showPlot", type = [ValueType.BOOLEAN], info = "Show plot after complete"), + ValueDef(key = "monitorVoltage", type = [ValueType.NUMBER], info = "The voltage for monitor point") ) val monitorTableTask = task("monitor") { model { meta ->