A lot of minor fixes in numass
This commit is contained in:
parent
12114ffab3
commit
b25c1dd0eb
@ -35,11 +35,11 @@ class NumassDataFactory : DataFactory<NumassSet>(NumassSet::class.java) {
|
|||||||
|
|
||||||
override fun fill(builder: DataNodeEditor<NumassSet>, context: Context, meta: Meta) {
|
override fun fill(builder: DataNodeEditor<NumassSet>, context: Context, meta: Meta) {
|
||||||
runBlocking {
|
runBlocking {
|
||||||
val storage = NumassDirectory.read(context,meta.getString("path")) as Storage
|
val storage = NumassDirectory.read(context, meta.getString("path")) as Storage
|
||||||
storage.sequence().forEach { pair ->
|
storage.sequence().forEach { pair ->
|
||||||
val value = pair.second
|
val value = pair.second
|
||||||
if (value is NumassSet) {
|
if (value is NumassSet) {
|
||||||
builder.putStatic(pair.first.unescaped, value)
|
builder.putStatic(pair.first.unescaped, value, value.meta)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -45,12 +45,11 @@ object MergeDataAction : ManyToOneAction<Table, Table>("numass.merge", Table::cl
|
|||||||
|
|
||||||
override fun buildGroups(context: Context, input: DataNode<Table>, actionMeta: Meta): List<DataNode<Table>> {
|
override fun buildGroups(context: Context, input: DataNode<Table>, actionMeta: Meta): List<DataNode<Table>> {
|
||||||
val meta = inputMeta(context, input.meta, actionMeta)
|
val meta = inputMeta(context, input.meta, actionMeta)
|
||||||
val groups: List<DataNode<Table>> = if (meta.hasValue("grouping.byValue")) {
|
return if (meta.hasValue("grouping.byValue")) {
|
||||||
super.buildGroups(context, input, actionMeta)
|
super.buildGroups(context, input, actionMeta)
|
||||||
} else {
|
} else {
|
||||||
GroupBuilder.byValue(MERGE_NAME, meta.getString(MERGE_NAME, input.name)).group(input)
|
GroupBuilder.byValue(MERGE_NAME, meta.getString(MERGE_NAME, input.name)).group(input)
|
||||||
}
|
}
|
||||||
return groups
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun execute(context: Context, nodeName: String, data: Map<String, Table>, meta: Laminate): Table {
|
override fun execute(context: Context, nodeName: String, data: Map<String, Table>, meta: Laminate): Table {
|
||||||
|
@ -23,7 +23,7 @@ fun main(args: Array<String>) {
|
|||||||
}
|
}
|
||||||
//val rootDir = File("D:\\Work\\Numass\\data\\2017_05\\Fill_2")
|
//val rootDir = File("D:\\Work\\Numass\\data\\2017_05\\Fill_2")
|
||||||
|
|
||||||
val storage = NumassDirectory.read(context, "Fill_3_events") ?: error("Storage not found")
|
val storage = NumassDirectory.read(context, "Fill_3") ?: error("Storage not found")
|
||||||
|
|
||||||
|
|
||||||
val analyzer = SmartAnalyzer()
|
val analyzer = SmartAnalyzer()
|
||||||
@ -34,7 +34,7 @@ fun main(args: Array<String>) {
|
|||||||
// "window.up" to 1600
|
// "window.up" to 1600
|
||||||
}
|
}
|
||||||
|
|
||||||
val set = storage.provide("set_58", NumassSet::class.java).nullable ?: error("Set does not exist")
|
val set = storage.provide("set_4", NumassSet::class.java).nullable ?: error("Set does not exist")
|
||||||
|
|
||||||
val frame = displayChart("slices").apply {
|
val frame = displayChart("slices").apply {
|
||||||
plots.setType<DataPlot>()
|
plots.setType<DataPlot>()
|
||||||
|
@ -36,7 +36,7 @@ import inr.numass.data.storage.NumassDirectory
|
|||||||
import inr.numass.displayChart
|
import inr.numass.displayChart
|
||||||
import inr.numass.subthreshold.Threshold
|
import inr.numass.subthreshold.Threshold
|
||||||
|
|
||||||
fun main(args: Array<String>) {
|
fun main() {
|
||||||
val context = buildContext("NUMASS", NumassPlugin::class.java, JFreeChartPlugin::class.java) {
|
val context = buildContext("NUMASS", NumassPlugin::class.java, JFreeChartPlugin::class.java) {
|
||||||
rootDir = "D:\\Work\\Numass\\sterile\\2017_05_frames"
|
rootDir = "D:\\Work\\Numass\\sterile\\2017_05_frames"
|
||||||
dataDir = "D:\\Work\\Numass\\data\\2017_05_frames"
|
dataDir = "D:\\Work\\Numass\\data\\2017_05_frames"
|
||||||
@ -54,7 +54,7 @@ fun main(args: Array<String>) {
|
|||||||
"xLow" to 1000
|
"xLow" to 1000
|
||||||
"xHigh" to 1300
|
"xHigh" to 1300
|
||||||
"upper" to 6000
|
"upper" to 6000
|
||||||
"binning" to 20
|
"binning" to 32
|
||||||
//"reference" to 18600
|
//"reference" to 18600
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,19 +35,24 @@ import inr.numass.subthreshold.Threshold
|
|||||||
|
|
||||||
fun main(args: Array<String>) {
|
fun main(args: Array<String>) {
|
||||||
val context = buildContext("NUMASS", NumassPlugin::class.java, JFreeChartPlugin::class.java) {
|
val context = buildContext("NUMASS", NumassPlugin::class.java, JFreeChartPlugin::class.java) {
|
||||||
rootDir = "D:\\Work\\Numass\\sterile\\2017_05"
|
rootDir = "D:\\Work\\Numass\\sterile\\2017_05_frames"
|
||||||
dataDir = "D:\\Work\\Numass\\data\\2017_05"
|
dataDir = "D:\\Work\\Numass\\data\\2017_05_frames"
|
||||||
output = FXOutputManager() + DirectoryOutput()
|
output = FXOutputManager() + DirectoryOutput()
|
||||||
}
|
}
|
||||||
|
|
||||||
val storage = NumassDirectory.read(context, "Fill_2") as? FileStorage ?: error("Storage not found")
|
val storage = NumassDirectory.read(context, "Fill_3") as? FileStorage ?: error("Storage not found")
|
||||||
|
|
||||||
val meta = buildMeta {
|
val meta = buildMeta {
|
||||||
"delta" to -200
|
"delta" to -300
|
||||||
"method" to "pow"
|
"method" to "pow"
|
||||||
"t0" to 15e3
|
"t0" to 15e3
|
||||||
"window.lo" to 400
|
// "window.lo" to 400
|
||||||
"window.up" to 1600
|
// "window.up" to 1600
|
||||||
|
"xLow" to 1000
|
||||||
|
"xHigh" to 1300
|
||||||
|
"upper" to 6000
|
||||||
|
"binning" to 32
|
||||||
|
//"reference" to 18600
|
||||||
}
|
}
|
||||||
|
|
||||||
val frame = displayChart("correction").apply {
|
val frame = displayChart("correction").apply {
|
||||||
|
@ -1,10 +1,7 @@
|
|||||||
package inr.numass.tasks
|
package inr.numass.tasks
|
||||||
|
|
||||||
import hep.dataforge.configure
|
import hep.dataforge.configure
|
||||||
import hep.dataforge.data.CustomDataFilter
|
import hep.dataforge.data.*
|
||||||
import hep.dataforge.data.DataSet
|
|
||||||
import hep.dataforge.data.DataTree
|
|
||||||
import hep.dataforge.data.DataUtils
|
|
||||||
import hep.dataforge.io.output.stream
|
import hep.dataforge.io.output.stream
|
||||||
import hep.dataforge.io.render
|
import hep.dataforge.io.render
|
||||||
import hep.dataforge.meta.Meta
|
import hep.dataforge.meta.Meta
|
||||||
@ -22,6 +19,7 @@ import hep.dataforge.stat.fit.FitResult
|
|||||||
import hep.dataforge.stat.models.XYModel
|
import hep.dataforge.stat.models.XYModel
|
||||||
import hep.dataforge.tables.*
|
import hep.dataforge.tables.*
|
||||||
import hep.dataforge.useMeta
|
import hep.dataforge.useMeta
|
||||||
|
import hep.dataforge.useValue
|
||||||
import hep.dataforge.values.ValueType
|
import hep.dataforge.values.ValueType
|
||||||
import hep.dataforge.values.Values
|
import hep.dataforge.values.Values
|
||||||
import hep.dataforge.values.asValue
|
import hep.dataforge.values.asValue
|
||||||
@ -50,10 +48,17 @@ import java.util.stream.StreamSupport
|
|||||||
import kotlin.collections.HashMap
|
import kotlin.collections.HashMap
|
||||||
import kotlin.collections.set
|
import kotlin.collections.set
|
||||||
|
|
||||||
|
private val filterForward = DataFilter.byMetaValue("iteration_info.reverse") {
|
||||||
|
!(it?.boolean ?: false)
|
||||||
|
}
|
||||||
|
private val filterReverse = DataFilter.byMetaValue("iteration_info.reverse") {
|
||||||
|
it?.boolean ?: false
|
||||||
|
}
|
||||||
|
|
||||||
val selectTask = task("select") {
|
val selectTask = task("select") {
|
||||||
descriptor {
|
descriptor {
|
||||||
info = "Select data from initial data pool"
|
info = "Select data from initial data pool"
|
||||||
|
value("forward", types = listOf(ValueType.BOOLEAN), info = "Select only forward or only backward sets")
|
||||||
}
|
}
|
||||||
model { meta ->
|
model { meta ->
|
||||||
data("*")
|
data("*")
|
||||||
@ -61,9 +66,18 @@ val selectTask = task("select") {
|
|||||||
}
|
}
|
||||||
transform<NumassSet> { data ->
|
transform<NumassSet> { data ->
|
||||||
logger.info("Starting selection from data node with size ${data.size}")
|
logger.info("Starting selection from data node with size ${data.size}")
|
||||||
CustomDataFilter(meta).filter(data.checked(NumassSet::class.java)).also {
|
var res = data.checked(NumassSet::class.java).filter(CustomDataFilter(meta))
|
||||||
logger.info("Selected ${it.size} elements")
|
|
||||||
|
meta.useValue("forward") {
|
||||||
|
res = if (it.boolean) {
|
||||||
|
res.filter(filterForward)
|
||||||
|
} else {
|
||||||
|
res.filter(filterReverse)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logger.info("Selected ${res.size} elements")
|
||||||
|
res
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -362,7 +376,15 @@ val histogramTask = task("histogram") {
|
|||||||
}.sumByStep(NumassAnalyzer.CHANNEL_KEY, meta.getDouble("binning", 16.0)) //apply binning
|
}.sumByStep(NumassAnalyzer.CHANNEL_KEY, meta.getDouble("binning", 16.0)) //apply binning
|
||||||
|
|
||||||
// send raw table to the output
|
// send raw table to the output
|
||||||
context.output.render(table, stage = "numass.histogram", name = name, meta = meta)
|
context.output.render(table, stage = "numass.histogram", name = name) {
|
||||||
|
update(meta)
|
||||||
|
data.toSortedMap().forEach { name, set ->
|
||||||
|
putNode("data", buildMeta {
|
||||||
|
"name" to name
|
||||||
|
set.meta.useMeta("iteration_info"){"iteration" to it}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (meta.getBoolean("plot", false)) {
|
if (meta.getBoolean("plot", false)) {
|
||||||
context.plotFrame("$name.plot", stage = "numass.histogram") {
|
context.plotFrame("$name.plot", stage = "numass.histogram") {
|
||||||
@ -379,7 +401,6 @@ val histogramTask = task("histogram") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return@join table
|
return@join table
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -397,8 +418,8 @@ val sliceTask = task("slice") {
|
|||||||
val analyzer = SmartAnalyzer()
|
val analyzer = SmartAnalyzer()
|
||||||
val slices = HashMap<String, IntRange>()
|
val slices = HashMap<String, IntRange>()
|
||||||
val formatBuilder = TableFormatBuilder()
|
val formatBuilder = TableFormatBuilder()
|
||||||
formatBuilder.addColumn("set",ValueType.STRING)
|
formatBuilder.addColumn("set", ValueType.STRING)
|
||||||
formatBuilder.addColumn("time",ValueType.TIME)
|
formatBuilder.addColumn("time", ValueType.TIME)
|
||||||
meta.getMetaList("range").forEach {
|
meta.getMetaList("range").forEach {
|
||||||
val range = IntRange(it.getInt("from"), it.getInt("to"))
|
val range = IntRange(it.getInt("from"), it.getInt("to"))
|
||||||
val name = it.getString("name", range.toString())
|
val name = it.getString("name", range.toString())
|
||||||
|
Loading…
Reference in New Issue
Block a user