Trying to implement caching

This commit is contained in:
Alexander Nozik 2016-07-19 18:24:34 +03:00
parent 977331e8f8
commit c923d3cb92
2 changed files with 10 additions and 10 deletions

View File

@ -203,26 +203,26 @@ public class NumassPlugin extends BasicPlugin {
return res;
});
manager.addModel("sterile", (context, an) -> {
double A = an.getDouble("resolution", an.getDouble("resolution.width", 8.3e-5));//8.3e-5
double from = an.getDouble("from", 13900d);
double to = an.getDouble("to", 18700d);
manager.addModel("sterile", (context, meta) -> {
double A = meta.getDouble("resolution", meta.getDouble("resolution.width", 8.3e-5));//8.3e-5
double from = meta.getDouble("from", 13900d);
double to = meta.getDouble("to", 18700d);
context.getReport().report("Setting up tritium model with real transmission function");
BivariateFunction resolutionTail;
if (an.hasValue("resolution.tailAlpha")) {
resolutionTail = ResolutionFunction.getAngledTail(an.getDouble("resolution.tailAlpha"), an.getDouble("resolution.tailBeta", 0));
if (meta.hasValue("resolution.tailAlpha")) {
resolutionTail = ResolutionFunction.getAngledTail(meta.getDouble("resolution.tailAlpha"), meta.getDouble("resolution.tailBeta", 0));
} else {
resolutionTail = ResolutionFunction.getRealTail();
}
RangedNamedSetSpectrum beta = new BetaSpectrum(context.io().getFile("FS.txt"));
ModularSpectrum sp = new ModularSpectrum(beta, new ResolutionFunction(A, resolutionTail), from, to);
if (an.getBoolean("caching", false)) {
if (meta.getBoolean("caching", false)) {
context.getReport().report("Caching turned on");
sp.setCaching(true);
}
//Adding trapping energy dependence
switch (an.getString("trappingFunction", "default")) {
switch (meta.getString("trappingFunction", "default")) {
case "run2016":
sp.setTrappingFunction((Ei, Ef) -> {
return 6.2e-5 * FastMath.exp(-(Ei - Ef) / 350d) + 1.97e-4 - 6.818e-9 * Ei;
@ -237,7 +237,7 @@ public class NumassPlugin extends BasicPlugin {
"6.2e-5 * FastMath.exp(-(Ei - Ef) / 350d) + 1.97e-4 - 6.818e-9 * Ei");
NBkgSpectrum spectrum = new NBkgSpectrum(sp);
return new XYModel(spectrum, getAdapter(an));
return new XYModel(spectrum, getAdapter(meta));
});
manager.addModel("modularbeta-unadeabatic", (context, an) -> {

View File

@ -51,7 +51,7 @@ public class TransmissionInterpolator implements UnivariateFunction {
public static TransmissionInterpolator fromAction(Context context, Meta actionAnnotation,
String xName, String yName, int nSmooth, double w, double border) throws InterruptedException {
DataNode<Table> node = ActionUtils.runConfig(context, actionAnnotation);
PointSource data = node.getData().get();
PointSource data = node.getData().getNow();
return new TransmissionInterpolator(data, xName, yName, nSmooth, w, border);
}