From b50953b11977472dcc182a44fe015cfe6b67b00b Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Sat, 28 May 2016 21:09:56 +0300 Subject: [PATCH] [no commit message] --- numass-control/msp/build.gradle | 1 + numass-control/vac/build.gradle | 1 + .../main/groovy/inr/numass/scripts/FindBorder.groovy | 6 +++--- .../java/inr/numass/actions/FindBorderAction.java | 11 ++++++++++- 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/numass-control/msp/build.gradle b/numass-control/msp/build.gradle index 54bee40a..5f1eff99 100644 --- a/numass-control/msp/build.gradle +++ b/numass-control/msp/build.gradle @@ -11,5 +11,6 @@ mainClassName = mainClass dependencies { compile project(':numass-storage:numass-client') compile project(':dataforge-plots') + compile project(':dataforge-fx') compile project(':dataforge-control') } \ No newline at end of file diff --git a/numass-control/vac/build.gradle b/numass-control/vac/build.gradle index c84b09c3..5f64fbcb 100644 --- a/numass-control/vac/build.gradle +++ b/numass-control/vac/build.gradle @@ -12,4 +12,5 @@ dependencies { compile project(':numass-storage:numass-client') compile project(':dataforge-plots') compile project(':dataforge-control') + compile project(':dataforge-fx') } \ No newline at end of file diff --git a/numass-main/src/main/groovy/inr/numass/scripts/FindBorder.groovy b/numass-main/src/main/groovy/inr/numass/scripts/FindBorder.groovy index 6b85e6c8..e4d3859f 100644 --- a/numass-main/src/main/groovy/inr/numass/scripts/FindBorder.groovy +++ b/numass-main/src/main/groovy/inr/numass/scripts/FindBorder.groovy @@ -13,11 +13,11 @@ import hep.dataforge.meta.Meta import inr.numass.actions.FindBorderAction import hep.dataforge.grind.GrindMetaBuilder -File dataDir = new File("D:\\Work\\Numass\\data\\2016_04\\T2_data\\Fill_1_7\\set_2_3b127e3254010000") +File dataDir = new File("D:\\Work\\Numass\\data\\2016_04\\T2_data\\Fill_2_2\\set_6_e26d123e54010000") if(!dataDir.exists()){ println "dataDir directory does not exist" } -Meta config = new GrindMetaBuilder().config(lower: 500, upper: 1800) +Meta config = new GrindMetaBuilder().config(lower: 400, upper: 1800, reference: 18500) println config NumassData data = NumassDataLoader.fromLocalDir(null, dataDir) -new FindBorderAction().eval(data, config) +new FindBorderAction().simpleRun(data, config) diff --git a/numass-main/src/main/java/inr/numass/actions/FindBorderAction.java b/numass-main/src/main/java/inr/numass/actions/FindBorderAction.java index b057bb28..dcbc96e0 100644 --- a/numass-main/src/main/java/inr/numass/actions/FindBorderAction.java +++ b/numass-main/src/main/java/inr/numass/actions/FindBorderAction.java @@ -32,6 +32,7 @@ import inr.numass.storage.NumassData; import java.io.OutputStream; import java.util.HashMap; import java.util.Map; +import org.apache.commons.math3.analysis.UnivariateFunction; /** * @@ -43,6 +44,8 @@ public class FindBorderAction extends OneToOneAction { private final static String[] names = {"U", "80%", "90%", "95%", "99%"}; private final static double[] percents = {0.8, 0.9, 0.95, 0.99}; + private UnivariateFunction normCorrection = e -> 1 + 13.265 * Math.exp(-e / 2343.4); + @Override protected Table execute(Context context, Reportable log, String name, Laminate meta, NumassData source) throws ContentException { log.report("File {} started", source.getName()); @@ -97,7 +100,7 @@ public class FindBorderAction extends OneToOneAction { } else { spectrum = point.getMapWithBinning(0, true); } - double norm = getNorm(spectrum, lower, upper); + double norm = getNorm(spectrum, lower, upper) * normCorrection.value(point.getUset()); double counter = 0; int chanel = upper; while (chanel > lower) { @@ -111,6 +114,12 @@ public class FindBorderAction extends OneToOneAction { } } } + for (String n : names) { + if (!map.containsKey(n)) { + map.put(n, Value.of(lower)); + } + } + dataBuilder.addRow(new MapPoint(map)); } }