Minor fix to ColumnTable
This commit is contained in:
parent
b065748c48
commit
3383219da1
@ -90,5 +90,4 @@ class SimpleBlock(
|
||||
return SimpleBlock(startTime, length, producer())
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -29,7 +29,9 @@ import inr.numass.data.api.NumassSet
|
||||
import inr.numass.data.storage.NumassDirectory
|
||||
import inr.numass.displayChart
|
||||
|
||||
|
||||
/**
|
||||
* Investigation of gun data for time chain anomaliese
|
||||
*/
|
||||
fun main(args: Array<String>) {
|
||||
|
||||
val context = buildContext("NUMASS", NumassPlugin::class.java) {
|
||||
|
@ -0,0 +1,73 @@
|
||||
package inr.numass.scripts
|
||||
|
||||
import hep.dataforge.buildContext
|
||||
import hep.dataforge.meta.buildMeta
|
||||
import hep.dataforge.nullable
|
||||
import hep.dataforge.plots.PlotGroup
|
||||
import hep.dataforge.plots.data.DataPlot
|
||||
import hep.dataforge.toList
|
||||
import inr.numass.NumassPlugin
|
||||
import inr.numass.data.analyzers.NumassAnalyzer
|
||||
import inr.numass.data.analyzers.SmartAnalyzer
|
||||
import inr.numass.data.analyzers.withBinning
|
||||
import inr.numass.data.api.NumassSet
|
||||
import inr.numass.data.api.SimpleBlock
|
||||
import inr.numass.data.storage.NumassDirectory
|
||||
import inr.numass.displayChart
|
||||
import kotlinx.coroutines.experimental.runBlocking
|
||||
import java.time.Duration
|
||||
|
||||
/**
|
||||
* Investigating slices of single point for differences at the beginning and end
|
||||
*/
|
||||
fun main(args: Array<String>) {
|
||||
val context = buildContext("NUMASS", NumassPlugin::class.java) {
|
||||
rootDir = "D:\\Work\\Numass\\sterile\\2017_11"
|
||||
dataDir = "D:\\Work\\Numass\\data\\2017_11"
|
||||
}
|
||||
//val rootDir = File("D:\\Work\\Numass\\data\\2017_05\\Fill_2")
|
||||
|
||||
val storage = NumassDirectory.read(context, "Fill_3b") ?: error("Storage not found")
|
||||
|
||||
|
||||
val analyzer = SmartAnalyzer()
|
||||
|
||||
val meta = buildMeta {
|
||||
"t0" to 15e3
|
||||
"window.lo" to 400
|
||||
"window.up" to 1600
|
||||
}
|
||||
|
||||
val set = storage.provide("set_17", NumassSet::class.java).nullable ?: error("Set does not exist")
|
||||
|
||||
val frame = displayChart("slices").apply {
|
||||
plots.setType<DataPlot>()
|
||||
plots.configureValue("showLine", true)
|
||||
}
|
||||
|
||||
listOf(0,58,103).forEach { index ->
|
||||
val group = PlotGroup("point_$index")
|
||||
group.setType<DataPlot>()
|
||||
val point = set.find { it.index == index } ?: error("Point not found")
|
||||
|
||||
|
||||
val blockSizes = point.meta.getValue("events").list.map { it.int }
|
||||
val startTimes = point.meta.getValue("start_time").list.map { it.time }
|
||||
|
||||
|
||||
runBlocking {
|
||||
val events = point.events.toList()
|
||||
var startIndex = 0
|
||||
val blocks = blockSizes.zip(startTimes).map { (size, startTime) ->
|
||||
SimpleBlock.produce(startTime, Duration.ofSeconds(5)) {
|
||||
events.subList(startIndex, startIndex + size)
|
||||
}.also { startIndex += size }
|
||||
}
|
||||
|
||||
blocks.forEachIndexed { index, block ->
|
||||
group.add(DataPlot.plot("block_$index", analyzer.getAmplitudeSpectrum(block).withBinning(20), NumassAnalyzer.AMPLITUDE_ADAPTER))
|
||||
}
|
||||
}
|
||||
frame.add(group)
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user