More fliexible datanode api

This commit is contained in:
darksnake 2016-12-07 16:51:47 +03:00
parent b1d57cb94d
commit 296308f8e8
2 changed files with 5 additions and 5 deletions

View File

@ -10,7 +10,7 @@ import hep.dataforge.grind.Grind
import inr.numass.storage.NMPoint import inr.numass.storage.NMPoint
import inr.numass.storage.NumassData import inr.numass.storage.NumassData
import inr.numass.storage.NumassDataLoader import inr.numass.storage.NumassDataLoader
import inr.numass.utils.NMEventGenerator import inr.numass.utils.NMEventGeneratorWithPulser
import inr.numass.utils.PileUpSimulator import inr.numass.utils.PileUpSimulator
import inr.numass.utils.TritiumUtils import inr.numass.utils.TritiumUtils
import org.apache.commons.math3.random.JDKRandomGenerator import org.apache.commons.math3.random.JDKRandomGenerator
@ -18,7 +18,8 @@ import org.apache.commons.math3.random.JDKRandomGenerator
rnd = new JDKRandomGenerator(); rnd = new JDKRandomGenerator();
//Loading data //Loading data
File dataDir = new File("D:\\Work\\Numass\\data\\2016_10\\Fill_1\\set_24") //File dataDir = new File("D:\\Work\\Numass\\data\\2016_10\\Fill_1\\set_28")
File dataDir = new File("D:\\Work\\Numass\\data\\2016_10\\Fill_2_wide\\set_7")
if (!dataDir.exists()) { if (!dataDir.exists()) {
println "dataDir directory does not exist" println "dataDir directory does not exist"
} }
@ -40,8 +41,7 @@ PileUpSimulator buildSimulator(NMPoint point, double cr, NMPoint reference = nul
def cfg = Grind.buildMeta(cr: cr) { def cfg = Grind.buildMeta(cr: cr) {
pulser(mean: 3450, sigma: 86.45, freq: 66.43) pulser(mean: 3450, sigma: 86.45, freq: 66.43)
} }
// NMEventGenerator generator = new NMEventGeneratorWithPulser(rnd, cfg) NMEventGeneratorWithPulser generator = new NMEventGeneratorWithPulser(rnd, cfg)
NMEventGenerator generator = new NMEventGenerator(rnd, cfg)
generator.loadSpectrum(point, reference, lowerChannel, upperChannel); generator.loadSpectrum(point, reference, lowerChannel, upperChannel);
return new PileUpSimulator(point.length * scale, rnd, generator).withUset(point.uset).generate(); return new PileUpSimulator(point.length * scale, rnd, generator).withUset(point.uset).generate();
} }

View File

@ -35,7 +35,7 @@ public class NumassFitScanSummaryTask extends AbstractTask<Table> {
DataSet.Builder<Table> builder = DataSet.builder(Table.class); DataSet.Builder<Table> builder = DataSet.builder(Table.class);
Action<FitState, Table> action = new FitSummaryAction().withContext(model.getWorkspace().getContext()); Action<FitState, Table> action = new FitSummaryAction().withContext(model.getWorkspace().getContext());
DataNode<FitState> input = data.getCheckedNode("fitscan", FitState.class); DataNode<FitState> input = data.getCheckedNode("fitscan", FitState.class);
input.nodeStream(false).forEach(node -> input.nodeStream().filter(it -> it.dataSize(false) > 0).forEach(node ->
builder.putData(node.getName(), action.run(node, model.meta()).getData())); builder.putData(node.getName(), action.run(node, model.meta()).getData()));
return builder.build(); return builder.build();
} }