Fixed descriptor building for properties

This commit is contained in:
Alexander Nozik 2018-07-28 09:53:01 +03:00
parent 2a83072d30
commit f283146fd9
5 changed files with 19 additions and 12 deletions

View File

@ -146,7 +146,7 @@ class PKT8Display : DeviceDisplayFX<PKT8Device>(), PKT8ValueListener {
private val plotFrame: PlotFrame by lazy { private val plotFrame: PlotFrame by lazy {
JFreeChartFrame(plotFrameMeta).apply { JFreeChartFrame(plotFrameMeta).apply {
plots.descriptor = Descriptors.forType(TimePlot::class.java) plots.descriptor = Descriptors.forJavaType(TimePlot::class.java)
PlotUtils.setXAxis(this, "timestamp", "", "time") PlotUtils.setXAxis(this, "timestamp", "", "time")
} }
} }

View File

@ -43,7 +43,8 @@ import kotlin.streams.asStream
* Created by darksnake on 11.07.2017. * Created by darksnake on 11.07.2017.
*/ */
@ValueDefs( @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) { 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 upChannel = config.getInt("window.up", Integer.MAX_VALUE)
val t0 = getT0(block, config).toLong() val t0 = getT0(block, config).toLong()
val chunkSize = config.getInt("chunkSize", 1000) val chunkSize = config.getInt("chunkSize", -1)
val res = getEventsWithDelay(block, config) val res = if(chunkSize>0) {
.chunked(chunkSize) { analyzeSequence(it.asSequence(), t0) } getEventsWithDelay(block, config)
.toList() .chunked(chunkSize) { analyzeSequence(it.asSequence(), t0) }
.mean(config.getEnum("mean", WEIGHTED)) .toList()
.mean(config.getEnum("mean", WEIGHTED))
} else{
analyzeSequence(getEventsWithDelay(block, config),t0)
}
return ValueMap.Builder(res) return ValueMap.Builder(res)
.putValue(NumassAnalyzer.WINDOW_KEY, arrayOf(loChannel, upChannel)) .putValue(NumassAnalyzer.WINDOW_KEY, arrayOf(loChannel, upChannel))

View File

@ -16,6 +16,7 @@
package inr.numass.data package inr.numass.data
import hep.dataforge.configure
import hep.dataforge.context.Context import hep.dataforge.context.Context
import hep.dataforge.context.Global import hep.dataforge.context.Global
import hep.dataforge.meta.KMetaBuilder import hep.dataforge.meta.KMetaBuilder

View File

@ -22,8 +22,8 @@ fun main(args: Array<String>) {
NumassPlugin().startGlobal() NumassPlugin().startGlobal()
val cr = 30e3 val cr = 30e3
val length = 30e9.toLong() val length = 1e9.toLong()
val num = 2 val num = 50
val dt = 6.5 val dt = 6.5
val start = Instant.now() val start = Instant.now()
@ -31,7 +31,7 @@ fun main(args: Array<String>) {
val point = (1..num).map { val point = (1..num).map {
Global.generate { Global.generate {
NumassGenerator NumassGenerator
.generateEvents(cr) .generateEvents(cr * (1.0 - 0.005 * it))
.withDeadTime { (dt * 1000).toLong() } .withDeadTime { (dt * 1000).toLong() }
.generateBlock(start.plusNanos(it * length), length) .generateBlock(start.plusNanos(it * length), length)
} }

View File

@ -49,7 +49,7 @@ fun main(args: Array<String>) {
.generateEvents(cr) .generateEvents(cr)
val bunches = NumassGenerator val bunches = NumassGenerator
.generateBunches(3.0, 0.001, 5.0) .generateBunches(3.0, 0.02, 5.0)
val discharges = NumassGenerator val discharges = NumassGenerator
.generateBunches(50.0,0.001,0.1) .generateBunches(50.0,0.001,0.1)
@ -66,9 +66,10 @@ fun main(args: Array<String>) {
val meta = buildMeta { val meta = buildMeta {
"analyzer" to { "analyzer" to {
"t0" to 30000 "t0" to 50000
} }
"binNum" to 200 "binNum" to 200
"t0.max" to 1e9
} }
TimeAnalyzerAction.simpleRun(point, meta); TimeAnalyzerAction.simpleRun(point, meta);