Minor fixes. Trying to use data factories instead of uri

This commit is contained in:
darksnake 2017-02-02 16:39:30 +03:00
parent f483ea7498
commit 4abcebc5aa
3 changed files with 31 additions and 14 deletions

View File

@ -14,25 +14,41 @@ import inr.numass.storage.NumassDataUtils
import inr.numass.storage.NumassStorage import inr.numass.storage.NumassStorage
import inr.numass.utils.UnderflowCorrection import inr.numass.utils.UnderflowCorrection
//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_31")
File rootDir = new File("D:\\Work\\Numass\\data\\2016_10\\Fill_2_wide") File rootDir = new File("D:\\Work\\Numass\\data\\2016_10\\Fill_1")
NumassStorage storage = NumassStorage.buildLocalNumassRoot(rootDir, true); NumassStorage storage = NumassStorage.buildLocalNumassRoot(rootDir, true);
Collection<NMPoint> data = NumassDataUtils.joinSpectra( Collection<NMPoint> data = NumassDataUtils.joinSpectra(
StorageUtils.loaderStream(storage).map { it.value }.filter { it.name.matches("set_.{2,3}") } StorageUtils.loaderStream(storage).filter { it.key.matches("set_.{2,3}") }.map {
println "loading ${it.key}"
it.value
}
) )
data = NumassDataUtils.substractReferencePoint(data, 18600d); data = NumassDataUtils.substractReferencePoint(data, 18600d);
//if(!dataDir.exists()){ //println "Empty files:"
// println "dataDir directory does not exist" //Collection<NMPoint> emptySpectra = NumassDataUtils.joinSpectra(
//} // StorageUtils.loaderStream(storage).filter{ it.key.matches("Empty.*")}.map {
//NumassData data = NumassDataLoader.fromLocalDir(null, dataDir) // println it.key
////NumassData data = NMFile.readFile(new File("D:\\Work\\Numass\\sterilie2013-2014\\dat\\2013\\SCAN06.DAT" )) // it.value
// }
//)
Table t = new UnderflowCorrection().fitAllPoints(data, 400, 650, 3100, 20); //emptySpectra = NumassDataUtils.substractReferencePoint(emptySpectra,18600);
//
//data = data.collect { point ->
// NMPoint ref = emptySpectra.find { it.uset == point.uset }
// if (ref) {
// println "substracting tritium background for point ${point.uset}"
// NumassDataUtils.substractPoint(point, ref)
// } else {
// println "point ${point.uset} skipped"
// point
// }
//}
Table t = new UnderflowCorrection().fitAllPoints(data, 400, 750, 3100, 20);
ColumnedDataWriter.writeDataSet(System.out, t, "underflow parameters") ColumnedDataWriter.writeDataSet(System.out, t, "underflow parameters")

View File

@ -58,7 +58,7 @@ public class NumassFitScanSummaryTask extends AbstractTask<Table> {
@Override @Override
protected Table execute(Context context, String nodeName, Map<String, FitState> input, Laminate meta) { protected Table execute(Context context, String nodeName, Map<String, FitState> input, Laminate meta) {
ListTable.Builder builder = new ListTable.Builder("msterile2", "U2", "U2err", "U2limit", "E0", "trap"); ListTable.Builder builder = new ListTable.Builder("m", "U2", "U2err", "U2limit", "E0", "trap");
input.forEach((key, fitRes) -> { input.forEach((key, fitRes) -> {
ParamSet pars = fitRes.getParameters(); ParamSet pars = fitRes.getParameters();
@ -71,14 +71,15 @@ public class NumassFitScanSummaryTask extends AbstractTask<Table> {
limit = Double.NaN; limit = Double.NaN;
} }
builder.row(pars.getValue("msterile2"), builder.row(
Math.sqrt(pars.getValue("msterile2").doubleValue()),
pars.getValue("U2"), pars.getValue("U2"),
pars.getError("U2"), pars.getError("U2"),
limit, limit,
pars.getValue("E0"), pars.getValue("E0"),
pars.getValue("trap")); pars.getValue("trap"));
}); });
Table res = TableTransform.sort(builder.build(), "msterile2", true); Table res = TableTransform.sort(builder.build(), "m", true);
try (OutputStream stream = buildActionOutput(context, nodeName)) { try (OutputStream stream = buildActionOutput(context, nodeName)) {

View File

@ -360,7 +360,7 @@ public class NumassWorkbenchController implements Initializable, StagePaneHolder
statusBar.setProgress(-1); statusBar.setProgress(-1);
}); });
DataNode data = new FileDataFactory().build(getContext(), getDataConfiguration()); DataNode data = new FileDataFactory().load(getContext(), getDataConfiguration());
try { try {
ActionUtils.runAction(getContext(), data, getActionConfiguration()).computeAll(); ActionUtils.runAction(getContext(), data, getActionConfiguration()).computeAll();
Platform.runLater(() -> statusBar.setText("Execution complete")); Platform.runLater(() -> statusBar.setText("Execution complete"));