diff --git a/numass-main/src/main/groovy/inr/numass/LaunchGrindShell.groovy b/numass-main/src/main/groovy/inr/numass/LaunchGrindShell.groovy index 01390cec..d9074dab 100644 --- a/numass-main/src/main/groovy/inr/numass/LaunchGrindShell.groovy +++ b/numass-main/src/main/groovy/inr/numass/LaunchGrindShell.groovy @@ -15,6 +15,10 @@ println cli.usage String cfgPath = cli.parse(args).c; println "Loading config file from $cfgPath" +//println "Starting numass plugin in GLOBAL" +//Global.instance().pluginManager().loadPlugin("inr.numass:numass") +println "Starting Grind shell" + try { new GrindShell().launch { GrindWorkspaceBuilder numass = new GrindWorkspaceBuilder() @@ -25,5 +29,5 @@ try { } catch (Exception ex) { ex.printStackTrace(); } finally { - Global.instance().close(); + Global.terminate(); } \ No newline at end of file diff --git a/numass-main/src/main/java/inr/numass/actions/PrepareDataAction.java b/numass-main/src/main/java/inr/numass/actions/PrepareDataAction.java index 140e3a43..fe2c283e 100644 --- a/numass-main/src/main/java/inr/numass/actions/PrepareDataAction.java +++ b/numass-main/src/main/java/inr/numass/actions/PrepareDataAction.java @@ -21,7 +21,7 @@ import hep.dataforge.description.ValueDef; import hep.dataforge.exceptions.ContentException; import hep.dataforge.io.ColumnedDataWriter; import hep.dataforge.io.XMLMetaWriter; -import hep.dataforge.io.reports.Reportable; +import hep.dataforge.io.reports.Logable; import hep.dataforge.meta.Laminate; import hep.dataforge.meta.Meta; import hep.dataforge.tables.*; @@ -142,7 +142,7 @@ public class PrepareDataAction extends OneToOneAction { * @param meta * @return */ - private double correction(Reportable log, NMPoint point, Laminate meta) { + private double correction(Logable log, NMPoint point, Laminate meta) { if (meta.hasValue("correction")) { // log.report("Using correction from formula: {}", meta.getString("correction")); return evaluateExpression(point, meta.getString("correction")); diff --git a/numass-main/src/main/java/inr/numass/models/sterile/TestModels.java b/numass-main/src/main/java/inr/numass/models/sterile/TestModels.java index 561a5755..5f758182 100644 --- a/numass-main/src/main/java/inr/numass/models/sterile/TestModels.java +++ b/numass-main/src/main/java/inr/numass/models/sterile/TestModels.java @@ -6,17 +6,13 @@ package inr.numass.models.sterile; import hep.dataforge.context.Context; -import hep.dataforge.stat.fit.ParamSet; -import hep.dataforge.stat.parametric.ParametricFunction; import hep.dataforge.maths.MathPlugin; import hep.dataforge.meta.Meta; import hep.dataforge.meta.MetaBuilder; +import hep.dataforge.stat.fit.ParamSet; +import hep.dataforge.stat.parametric.ParametricFunction; import inr.numass.Numass; -import inr.numass.models.BetaSpectrum; -import inr.numass.models.ModularSpectrum; -import inr.numass.models.NBkgSpectrum; -import inr.numass.models.RangedNamedSetSpectrum; -import inr.numass.models.ResolutionFunction; +import inr.numass.models.*; import org.apache.commons.math3.analysis.BivariateFunction; /** @@ -70,7 +66,7 @@ public class TestModels { 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"); + context.getLog().report("Setting up tritium model with real transmission function"); BivariateFunction resolutionTail; if (meta.hasValue("resolution.tailAlpha")) { resolutionTail = ResolutionFunction.getAngledTail(meta.getDouble("resolution.tailAlpha"), meta.getDouble("resolution.tailBeta", 0)); @@ -81,7 +77,7 @@ public class TestModels { RangedNamedSetSpectrum beta = new BetaSpectrum(); ModularSpectrum sp = new ModularSpectrum(beta, new ResolutionFunction(A, resolutionTail), from, to); if (meta.getBoolean("caching", false)) { - context.getReport().report("Caching turned on"); + context.getLog().report("Caching turned on"); sp.setCaching(true); } //Adding trapping energy dependence diff --git a/numass-main/src/main/java/inr/numass/utils/UnderflowCorrection.java b/numass-main/src/main/java/inr/numass/utils/UnderflowCorrection.java index 3720f0db..1307de30 100644 --- a/numass-main/src/main/java/inr/numass/utils/UnderflowCorrection.java +++ b/numass-main/src/main/java/inr/numass/utils/UnderflowCorrection.java @@ -5,20 +5,21 @@ */ package inr.numass.utils; -import hep.dataforge.io.reports.Reportable; +import hep.dataforge.io.reports.Logable; import hep.dataforge.meta.Meta; import hep.dataforge.tables.ListTable; import hep.dataforge.tables.Table; import inr.numass.storage.NMPoint; import inr.numass.storage.NumassData; import inr.numass.storage.RawNMPoint; -import java.util.List; -import java.util.stream.Collectors; import org.apache.commons.math3.analysis.ParametricUnivariateFunction; import org.apache.commons.math3.exception.DimensionMismatchException; import org.apache.commons.math3.fitting.SimpleCurveFitter; import org.apache.commons.math3.fitting.WeightedObservedPoint; +import java.util.List; +import java.util.stream.Collectors; + /** * A class to calculate underflow correction * @@ -26,7 +27,7 @@ import org.apache.commons.math3.fitting.WeightedObservedPoint; */ public class UnderflowCorrection { - public double get(Reportable log, Meta meta, NMPoint point) { + public double get(Logable log, Meta meta, NMPoint point) { if (point.getUset() >= meta.getDouble("underflow.threshold", 17000)) { if (meta.hasValue("underflow.function")) { return TritiumUtils.evaluateExpression(point, meta.getString("underflow.function")); diff --git a/numass-main/src/main/java/inr/numass/workbench/NumassWorkbenchController.java b/numass-main/src/main/java/inr/numass/workbench/NumassWorkbenchController.java index cbdfa12b..50079f8b 100644 --- a/numass-main/src/main/java/inr/numass/workbench/NumassWorkbenchController.java +++ b/numass-main/src/main/java/inr/numass/workbench/NumassWorkbenchController.java @@ -167,7 +167,7 @@ public class NumassWorkbenchController implements Initializable, StagePaneHolder // setting io manager context.setIO(new WorkbenchIOManager(new NumassIO(), this)); buildContextPane(); - context.getReport().addReportListener(new FXReportListener(logPane)); + context.getLog().addListener(new FXReportListener(logPane)); // display plots iside workbench PlotsPlugin.buildFrom(context).setPlotHolderDelegate(this); diff --git a/numass-main/src/main/java/inr/numass/workbench/WorkbenchIOManager.java b/numass-main/src/main/java/inr/numass/workbench/WorkbenchIOManager.java index 5cf265a3..44647cc9 100644 --- a/numass-main/src/main/java/inr/numass/workbench/WorkbenchIOManager.java +++ b/numass-main/src/main/java/inr/numass/workbench/WorkbenchIOManager.java @@ -5,7 +5,7 @@ */ package inr.numass.workbench; -import hep.dataforge.context.Context; +import hep.dataforge.io.BasicIOManager; import hep.dataforge.io.IOManager; import hep.dataforge.names.Name; import org.apache.commons.io.output.TeeOutputStream; @@ -18,7 +18,7 @@ import java.io.OutputStream; * An IOManager wrapper that redirects output to appropriate FX components * @author Alexander Nozik */ -public class WorkbenchIOManager implements IOManager { +public class WorkbenchIOManager extends BasicIOManager { private final IOManager manager; private final StagePaneHolder holder; @@ -28,16 +28,6 @@ public class WorkbenchIOManager implements IOManager { this.holder = holder; } - @Override - public Context getContext() { - return manager.getContext(); - } - - @Override - public void setContext(Context context) { - manager.setContext(context); - } - @Override public File getFile(String path) { return manager.getFile(path);