multiple numass fixes

This commit is contained in:
darksnake 2016-11-30 16:04:43 +03:00
parent 6d6d0a72ee
commit 2f30be2e6b
4 changed files with 8 additions and 19 deletions

View File

@ -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"

View File

@ -32,7 +32,6 @@ public class JoinNumassDataAction extends ManyToOneAction<NumassData, NumassData
(p1.getUread() + p2.getUset()) / 2,
p1.getStartTime(),
p1.getLength() + p2.getLength(),
p1.getOverflow() + p2.getOverflow(),
IntStream.range(0, p1.getSpectrum().length).map(i -> p1.getSpectrum()[i] * p2.getSpectrum()[i]).toArray()
);
}).get();

View File

@ -35,7 +35,7 @@ public class NumassFitScanSummaryTask extends AbstractTask<Table> {
DataSet.Builder<Table> builder = DataSet.builder(Table.class);
Action<FitState, Table> action = new FitSummaryAction().withContext(model.getWorkspace().getContext());
DataNode<FitState> 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();
}

View File

@ -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<DataPoint> 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];
}
/**