Table reducer test
This commit is contained in:
parent
b90050cf20
commit
6c5dc8fbb5
@ -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<Table, Table> {
|
||||
// } 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<Table, Table> {
|
||||
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);
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user