From 2f30be2e6bfce097384be484f57a1b85561ae370 Mon Sep 17 00:00:00 2001 From: darksnake Date: Wed, 30 Nov 2016 16:04:43 +0300 Subject: [PATCH] multiple numass fixes --- numass-main/build.gradle | 8 -------- .../inr/numass/actions/JoinNumassDataAction.java | 1 - .../workspace/NumassFitScanSummaryTask.java | 2 +- .../main/java/inr/numass/storage/NMPoint.java | 16 +++++++--------- 4 files changed, 8 insertions(+), 19 deletions(-) diff --git a/numass-main/build.gradle b/numass-main/build.gradle index bf6ff902..ce3660b2 100644 --- a/numass-main/build.gradle +++ b/numass-main/build.gradle @@ -17,14 +17,6 @@ dependencies { compile project(':dataforge-grind') } -task workbench(dependsOn: classes, type: JavaExec) { - main 'inr.numass.workbench.Workbench' - classpath = sourceSets.main.runtimeClasspath - description "start visual numass workbench" - group "numass" - -} - task listActions(dependsOn: classes, type: JavaExec) { main mainClass args "-lc" diff --git a/numass-main/src/main/java/inr/numass/actions/JoinNumassDataAction.java b/numass-main/src/main/java/inr/numass/actions/JoinNumassDataAction.java index 8ebc5c53..c4485f32 100644 --- a/numass-main/src/main/java/inr/numass/actions/JoinNumassDataAction.java +++ b/numass-main/src/main/java/inr/numass/actions/JoinNumassDataAction.java @@ -32,7 +32,6 @@ public class JoinNumassDataAction extends ManyToOneAction p1.getSpectrum()[i] * p2.getSpectrum()[i]).toArray() ); }).get(); diff --git a/numass-main/src/main/java/inr/numass/workspace/NumassFitScanSummaryTask.java b/numass-main/src/main/java/inr/numass/workspace/NumassFitScanSummaryTask.java index 5ba428dd..4b4c6308 100644 --- a/numass-main/src/main/java/inr/numass/workspace/NumassFitScanSummaryTask.java +++ b/numass-main/src/main/java/inr/numass/workspace/NumassFitScanSummaryTask.java @@ -35,7 +35,7 @@ public class NumassFitScanSummaryTask extends AbstractTask { DataSet.Builder
builder = DataSet.builder(Table.class); Action action = new FitSummaryAction().withContext(model.getWorkspace().getContext()); DataNode input = data.getCheckedNode("fitscan", FitState.class); - input.nodeStream().forEach(node -> + input.nodeStream(false).forEach(node -> builder.putData(node.getName(), action.run(node, model.meta()).getData())); return builder.build(); } diff --git a/numass-storage/src/main/java/inr/numass/storage/NMPoint.java b/numass-storage/src/main/java/inr/numass/storage/NMPoint.java index 652071cb..0d01e4ad 100644 --- a/numass-storage/src/main/java/inr/numass/storage/NMPoint.java +++ b/numass-storage/src/main/java/inr/numass/storage/NMPoint.java @@ -33,19 +33,17 @@ public class NMPoint { private final int[] spectrum; private Instant startTime; private long eventsCount; - private int overflow; private double pointLength; private double uread; private double uset; - public NMPoint(double uset, double uread, Instant startTime, double pointLength, int overflow, int[] spectrum) { + public NMPoint(double uset, double uread, Instant startTime, double pointLength, int[] spectrum) { this.startTime = startTime; - this.overflow = overflow; this.pointLength = pointLength; this.spectrum = spectrum; this.uread = uread; this.uset = uset; - this.eventsCount = IntStream.of(spectrum).sum() + overflow; + this.eventsCount = IntStream.of(spectrum).sum(); } public NMPoint(RawNMPoint point) { @@ -64,11 +62,11 @@ public class NMPoint { private int[] calculateSpectrum(RawNMPoint point) { assert point.getEventsCount() > 0; - int[] result = new int[RawNMPoint.MAX_CHANEL]; + int[] result = new int[RawNMPoint.MAX_CHANEL + 1]; Arrays.fill(result, 0); point.getEvents().stream().forEach((event) -> { if (event.getChanel() >= RawNMPoint.MAX_CHANEL) { - overflow++; + result[RawNMPoint.MAX_CHANEL]++; } else { result[event.getChanel()]++; } @@ -136,12 +134,12 @@ public class NMPoint { } /** - * Events count + overflow + * Events count including overflow * * @return */ public long getEventsCount() { - return eventsCount + getOverflow(); + return eventsCount; } public List getData(int binning, boolean normalize) { @@ -211,7 +209,7 @@ public class NMPoint { * @return the overflow */ public int getOverflow() { - return overflow; + return spectrum[RawNMPoint.MAX_CHANEL]; } /**