From f283146fd9d3fd290e20b4a85f2555d3bc49139c Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Sat, 28 Jul 2018 09:53:01 +0300 Subject: [PATCH] Fixed descriptor building for properties --- .../inr/numass/control/cryotemp/PKT8Display.kt | 2 +- .../inr/numass/data/analyzers/TimeAnalyzer.kt | 17 +++++++++++------ .../kotlin/inr/numass/data/Visualization.kt | 1 + .../numass/scripts/timeanalysis/TestAnalyzer.kt | 6 +++--- .../numass/scripts/timeanalysis/TestBunch.kt | 5 +++-- 5 files changed, 19 insertions(+), 12 deletions(-) diff --git a/numass-control/cryotemp/src/main/kotlin/inr/numass/control/cryotemp/PKT8Display.kt b/numass-control/cryotemp/src/main/kotlin/inr/numass/control/cryotemp/PKT8Display.kt index 95ec7c73..1ef484c1 100644 --- a/numass-control/cryotemp/src/main/kotlin/inr/numass/control/cryotemp/PKT8Display.kt +++ b/numass-control/cryotemp/src/main/kotlin/inr/numass/control/cryotemp/PKT8Display.kt @@ -146,7 +146,7 @@ class PKT8Display : DeviceDisplayFX(), PKT8ValueListener { private val plotFrame: PlotFrame by lazy { JFreeChartFrame(plotFrameMeta).apply { - plots.descriptor = Descriptors.forType(TimePlot::class.java) + plots.descriptor = Descriptors.forJavaType(TimePlot::class.java) PlotUtils.setXAxis(this, "timestamp", "", "time") } } 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 c7387013..fb2f1dfe 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 @@ -43,7 +43,8 @@ import kotlin.streams.asStream * Created by darksnake on 11.07.2017. */ @ValueDefs( - ValueDef(key = "separateParallelBlocks", type = [ValueType.BOOLEAN], info = "If true, then parallel blocks will be forced to be evaluated separately") + ValueDef(key = "separateParallelBlocks", type = [ValueType.BOOLEAN], info = "If true, then parallel blocks will be forced to be evaluated separately"), + ValueDef(key = "chunkSize", type = [ValueType.NUMBER], def = "-1", info = "The number of events in chunk to split the chain into. If negative, no chunks are used") ) class TimeAnalyzer(processor: SignalProcessor? = null) : AbstractAnalyzer(processor) { @@ -58,12 +59,16 @@ class TimeAnalyzer(processor: SignalProcessor? = null) : AbstractAnalyzer(proces val upChannel = config.getInt("window.up", Integer.MAX_VALUE) val t0 = getT0(block, config).toLong() - val chunkSize = config.getInt("chunkSize", 1000) + val chunkSize = config.getInt("chunkSize", -1) - val res = getEventsWithDelay(block, config) - .chunked(chunkSize) { analyzeSequence(it.asSequence(), t0) } - .toList() - .mean(config.getEnum("mean", WEIGHTED)) + val res = if(chunkSize>0) { + getEventsWithDelay(block, config) + .chunked(chunkSize) { analyzeSequence(it.asSequence(), t0) } + .toList() + .mean(config.getEnum("mean", WEIGHTED)) + } else{ + analyzeSequence(getEventsWithDelay(block, config),t0) + } return ValueMap.Builder(res) .putValue(NumassAnalyzer.WINDOW_KEY, arrayOf(loChannel, upChannel)) diff --git a/numass-main/src/main/kotlin/inr/numass/data/Visualization.kt b/numass-main/src/main/kotlin/inr/numass/data/Visualization.kt index 9b29c9b8..ae8c715f 100644 --- a/numass-main/src/main/kotlin/inr/numass/data/Visualization.kt +++ b/numass-main/src/main/kotlin/inr/numass/data/Visualization.kt @@ -16,6 +16,7 @@ package inr.numass.data +import hep.dataforge.configure import hep.dataforge.context.Context import hep.dataforge.context.Global import hep.dataforge.meta.KMetaBuilder 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 745bbe06..07e17d19 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 @@ -22,8 +22,8 @@ fun main(args: Array) { NumassPlugin().startGlobal() val cr = 30e3 - val length = 30e9.toLong() - val num = 2 + val length = 1e9.toLong() + val num = 50 val dt = 6.5 val start = Instant.now() @@ -31,7 +31,7 @@ fun main(args: Array) { val point = (1..num).map { Global.generate { NumassGenerator - .generateEvents(cr) + .generateEvents(cr * (1.0 - 0.005 * it)) .withDeadTime { (dt * 1000).toLong() } .generateBlock(start.plusNanos(it * length), length) } 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 033c36c1..c868b98c 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 @@ -49,7 +49,7 @@ fun main(args: Array) { .generateEvents(cr) val bunches = NumassGenerator - .generateBunches(3.0, 0.001, 5.0) + .generateBunches(3.0, 0.02, 5.0) val discharges = NumassGenerator .generateBunches(50.0,0.001,0.1) @@ -66,9 +66,10 @@ fun main(args: Array) { val meta = buildMeta { "analyzer" to { - "t0" to 30000 + "t0" to 50000 } "binNum" to 200 + "t0.max" to 1e9 } TimeAnalyzerAction.simpleRun(point, meta);