add count rate to tritium utils expression
This commit is contained in:
parent
5f8d4031d1
commit
4b22e22a28
@ -45,7 +45,7 @@ import static inr.numass.utils.TritiumUtils.evaluateExpression;
|
|||||||
@ValueDef(name = "lowerWindow", type = "NUMBER", def = "0", info = "Base for the window lowerWindow bound")
|
@ValueDef(name = "lowerWindow", type = "NUMBER", def = "0", info = "Base for the window lowerWindow bound")
|
||||||
@ValueDef(name = "lowerWindowSlope", type = "NUMBER", def = "0", info = "Slope for the window lowerWindow bound")
|
@ValueDef(name = "lowerWindowSlope", type = "NUMBER", def = "0", info = "Slope for the window lowerWindow bound")
|
||||||
@ValueDef(name = "upperWindow", type = "NUMBER", info = "Upper bound for window")
|
@ValueDef(name = "upperWindow", type = "NUMBER", info = "Upper bound for window")
|
||||||
@ValueDef(name = "deadTime", type = "[NUMBER, STRING]", def = "0", info = "Dead time in s. Could be an expression.")
|
@ValueDef(name = "deadTime", type = "[NUMBER, STRING]", info = "Dead time in s. Could be an expression.")
|
||||||
@ValueDef(name = "correction",
|
@ValueDef(name = "correction",
|
||||||
info = "An expression to correct count number depending on potential `U`, point length `T` and point itself as `point`")
|
info = "An expression to correct count number depending on potential `U`, point length `T` and point itself as `point`")
|
||||||
@NodeDef(name = "correction", multiple = true, target = "method::inr.numass.actions.PrepareDataAction.makeCorrection")
|
@NodeDef(name = "correction", multiple = true, target = "method::inr.numass.actions.PrepareDataAction.makeCorrection")
|
||||||
@ -207,12 +207,16 @@ public class PrepareDataAction extends OneToOneAction<NumassData, Table> {
|
|||||||
@Override
|
@Override
|
||||||
public double corr(NMPoint point) {
|
public double corr(NMPoint point) {
|
||||||
double deadTime = deadTimeFunction.apply(point);
|
double deadTime = deadTimeFunction.apply(point);
|
||||||
double factor = deadTime / point.getLength() * point.getEventsCount();
|
if (deadTime > 0) {
|
||||||
|
double factor = deadTime / point.getLength() * point.getEventsCount();
|
||||||
// double total = point.getEventsCount();
|
// double total = point.getEventsCount();
|
||||||
// double time = point.getLength();
|
// double time = point.getLength();
|
||||||
// return 1d/(1d - factor);
|
// return 1d/(1d - factor);
|
||||||
|
|
||||||
return (1d - Math.sqrt(1d - 4d * factor)) / 2d / factor;
|
return (1d - Math.sqrt(1d - 4d * factor)) / 2d / factor;
|
||||||
|
} else {
|
||||||
|
return 1d;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ public class ExpressionUtils {
|
|||||||
ImportCustomizer importCustomizer = new ImportCustomizer();
|
ImportCustomizer importCustomizer = new ImportCustomizer();
|
||||||
// import static com.mrhaki.blog.Type.*
|
// import static com.mrhaki.blog.Type.*
|
||||||
importCustomizer.addStaticStars("java.lang.Math");
|
importCustomizer.addStaticStars("java.lang.Math");
|
||||||
importCustomizer.addStaticStars("org.apache.commons.math3.util.FastMath");
|
//importCustomizer.addStaticStars("org.apache.commons.math3.util.FastMath");
|
||||||
|
|
||||||
CompilerConfiguration configuration = new CompilerConfiguration();
|
CompilerConfiguration configuration = new CompilerConfiguration();
|
||||||
configuration.addCompilationCustomizers(importCustomizer); // Create shell and execute script.
|
configuration.addCompilationCustomizers(importCustomizer); // Create shell and execute script.
|
||||||
|
@ -137,6 +137,7 @@ public class TritiumUtils {
|
|||||||
Map<String, Object> exprParams = new HashMap<>();
|
Map<String, Object> exprParams = new HashMap<>();
|
||||||
exprParams.put("T", point.getLength());
|
exprParams.put("T", point.getLength());
|
||||||
exprParams.put("U", point.getUread());
|
exprParams.put("U", point.getUread());
|
||||||
|
exprParams.put("cr", ((double) point.getEventsCount()) / point.getLength());
|
||||||
exprParams.put("point", point);
|
exprParams.put("point", point);
|
||||||
return ExpressionUtils.evaluate(expression, exprParams);
|
return ExpressionUtils.evaluate(expression, exprParams);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user