multiple numass fixes
This commit is contained in:
parent
6d6d0a72ee
commit
2f30be2e6b
@ -17,14 +17,6 @@ dependencies {
|
|||||||
compile project(':dataforge-grind')
|
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) {
|
task listActions(dependsOn: classes, type: JavaExec) {
|
||||||
main mainClass
|
main mainClass
|
||||||
args "-lc"
|
args "-lc"
|
||||||
|
@ -32,7 +32,6 @@ public class JoinNumassDataAction extends ManyToOneAction<NumassData, NumassData
|
|||||||
(p1.getUread() + p2.getUset()) / 2,
|
(p1.getUread() + p2.getUset()) / 2,
|
||||||
p1.getStartTime(),
|
p1.getStartTime(),
|
||||||
p1.getLength() + p2.getLength(),
|
p1.getLength() + p2.getLength(),
|
||||||
p1.getOverflow() + p2.getOverflow(),
|
|
||||||
IntStream.range(0, p1.getSpectrum().length).map(i -> p1.getSpectrum()[i] * p2.getSpectrum()[i]).toArray()
|
IntStream.range(0, p1.getSpectrum().length).map(i -> p1.getSpectrum()[i] * p2.getSpectrum()[i]).toArray()
|
||||||
);
|
);
|
||||||
}).get();
|
}).get();
|
||||||
|
@ -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().forEach(node ->
|
input.nodeStream(false).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();
|
||||||
}
|
}
|
||||||
|
@ -33,19 +33,17 @@ public class NMPoint {
|
|||||||
private final int[] spectrum;
|
private final int[] spectrum;
|
||||||
private Instant startTime;
|
private Instant startTime;
|
||||||
private long eventsCount;
|
private long eventsCount;
|
||||||
private int overflow;
|
|
||||||
private double pointLength;
|
private double pointLength;
|
||||||
private double uread;
|
private double uread;
|
||||||
private double uset;
|
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.startTime = startTime;
|
||||||
this.overflow = overflow;
|
|
||||||
this.pointLength = pointLength;
|
this.pointLength = pointLength;
|
||||||
this.spectrum = spectrum;
|
this.spectrum = spectrum;
|
||||||
this.uread = uread;
|
this.uread = uread;
|
||||||
this.uset = uset;
|
this.uset = uset;
|
||||||
this.eventsCount = IntStream.of(spectrum).sum() + overflow;
|
this.eventsCount = IntStream.of(spectrum).sum();
|
||||||
}
|
}
|
||||||
|
|
||||||
public NMPoint(RawNMPoint point) {
|
public NMPoint(RawNMPoint point) {
|
||||||
@ -64,11 +62,11 @@ public class NMPoint {
|
|||||||
private int[] calculateSpectrum(RawNMPoint point) {
|
private int[] calculateSpectrum(RawNMPoint point) {
|
||||||
assert point.getEventsCount() > 0;
|
assert point.getEventsCount() > 0;
|
||||||
|
|
||||||
int[] result = new int[RawNMPoint.MAX_CHANEL];
|
int[] result = new int[RawNMPoint.MAX_CHANEL + 1];
|
||||||
Arrays.fill(result, 0);
|
Arrays.fill(result, 0);
|
||||||
point.getEvents().stream().forEach((event) -> {
|
point.getEvents().stream().forEach((event) -> {
|
||||||
if (event.getChanel() >= RawNMPoint.MAX_CHANEL) {
|
if (event.getChanel() >= RawNMPoint.MAX_CHANEL) {
|
||||||
overflow++;
|
result[RawNMPoint.MAX_CHANEL]++;
|
||||||
} else {
|
} else {
|
||||||
result[event.getChanel()]++;
|
result[event.getChanel()]++;
|
||||||
}
|
}
|
||||||
@ -136,12 +134,12 @@ public class NMPoint {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Events count + overflow
|
* Events count including overflow
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public long getEventsCount() {
|
public long getEventsCount() {
|
||||||
return eventsCount + getOverflow();
|
return eventsCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<DataPoint> getData(int binning, boolean normalize) {
|
public List<DataPoint> getData(int binning, boolean normalize) {
|
||||||
@ -211,7 +209,7 @@ public class NMPoint {
|
|||||||
* @return the overflow
|
* @return the overflow
|
||||||
*/
|
*/
|
||||||
public int getOverflow() {
|
public int getOverflow() {
|
||||||
return overflow;
|
return spectrum[RawNMPoint.MAX_CHANEL];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user