A lot of fixes. Changed name to key in value annotations

This commit is contained in:
Alexander Nozik 2018-05-16 20:56:35 +03:00
parent db378c4158
commit caf875da84
22 changed files with 92 additions and 73 deletions

View File

@ -53,8 +53,8 @@ import java.util.*
RoleDef(name = Roles.STORAGE_ROLE), RoleDef(name = Roles.STORAGE_ROLE),
RoleDef(name = Roles.VIEW_ROLE) RoleDef(name = Roles.VIEW_ROLE)
) )
@ValueDef(name = "port", def = "virtual", info = "The name of the port for this PKT8") @ValueDef(key = "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) @StateDef(value = ValueDef(key = "storing", info = "Define if this device is currently writes to storage"), writable = true)
@DeviceView(PKT8Display::class) @DeviceView(PKT8Display::class)
class PKT8Device(context: Context, meta: Meta) : PortSensor(context, meta) { class PKT8Device(context: Context, meta: Meta) : PortSensor(context, meta) {
/** /**

View File

@ -21,7 +21,7 @@ import java.util.*
import java.util.stream.Stream import java.util.stream.Stream
import kotlin.collections.ArrayList 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) @DeviceView(LambdaHubDisplay::class)
class LambdaHub(context: Context, meta: Meta) : DeviceHub, AbstractDevice(context, meta) { class LambdaHub(context: Context, meta: Meta) : DeviceHub, AbstractDevice(context, meta) {

View File

@ -42,16 +42,16 @@ import java.util.concurrent.Future
*/ */
@StateDefs( @StateDefs(
StateDef(value = ValueDef(name = "current", type = arrayOf(NUMBER), def = "-1", info = "Current current")), StateDef(value = ValueDef(key = "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(key = "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(key = "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(key = "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(key = "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(key = "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(key = "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(key = "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(value = ValueDef(key = "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(ValueDef(key = "status", type = [STRING], def = "INIT", enumeration = LambdaMagnet.MagnetStatus::class, info = "Current state of magnet operation"))
) )
@DeviceView(MagnetDisplay::class) @DeviceView(MagnetDisplay::class)
class LambdaMagnet(private val controller: LambdaPortController, meta: Meta) : AbstractDevice(controller.context, meta) { class LambdaMagnet(private val controller: LambdaPortController, meta: Meta) : AbstractDevice(controller.context, meta) {

View File

@ -52,13 +52,13 @@ import java.util.*
RoleDef(name = Roles.VIEW_ROLE) RoleDef(name = Roles.VIEW_ROLE)
) )
@StateDefs( @StateDefs(
StateDef(value = ValueDef(name = "controlled", info = "Connection with the device itself"), writable = true), StateDef(value = ValueDef(key = "controlled", info = "Connection with the device itself"), writable = true),
StateDef(ValueDef(name = SELECTED_STATE)), StateDef(ValueDef(key = SELECTED_STATE)),
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),
StateDef(value = ValueDef(name = "filament", info = "The number of filament in use"), writable = true), StateDef(value = ValueDef(key = "filament", info = "The number of filament in use"), writable = true),
StateDef(value = ValueDef(name = "filamentOn", info = "Mass-spectrometer filament on"), writable = true), StateDef(value = ValueDef(key = "filamentOn", info = "Mass-spectrometer filament on"), writable = true),
StateDef(ValueDef(name = "filamentStatus", info = "Filament status")), StateDef(ValueDef(key = "filamentStatus", info = "Filament status")),
StateDef(ValueDef(name = "peakJump.zero", type = [ValueType.NUMBER], info = "Peak jump zero reading")) StateDef(ValueDef(key = "peakJump.zero", type = [ValueType.NUMBER], info = "Peak jump zero reading"))
) )
@DeviceView(MspDisplay::class) @DeviceView(MspDisplay::class)
class MspDevice(context: Context, meta: Meta) : PortSensor(context, meta) { class MspDevice(context: Context, meta: Meta) : PortSensor(context, meta) {

View File

@ -20,9 +20,9 @@ import inr.numass.control.DeviceView
/** /**
* @author Alexander Nozik * @author Alexander Nozik
*/ */
@ValueDef(name = "channel") @ValueDef(key = "channel")
@DeviceView(VacDisplay::class) @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) { class MKSBaratronDevice(context: Context, meta: Meta) : PortSensor(context, meta) {
var channel by valueState("channel").intDelegate var channel by valueState("channel").intDelegate

View File

@ -26,12 +26,12 @@ import java.util.regex.Pattern
* @author Alexander Nozik * @author Alexander Nozik
*/ */
@ValueDefs( @ValueDefs(
ValueDef(name = "address", def = "253"), ValueDef(key = "address", def = "253"),
ValueDef(name = "channel", def = "5"), ValueDef(key = "channel", def = "5"),
ValueDef(name = "powerButton", type = arrayOf(BOOLEAN), def = "true") ValueDef(key = "powerButton", type = arrayOf(BOOLEAN), def = "true")
) )
@StateDefs( @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) // StateDef(value = ValueDef(name = "channel", info = "Measurement channel", type = arrayOf(NUMBER), def = "5"), writable = true)
) )
@DeviceView(VacDisplay::class) @DeviceView(VacDisplay::class)

View File

@ -23,7 +23,7 @@ import java.util.regex.Pattern
/** /**
* @author Alexander Nozik * @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) { class MeradatVacDevice(context: Context, meta: Meta) : PortSensor(context, meta) {
var address by valueState("address").intDelegate var address by valueState("address").intDelegate

View File

@ -42,7 +42,7 @@ import java.util.stream.Stream
* @author [Alexander Nozik](mailto:altavir@gmail.com) * @author [Alexander Nozik](mailto:altavir@gmail.com)
*/ */
@RoleDef(name = Roles.STORAGE_ROLE, objectType = StorageConnection::class, info = "Storage for acquired points") @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) @DeviceView(VacCollectorDisplay::class)
class VacCollectorDevice(context: Context, meta: Meta, val sensors: Collection<Sensor>) : Sensor(context, meta), DeviceHub { class VacCollectorDevice(context: Context, meta: Meta, val sensors: Collection<Sensor>) : Sensor(context, meta), DeviceHub {

View File

@ -45,11 +45,14 @@ import kotlin.streams.toList
* An analyzer which uses time information from events * An analyzer which uses time information from events
* Created by darksnake on 11.07.2017. * 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 { override fun analyze(block: NumassBlock, config: Meta): Values {
//In case points inside points //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) return analyzeParent(block, config)
} }
@ -130,9 +133,9 @@ class TimeAnalyzer @JvmOverloads constructor(private val processor: SignalProces
} }
@ValueDefs( @ValueDefs(
ValueDef(name = "t0", type = arrayOf(ValueType.NUMBER), info = "Constant t0 cut"), ValueDef(key = "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(key = "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.min", type = arrayOf(ValueType.NUMBER), def = "0", info = "Minimal t0")
) )
private fun getT0(block: NumassBlock, meta: Meta): Int { private fun getT0(block: NumassBlock, meta: Meta): Int {
return if (meta.hasValue("t0")) { return if (meta.hasValue("t0")) {
@ -168,7 +171,15 @@ class TimeAnalyzer @JvmOverloads constructor(private val processor: SignalProces
*/ */
fun getEventsWithDelay(block: NumassBlock, config: Meta): Sequence<Pair<NumassEvent, Long>> { fun getEventsWithDelay(block: NumassBlock, config: Meta): Sequence<Pair<NumassEvent, Long>> {
val inverted = config.getBoolean("inverted", true) val inverted = config.getBoolean("inverted", true)
return super.getEvents(block, config).asSequence().zipWithNext { prev, next -> val events: Stream<NumassEvent> = 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) val delay = Math.max(next.timeOffset - prev.timeOffset, 0)
if (inverted) { if (inverted) {
Pair(next, delay) Pair(next, delay)

View File

@ -6,6 +6,12 @@ import java.util.stream.Stream
interface ParentBlock : NumassBlock { interface ParentBlock : NumassBlock {
val blocks: List<NumassBlock> val blocks: List<NumassBlock>
/**
* If true, the sub-blocks a considered to be isSequential, if not, the sub-blocks are parallel
*/
val isSequential: Boolean
get() = true
} }
/** /**

View File

@ -107,6 +107,10 @@ interface NumassPoint : Metoid, ParentBlock, Provider {
override val frames: Stream<NumassFrame> override val frames: Stream<NumassFrame>
get() = blocks.stream().flatMap { it.frames } get() = blocks.stream().flatMap { it.frames }
override val isSequential: Boolean
get() = channels.size == 1
companion object { companion object {
const val NUMASS_BLOCK_TARGET = "block" const val NUMASS_BLOCK_TARGET = "block"
const val NUMASS_CHANNEL_TARGET = "channel" const val NUMASS_CHANNEL_TARGET = "channel"

View File

@ -56,7 +56,6 @@ class ProtoNumassPoint(override val meta: Meta, val protoBuilder: () -> NumassPr
super.length super.length
} }
companion object { companion object {
fun readFile(path: Path): ProtoNumassPoint { fun readFile(path: Path): ProtoNumassPoint {
return fromEnvelope(NumassFileEnvelope.open(path, true)) 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<NumassEvent> override val events: Stream<NumassEvent>
get() = if (block.hasEvents()) { get() = if (block.hasEvents()) {
val events = block.events 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}") 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) } IntStream.range(0, events.timesCount).mapToObj { i -> NumassEvent(events.getAmplitudes(i).toShort(), events.getTimes(i), this) }

View File

@ -38,7 +38,7 @@ import java.util.stream.StreamSupport;
* @author darksnake * @author darksnake
*/ */
@TypedActionDef(name = "plotFit", info = "Plot fit result", inputType = FitState.class, outputType = FitState.class) @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<FitResult, FitResult> { public class PlotFitResultAction extends OneToOneAction<FitResult, FitResult> {
@Override @Override

View File

@ -19,8 +19,8 @@ import inr.numass.data.api.NumassSet
*/ */
@TypedActionDef(name = "numass.analyze", inputType = NumassSet::class, outputType = Table::class) @TypedActionDef(name = "numass.analyze", inputType = NumassSet::class, outputType = Table::class)
@ValueDefs( @ValueDefs(
ValueDef(name = "window.lo", type = arrayOf(NUMBER, STRING), def = "0", info = "Lower bound for window"), ValueDef(key = "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.up", type = arrayOf(NUMBER, STRING), def = "10000", info = "Upper bound for window")
) )
class AnalyzeDataAction : OneToOneAction<NumassSet, Table>() { class AnalyzeDataAction : OneToOneAction<NumassSet, Table>() {
override fun execute(context: Context, name: String, input: NumassSet, inputMeta: Laminate): Table { override fun execute(context: Context, name: String, input: NumassSet, inputMeta: Laminate): Table {

View File

@ -38,7 +38,7 @@ import java.util.*
* @author Darksnake * @author Darksnake
*/ */
@TypedActionDef(name = "numass.merge", inputType = Table::class, outputType = Table::class, info = "Merge different numass data files into one.") @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<Table, Table>() { class MergeDataAction : ManyToOneAction<Table, Table>() {
private val parnames = arrayOf(NumassPoint.HV_KEY, NumassPoint.LENGTH_KEY, NumassAnalyzer.COUNT_KEY, NumassAnalyzer.COUNT_RATE_KEY, NumassAnalyzer.COUNT_RATE_ERROR_KEY) private val parnames = arrayOf(NumassPoint.HV_KEY, NumassPoint.LENGTH_KEY, NumassAnalyzer.COUNT_KEY, NumassAnalyzer.COUNT_RATE_KEY, NumassAnalyzer.COUNT_RATE_ERROR_KEY)

View File

@ -38,7 +38,7 @@ import kotlin.collections.ArrayList
* @author Darksnake * @author Darksnake
*/ */
@TypedActionDef(name = "summary", inputType = FitState::class, outputType = Table::class, info = "Generate summary for fit results of different datasets.") @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<FitState, Table>() { object SummaryAction : ManyToOneAction<FitState, Table>() {
const val SUMMARY_NAME = "sumName" const val SUMMARY_NAME = "sumName"

View File

@ -22,16 +22,16 @@ import kotlin.streams.asStream
* Plot time analysis graphics * Plot time analysis graphics
*/ */
@ValueDefs( @ValueDefs(
ValueDef(name = "normalize", type = arrayOf(ValueType.BOOLEAN), def = "true", info = "Normalize t0 dependencies"), ValueDef(key = "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(key = "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(key = "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(key = "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(key = "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 = "binSize", type = arrayOf(ValueType.NUMBER), info = "Size of bin for time histogram. By default is defined automatically")
) )
@NodeDefs( @NodeDefs(
NodeDef(name = "histogram", info = "Configuration for histogram plots"), NodeDef(key = "histogram", info = "Configuration for histogram plots"),
NodeDef(name = "plot", info = "Configuration for stat plots") NodeDef(key = "plot", info = "Configuration for stat plots")
) )
@TypedActionDef(name = "timeSpectrum", inputType = NumassPoint::class, outputType = Table::class) @TypedActionDef(name = "timeSpectrum", inputType = NumassPoint::class, outputType = Table::class)
class TimeAnalyzerAction : OneToOneAction<NumassPoint, Table>() { class TimeAnalyzerAction : OneToOneAction<NumassPoint, Table>() {
@ -54,7 +54,7 @@ class TimeAnalyzerAction : OneToOneAction<NumassPoint, Table>() {
.fill(analyzer .fill(analyzer
.getEventsWithDelay(input, inputMeta) .getEventsWithDelay(input, inputMeta)
.asStream() .asStream()
.mapToDouble { it.second / 1000.0 } .mapToDouble { it.second.toDouble() / 1000.0 }
).asTable() ).asTable()
//.histogram(input, loChannel, upChannel, binSize, binNum).asTable(); //.histogram(input, loChannel, upChannel, binSize, binNum).asTable();
@ -88,7 +88,7 @@ class TimeAnalyzerAction : OneToOneAction<NumassPoint, Table>() {
histPlot.add( histPlot.add(
XYFunctionPlot.plot(name + "_theory", 0.0, binSize * binNum) { 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)
} }
) )
} }

View File

@ -21,16 +21,16 @@ import kotlin.streams.asStream
* Plot time analysis graphics * Plot time analysis graphics
*/ */
@ValueDefs( @ValueDefs(
ValueDef(name = "normalize", type = arrayOf(ValueType.BOOLEAN), def = "true", info = "Normalize t0 dependencies"), ValueDef(key = "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(key = "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(key = "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(key = "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(key = "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 = "binSize", type = arrayOf(ValueType.NUMBER), info = "Size of bin for time histogram. By default is defined automatically")
) )
@NodeDefs( @NodeDefs(
NodeDef(name = "histogram", info = "Configuration for histogram plots"), NodeDef(key = "histogram", info = "Configuration for histogram plots"),
NodeDef(name = "plot", info = "Configuration for stat plots") NodeDef(key = "plot", info = "Configuration for stat plots")
) )
@TypedActionDef(name = "numass.timeSpectrum", inputType = NumassPoint::class, outputType = Table::class) @TypedActionDef(name = "numass.timeSpectrum", inputType = NumassPoint::class, outputType = Table::class)
class TimeSpectrumAction : OneToOneAction<NumassPoint, Table>() { class TimeSpectrumAction : OneToOneAction<NumassPoint, Table>() {

View File

@ -31,10 +31,10 @@ import java.util.*
*/ */
@TypedActionDef(name = "numass.transform", inputType = Table::class, outputType = Table::class) @TypedActionDef(name = "numass.transform", inputType = Table::class, outputType = Table::class)
@ValueDefs( @ValueDefs(
ValueDef(name = "correction", info = "An expression to correct count number depending on potential `U`, point length `T` and point itself as `point`"), ValueDef(key = "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 = "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<Table, Table>() { class TransformDataAction : OneToOneAction<Table, Table>() {
override fun execute(context: Context, name: String, input: Table, meta: Laminate): Table { override fun execute(context: Context, name: String, input: Table, meta: Laminate): Table {
@ -109,8 +109,8 @@ class TransformDataAction : OneToOneAction<Table, Table>() {
@ValueDefs( @ValueDefs(
ValueDef(name = "value", type = arrayOf(NUMBER, STRING), info = "Value or function to multiply count rate"), ValueDef(key = "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 = "err", type = arrayOf(NUMBER, STRING), info = "error of the value")
) )
private fun makeCorrection(corrMeta: Meta): Correction { private fun makeCorrection(corrMeta: Meta): Correction {
val expr = corrMeta.getString("value") val expr = corrMeta.getString("value")

View File

@ -28,12 +28,12 @@ import inr.numass.utils.NumassIntegrator
* @author Alexander Nozik * @author Alexander Nozik
*/ */
@NodeDefs( @NodeDefs(
NodeDef(name = "resolution"), NodeDef(key = "resolution"),
NodeDef(name = "transmission") NodeDef(key = "transmission")
) )
@ValueDefs( @ValueDefs(
ValueDef(name = "fssFile", info = "The name for external FSS file. By default internal FSS file is used"), ValueDef(key = "fssFile", info = "The name for external FSS file. By default internal FSS file is used"),
ValueDef(name = "useFSS", type = arrayOf(BOOLEAN)) ValueDef(key = "useFSS", type = arrayOf(BOOLEAN))
) )
/** /**

View File

@ -19,15 +19,14 @@ fun main(args: Array<String>) {
dataDir = "D:\\Work\\Numass\\data\\2018_04" 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 { val meta = buildMeta {
"t0" to 3000 "t0" to 3000
"binNum" to 200 "binNum" to 200
"t0Step" to 100 "t0Step" to 100
"chunkSize" to 3000 "chunkSize" to 3000
"sort" to true // "separateParallelBlocks" to true
// "separateBlocks" to true
node("window") { node("window") {
"lo" to 0 "lo" to 0
"up" to 4000 "up" to 4000

View File

@ -66,8 +66,8 @@ val analyzeTask = task("analyze") {
} }
@ValueDefs( @ValueDefs(
ValueDef(name = "showPlot", type = [ValueType.BOOLEAN], info = "Show plot after complete"), ValueDef(key = "showPlot", type = [ValueType.BOOLEAN], info = "Show plot after complete"),
ValueDef(name = "monitorVoltage", type = [ValueType.NUMBER], info = "The voltage for monitor point") ValueDef(key = "monitorVoltage", type = [ValueType.NUMBER], info = "The voltage for monitor point")
) )
val monitorTableTask = task("monitor") { val monitorTableTask = task("monitor") {
model { meta -> model { meta ->