diff --git a/numass-main/src/main/java/inr/numass/actions/MonitorCorrectAction.java b/numass-main/src/main/java/inr/numass/actions/MonitorCorrectAction.java index 7f5a6b75..c58e64d7 100644 --- a/numass-main/src/main/java/inr/numass/actions/MonitorCorrectAction.java +++ b/numass-main/src/main/java/inr/numass/actions/MonitorCorrectAction.java @@ -23,6 +23,7 @@ import hep.dataforge.meta.Laminate; import hep.dataforge.meta.Meta; import hep.dataforge.tables.ListTable; import hep.dataforge.tables.Table; +import hep.dataforge.tables.Tables; import hep.dataforge.values.ValueFactory; import hep.dataforge.values.ValueMap; import hep.dataforge.values.Values; @@ -129,7 +130,7 @@ public class MonitorCorrectAction extends OneToOneAction { // } else { // format = DataFormat.of(parnames); // } - Table res = ListTable.infer(dataList); + Table res = Tables.infer(dataList); context.getOutput().get(getName(), name, TEXT_TYPE).render(NumassUtils.INSTANCE.wrap(res, meta), Meta.empty()); @@ -194,7 +195,7 @@ public class MonitorCorrectAction extends OneToOneAction { private void printMonitorData(Context context, Meta meta) { if (!monitorPoints.isEmpty()) { String monitorFileName = meta.getString("monitorFile", "monitor"); - ListTable data = ListTable.infer(monitorPoints); + ListTable data = Tables.infer(monitorPoints); context.getOutput().get(getName(), monitorFileName, TEXT_TYPE).render(NumassUtils.INSTANCE.wrap(data, meta), Meta.empty()); // ColumnedDataWriter.writeTable(stream, TableTransform.sort(data, "Timestamp", true), "Monitor points", monitorNames); diff --git a/numass-main/src/main/kotlin/inr/numass/tasks/NumassTasks.kt b/numass-main/src/main/kotlin/inr/numass/tasks/NumassTasks.kt index a6fb4e32..963f1a44 100644 --- a/numass-main/src/main/kotlin/inr/numass/tasks/NumassTasks.kt +++ b/numass-main/src/main/kotlin/inr/numass/tasks/NumassTasks.kt @@ -210,7 +210,7 @@ val filterTask = task("filter") { this.log.report("Filtering finished") Tables.filter(data, NumassPoint.HV_KEY, uLo, uHi) } else if (meta.hasValue("condition")) { - Tables.filter(data, Predicate{ ExpressionUtils.condition(meta.getString("condition"), it.unbox()) }) + Tables.filter(data, Predicate { ExpressionUtils.condition(meta.getString("condition"), it.unbox()) }) } else { throw RuntimeException("No filtering condition specified") } @@ -285,7 +285,7 @@ val histogramTask = task("histogram") { configure(meta.getMetaOrEmpty("histogram")) configure { meta.useMeta("analyzer") { putNode(it) } - setValue("@target", meta.getString("@target",meta.name)) + setValue("@target", meta.getString("@target", meta.name)) } } join { data -> @@ -328,17 +328,10 @@ val histogramTask = task("histogram") { } row(values) } - } - - //apply binning - val processedTable: Table = if(meta.hasValue("binning")){ - table.sumByStep(NumassAnalyzer.CHANNEL_KEY, meta.getDouble("binning")) - } else{ - table - } + }.sumByStep(NumassAnalyzer.CHANNEL_KEY, meta.getDouble("binning", 20.0)) //apply binning // send raw table to the output - context.output.render(processedTable, stage = "numass.histogram", name = name, meta = meta) + context.output.render(table, stage = "numass.histogram", name = name, meta = meta) if (meta.getBoolean("plot", false)) { context.plot("$name.plot", stage = "numass.histogram") { @@ -349,13 +342,13 @@ val histogramTask = task("histogram") { "showLine" to true "connectionType" to "step" } - processedTable.format.names.filter { it != "channel" }.forEach { - +DataPlot.plot(it, processedTable, adapter = Adapters.buildXYAdapter("channel", it)) + table.format.names.filter { it != "channel" }.forEach { + +DataPlot.plot(it, table, adapter = Adapters.buildXYAdapter("channel", it)) } } } - return@join processedTable + return@join table } }