Fix overflow count

This commit is contained in:
Alexander Nozik 2016-11-30 12:42:44 +03:00
parent a852326e6e
commit 6d6d0a72ee
2 changed files with 16 additions and 12 deletions

View File

@ -19,15 +19,19 @@ println "Loading config file from $cfgPath"
//Global.instance().pluginManager().loadPlugin("inr.numass:numass") //Global.instance().pluginManager().loadPlugin("inr.numass:numass")
println "Starting Grind shell" println "Starting Grind shell"
try { if(cfgPath) {
new GrindShell().launch { try {
GrindWorkspaceBuilder numass = new GrindWorkspaceBuilder() new GrindShell().launch {
.withSpec(NumassWorkspaceSpec) GrindWorkspaceBuilder numass = new GrindWorkspaceBuilder()
.from(new File(cfgPath)) .withSpec(NumassWorkspaceSpec)
bind("numass", numass) .from(new File(cfgPath))
bind("numass", numass)
}
} catch (Exception ex) {
ex.printStackTrace();
} finally {
Global.terminate();
} }
} catch (Exception ex) { } else{
ex.printStackTrace(); println "No configuration path. Provide path via --config option"
} finally {
Global.terminate();
} }

View File

@ -97,11 +97,11 @@ public class PrepareDataAction extends OneToOneAction<NumassData, Table> {
double correctionFactor = corrections.stream() double correctionFactor = corrections.stream()
.mapToDouble(cor -> cor.corr(point)) .mapToDouble(cor -> cor.corr(point))
.reduce((d1, d2) -> d1 * d2).getAsDouble(); .reduce((d1, d2) -> d1 * d2).orElse(1);
double relativeCorrectionError = Math.sqrt( double relativeCorrectionError = Math.sqrt(
corrections.stream() corrections.stream()
.mapToDouble(cor -> cor.relativeErr(point)) .mapToDouble(cor -> cor.relativeErr(point))
.reduce((d1, d2) -> d1 * d1 + d2 * d2).getAsDouble() .reduce((d1, d2) -> d1 * d1 + d2 * d2).orElse(0)
); );
double cr = wind / point.getLength() * correctionFactor; double cr = wind / point.getLength() * correctionFactor;