Context constructors now can be called only via Global. Fixes in plugin reloading and context reusing.
This commit is contained in:
parent
cf6c8c0ad7
commit
dd4c15f0a3
@ -16,13 +16,11 @@
|
||||
package inr.numass.control.msp.fx;
|
||||
|
||||
import ch.qos.logback.classic.Level;
|
||||
import hep.dataforge.context.GlobalContext;
|
||||
import hep.dataforge.context.Global;
|
||||
import hep.dataforge.io.MetaFileReader;
|
||||
import hep.dataforge.io.XMLMetaReader;
|
||||
import hep.dataforge.meta.Meta;
|
||||
import hep.dataforge.storage.commons.StorageManager;
|
||||
import java.io.File;
|
||||
import java.util.Locale;
|
||||
import javafx.application.Application;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.scene.Parent;
|
||||
@ -30,6 +28,9 @@ import javafx.scene.Scene;
|
||||
import javafx.stage.Stage;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author darksnake
|
||||
@ -63,7 +64,7 @@ public class MspApp extends Application {
|
||||
Parent parent = loader.load();
|
||||
controller = loader.getController();
|
||||
|
||||
controller.setDeviceConfig(GlobalContext.instance(), config);
|
||||
controller.setDeviceConfig(Global.instance(), config);
|
||||
|
||||
Scene scene = new Scene(parent, 600, 400);
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
package inr.numass.control.msp.fx;
|
||||
|
||||
import hep.dataforge.context.Context;
|
||||
import hep.dataforge.context.GlobalContext;
|
||||
import hep.dataforge.context.Global;
|
||||
import hep.dataforge.control.connections.Roles;
|
||||
import hep.dataforge.control.connections.StorageConnection;
|
||||
import hep.dataforge.exceptions.ControlException;
|
||||
@ -174,7 +174,7 @@ public class MspViewController implements Initializable, MspListener {
|
||||
} catch (IOException | URISyntaxException | ParseException ex) {
|
||||
throw new Error(ex);
|
||||
}
|
||||
setDeviceConfig(GlobalContext.instance(), defaultDeviceConfig);
|
||||
setDeviceConfig(Global.instance(), defaultDeviceConfig);
|
||||
}
|
||||
return device;
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package inr.numass
|
||||
|
||||
import hep.dataforge.context.GlobalContext
|
||||
import hep.dataforge.context.Global
|
||||
import hep.dataforge.grind.GrindShell
|
||||
import hep.dataforge.grind.GrindWorkspaceBuilder
|
||||
|
||||
@ -25,5 +25,5 @@ try {
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
} finally {
|
||||
GlobalContext.instance().close();
|
||||
Global.instance().close();
|
||||
}
|
@ -15,7 +15,7 @@
|
||||
*/
|
||||
package inr.numass.scripts
|
||||
|
||||
import hep.dataforge.context.GlobalContext
|
||||
import hep.dataforge.context.Global
|
||||
import hep.dataforge.stat.fit.FitManager
|
||||
import hep.dataforge.stat.fit.FitState
|
||||
import hep.dataforge.stat.fit.MINUITPlugin
|
||||
@ -31,7 +31,7 @@ import org.apache.commons.math3.analysis.BivariateFunction
|
||||
|
||||
import static inr.numass.utils.OldDataReader.readData
|
||||
|
||||
PrintWriter out = GlobalContext.out();
|
||||
PrintWriter out = Global.out();
|
||||
Locale.setDefault(Locale.US);
|
||||
|
||||
new MINUITPlugin().startGlobal();
|
||||
|
@ -15,7 +15,7 @@
|
||||
*/
|
||||
package inr.numass.scripts
|
||||
|
||||
import hep.dataforge.context.GlobalContext
|
||||
import hep.dataforge.context.Global
|
||||
import hep.dataforge.stat.fit.FitManager
|
||||
import hep.dataforge.stat.fit.FitState
|
||||
import hep.dataforge.stat.fit.ParamSet
|
||||
@ -28,7 +28,7 @@ import inr.numass.models.ModularSpectrum
|
||||
import inr.numass.models.NBkgSpectrum
|
||||
import inr.numass.utils.DataModelUtils
|
||||
|
||||
import static hep.dataforge.context.GlobalContext.out
|
||||
import static Global.out
|
||||
import static java.util.Locale.setDefault
|
||||
|
||||
/**
|
||||
@ -37,7 +37,7 @@ import static java.util.Locale.setDefault
|
||||
*/
|
||||
|
||||
setDefault(Locale.US);
|
||||
GlobalContext global = GlobalContext.instance();
|
||||
Global global = Global.instance();
|
||||
// global.loadModule(new MINUITModule());
|
||||
|
||||
FitManager fm = new FitManager();
|
||||
@ -72,7 +72,7 @@ allPars.setParValue("trap", 0);
|
||||
allPars.setParError("trap", 0.01d);
|
||||
allPars.setParDomain("trap", 0d, Double.POSITIVE_INFINITY);
|
||||
|
||||
// PrintNamed.printSpectrum(GlobalContext.onComplete(), spectrum, allPars, 0.0, 18700.0, 600);
|
||||
// PrintNamed.printSpectrum(Global.onComplete(), spectrum, allPars, 0.0, 18700.0, 600);
|
||||
//String fileName = "d:\\PlayGround\\merge\\scans.onComplete";
|
||||
// String configName = "d:\\PlayGround\\SCAN.CFG";
|
||||
// ListTable config = OldDataReader.readConfig(configName);
|
||||
|
@ -15,7 +15,7 @@
|
||||
*/
|
||||
package inr.numass.scripts
|
||||
|
||||
import hep.dataforge.context.GlobalContext
|
||||
import hep.dataforge.context.Global
|
||||
import hep.dataforge.meta.MetaBuilder
|
||||
import hep.dataforge.stat.fit.ParamSet
|
||||
import inr.numass.data.SpectrumInformation
|
||||
@ -28,7 +28,7 @@ import org.apache.commons.math3.analysis.UnivariateFunction
|
||||
import static java.util.Locale.setDefault
|
||||
|
||||
setDefault(Locale.US);
|
||||
GlobalContext global = GlobalContext.instance();
|
||||
Global global = Global.instance();
|
||||
// global.loadModule(new MINUIT());
|
||||
|
||||
// FitManager fm = new FitManager("data 2013");
|
||||
@ -83,7 +83,7 @@ SpectrumInformation sign = new SpectrumInformation(spectrum);
|
||||
// PrintNamed.printNamedMatrix(Out.out, infoMatrix);
|
||||
// NamedMatrix cov = sign.getExpetedCovariance(allPars, config,"U2","E0","N");
|
||||
//
|
||||
// PrintWriter onComplete = GlobalContext.onComplete();
|
||||
// PrintWriter onComplete = Global.onComplete();
|
||||
//
|
||||
// printNamedMatrix(out, cov);
|
||||
//
|
||||
|
@ -29,7 +29,7 @@ import inr.numass.models.NBkgSpectrum
|
||||
import inr.numass.utils.DataModelUtils
|
||||
import inr.numass.utils.TritiumUtils
|
||||
|
||||
import static hep.dataforge.context.GlobalContext.out
|
||||
import static hep.dataforge.context.Global.out
|
||||
import static java.util.Locale.setDefault
|
||||
|
||||
/**
|
||||
@ -73,7 +73,7 @@ allPars.setParValue("trap", 1d);
|
||||
allPars.setParError("trap", 0.01d);
|
||||
allPars.setParDomain("trap", 0d, Double.POSITIVE_INFINITY);
|
||||
|
||||
// PrintNamed.printSpectrum(GlobalContext.onComplete(), spectrum, allPars, 0.0, 18700.0, 600);
|
||||
// PrintNamed.printSpectrum(Global.onComplete(), spectrum, allPars, 0.0, 18700.0, 600);
|
||||
//String fileName = "d:\\PlayGround\\merge\\scans.onComplete";
|
||||
// String configName = "d:\\PlayGround\\SCAN.CFG";
|
||||
// ListTable config = OldDataReader.readConfig(configName);
|
||||
|
@ -15,7 +15,7 @@
|
||||
*/
|
||||
package inr.numass.scripts
|
||||
|
||||
import hep.dataforge.context.GlobalContext
|
||||
import hep.dataforge.context.Global
|
||||
import hep.dataforge.io.FittingIOUtils
|
||||
import hep.dataforge.stat.fit.FitManager
|
||||
import hep.dataforge.stat.fit.ParamSet
|
||||
@ -27,7 +27,7 @@ import inr.numass.models.NBkgSpectrum
|
||||
import static java.util.Locale.setDefault
|
||||
|
||||
setDefault(Locale.US);
|
||||
GlobalContext global = GlobalContext.instance();
|
||||
Global global = Global.instance();
|
||||
// global.loadModule(new MINUITModule());
|
||||
|
||||
FitManager fm = new FitManager();
|
||||
|
@ -15,7 +15,7 @@
|
||||
*/
|
||||
package inr.numass.scripts
|
||||
|
||||
import hep.dataforge.context.GlobalContext
|
||||
import hep.dataforge.context.Global
|
||||
import hep.dataforge.grind.GrindMetaBuilder
|
||||
import hep.dataforge.io.FittingIOUtils
|
||||
import hep.dataforge.meta.Meta
|
||||
@ -60,7 +60,7 @@ allPars.setPar("U2", 0.0, 1e-4, -1d, 1d);
|
||||
allPars.setPar("X", 0.04, 0.01, 0d, Double.POSITIVE_INFINITY);
|
||||
allPars.setPar("trap", 1.634, 0.01,0d, Double.POSITIVE_INFINITY);
|
||||
|
||||
FittingIOUtils.printSpectrum(GlobalContext.out(), spectrum, allPars, 14000, 18600.0, 400);
|
||||
FittingIOUtils.printSpectrum(Global.out(), spectrum, allPars, 14000, 18600.0, 400);
|
||||
|
||||
//SpectrumGenerator generator = new SpectrumGenerator(model, allPars, 12316);
|
||||
//
|
||||
|
@ -15,7 +15,10 @@
|
||||
*/
|
||||
package inr.numass.scripts
|
||||
|
||||
import hep.dataforge.stat.fit.*
|
||||
import hep.dataforge.stat.fit.FitManager
|
||||
import hep.dataforge.stat.fit.FitState
|
||||
import hep.dataforge.stat.fit.MINUITPlugin
|
||||
import hep.dataforge.stat.fit.ParamSet
|
||||
import hep.dataforge.stat.models.XYModel
|
||||
import hep.dataforge.tables.ListTable
|
||||
import inr.numass.data.SpectrumDataAdapter
|
||||
@ -26,7 +29,7 @@ import inr.numass.models.NBkgSpectrum
|
||||
import inr.numass.models.ResolutionFunction
|
||||
import inr.numass.utils.DataModelUtils
|
||||
|
||||
import static hep.dataforge.context.GlobalContext.out
|
||||
import static hep.dataforge.context.Global.out
|
||||
import static java.util.Locale.setDefault
|
||||
|
||||
/**
|
||||
|
@ -15,7 +15,10 @@
|
||||
*/
|
||||
package inr.numass.scripts
|
||||
|
||||
import hep.dataforge.stat.fit.*
|
||||
import hep.dataforge.stat.fit.FitManager
|
||||
import hep.dataforge.stat.fit.FitState
|
||||
import hep.dataforge.stat.fit.MINUITPlugin
|
||||
import hep.dataforge.stat.fit.ParamSet
|
||||
import hep.dataforge.stat.models.XYModel
|
||||
import hep.dataforge.tables.ListTable
|
||||
import inr.numass.data.SpectrumDataAdapter
|
||||
@ -27,7 +30,7 @@ import inr.numass.models.ResolutionFunction
|
||||
import inr.numass.utils.DataModelUtils
|
||||
import org.apache.commons.math3.analysis.BivariateFunction
|
||||
|
||||
import static hep.dataforge.context.GlobalContext.out
|
||||
import static hep.dataforge.context.Global.out
|
||||
import static java.util.Locale.setDefault
|
||||
|
||||
/**
|
||||
@ -76,7 +79,7 @@ ListTable data = generator.generateData(DataModelUtils.getUniformSpectrumConfigu
|
||||
// data = data.filter("X", Value.of(15510.0), Value.of(18610.0));
|
||||
allPars.setParValue("U2", 0);
|
||||
FitState state = new FitState(data, model, allPars);
|
||||
//new PlotFitResultAction(GlobalContext.instance(), null).runOne(state);
|
||||
//new PlotFitResultAction(Global.instance(), null).runOne(state);
|
||||
|
||||
//double delta = 4e-6;
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
*/
|
||||
package inr.numass.scripts
|
||||
|
||||
import hep.dataforge.context.GlobalContext
|
||||
import hep.dataforge.context.Global
|
||||
import hep.dataforge.data.DataSet
|
||||
import hep.dataforge.stat.fit.FitManager
|
||||
import hep.dataforge.stat.fit.FitState
|
||||
@ -31,7 +31,7 @@ import inr.numass.models.NBkgSpectrum
|
||||
import static hep.dataforge.maths.RandomUtils.setSeed
|
||||
import static inr.numass.utils.DataModelUtils.getUniformSpectrumConfiguration
|
||||
|
||||
PrintWriter out = GlobalContext.out();
|
||||
PrintWriter out = Global.out();
|
||||
FitManager fm = new FitManager();
|
||||
|
||||
setSeed(543982);
|
||||
|
@ -32,7 +32,7 @@ import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.util.Locale;
|
||||
|
||||
import static hep.dataforge.context.GlobalContext.out;
|
||||
import static hep.dataforge.context.Global.out;
|
||||
import static inr.numass.Numass.printDescription;
|
||||
import static java.util.Locale.setDefault;
|
||||
|
||||
|
@ -17,7 +17,7 @@ package inr.numass;
|
||||
|
||||
import hep.dataforge.actions.ActionManager;
|
||||
import hep.dataforge.context.Context;
|
||||
import hep.dataforge.context.GlobalContext;
|
||||
import hep.dataforge.context.Global;
|
||||
import hep.dataforge.description.ActionDescriptor;
|
||||
import hep.dataforge.description.DescriptorFormatter;
|
||||
import hep.dataforge.description.DescriptorUtils;
|
||||
@ -34,14 +34,13 @@ import java.io.PrintWriter;
|
||||
public class Numass {
|
||||
|
||||
public static Context buildContext(Context parent, Meta meta) {
|
||||
Context numassContext = new Context(parent, "numass", meta);
|
||||
GlobalContext.registerContext(numassContext);
|
||||
Context numassContext = Global.getContext("numass").withParent(parent).withProperties(meta);
|
||||
numassContext.pluginManager().loadPlugin("inr.numass:numass");
|
||||
return numassContext;
|
||||
}
|
||||
|
||||
public static Context buildContext() {
|
||||
return buildContext(GlobalContext.instance(), Meta.empty());
|
||||
return buildContext(Global.instance(), Meta.empty());
|
||||
}
|
||||
|
||||
public static void printDescription(Context context, boolean allowANSI) throws DescriptorException {
|
||||
|
@ -5,7 +5,8 @@
|
||||
*/
|
||||
package inr.numass;
|
||||
|
||||
import hep.dataforge.context.GlobalContext;
|
||||
import hep.dataforge.context.Global;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
@ -19,7 +20,7 @@ import java.util.Properties;
|
||||
public class NumassProperties {
|
||||
|
||||
private static File getNumassPropertiesFile() throws IOException {
|
||||
File file = new File(GlobalContext.instance().getUserDirectory(), "numass");
|
||||
File file = new File(Global.instance().getUserDirectory(), "numass");
|
||||
if (!file.exists()) {
|
||||
file.mkdirs();
|
||||
}
|
||||
@ -48,7 +49,7 @@ public class NumassProperties {
|
||||
props.setProperty(key, value);
|
||||
props.store(new FileOutputStream(store), "");
|
||||
} catch (IOException ex) {
|
||||
GlobalContext.instance().getLogger().error("Failed to save numass properties", ex);
|
||||
Global.instance().getLogger().error("Failed to save numass properties", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,31 +1,33 @@
|
||||
/*
|
||||
* Copyright 2015 Alexander Nozik.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/*
|
||||
* Copyright 2015 Alexander Nozik.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package inr.numass.data;
|
||||
|
||||
import hep.dataforge.context.GlobalContext;
|
||||
import hep.dataforge.context.Global;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.text.ParseException;
|
||||
import java.time.LocalDateTime;
|
||||
import static java.time.temporal.ChronoUnit.SECONDS;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static java.time.temporal.ChronoUnit.SECONDS;
|
||||
|
||||
/**
|
||||
* Заплатка для задания поправки на масс-спектрометр
|
||||
*
|
||||
@ -37,7 +39,7 @@ public class MonitorCorrector {
|
||||
private final List<MonitorPoint> list;
|
||||
|
||||
public MonitorCorrector(String path) throws ParseException, IOException {
|
||||
this(GlobalContext.instance().io().getFile(path));
|
||||
this(Global.instance().io().getFile(path));
|
||||
}
|
||||
|
||||
public MonitorCorrector(File monitorFile) throws ParseException, IOException {
|
||||
|
@ -18,19 +18,18 @@ package inr.numass.data;
|
||||
import hep.dataforge.stat.fit.ParamSet;
|
||||
import hep.dataforge.stat.models.Generator;
|
||||
import hep.dataforge.stat.models.XYModel;
|
||||
import static hep.dataforge.maths.RandomUtils.getDefaultRandomGenerator;
|
||||
import hep.dataforge.tables.DataPoint;
|
||||
import hep.dataforge.tables.ListTable;
|
||||
import hep.dataforge.tables.Table;
|
||||
import static java.lang.Double.isNaN;
|
||||
import static java.lang.Math.sqrt;
|
||||
import java.util.Iterator;
|
||||
import org.apache.commons.math3.random.JDKRandomGenerator;
|
||||
import org.apache.commons.math3.random.RandomDataGenerator;
|
||||
import org.apache.commons.math3.random.RandomGenerator;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import static hep.dataforge.maths.RandomUtils.getDefaultRandomGenerator;
|
||||
import static java.lang.Double.isNaN;
|
||||
import static java.lang.Double.isNaN;
|
||||
import static java.lang.Double.isNaN;
|
||||
import static java.lang.Math.sqrt;
|
||||
|
||||
/**
|
||||
* Генератор наборов данных для спектров. На входе требуется набор данных,
|
||||
@ -145,7 +144,7 @@ public class SpectrumGenerator implements Generator {
|
||||
|
||||
// private double getSigma(DataPoint point) {
|
||||
// if (!point.containsName("time")) {
|
||||
// GlobalContext.instance().logString("SpectrumGenerator : Neither point error nor time is defined. Suspected wrong error bars for data.");
|
||||
// Global.instance().logString("SpectrumGenerator : Neither point error nor time is defined. Suspected wrong error bars for data.");
|
||||
// }
|
||||
// return sqrt(this.getMu(point));
|
||||
// }
|
||||
|
@ -15,82 +15,19 @@
|
||||
*/
|
||||
package inr.numass.models;
|
||||
|
||||
import hep.dataforge.context.GlobalContext;
|
||||
import hep.dataforge.context.Global;
|
||||
import hep.dataforge.exceptions.NameNotFoundException;
|
||||
import hep.dataforge.stat.parametric.AbstractParametricFunction;
|
||||
import hep.dataforge.stat.parametric.ParametricFunction;
|
||||
import static hep.dataforge.names.NamedUtils.combineNamesWithEquals;
|
||||
import hep.dataforge.values.NamedValueSet;
|
||||
import hep.dataforge.values.ValueProvider;
|
||||
import static java.lang.Double.isNaN;
|
||||
import static java.lang.Math.abs;
|
||||
import static java.lang.Math.exp;
|
||||
import static java.lang.Math.sqrt;
|
||||
import org.apache.commons.math3.analysis.UnivariateFunction;
|
||||
import org.apache.commons.math3.analysis.integration.SimpsonIntegrator;
|
||||
import org.apache.commons.math3.analysis.integration.UnivariateIntegrator;
|
||||
|
||||
import static hep.dataforge.names.NamedUtils.combineNamesWithEquals;
|
||||
import static java.lang.Double.isNaN;
|
||||
import static java.lang.Math.abs;
|
||||
import static java.lang.Double.isNaN;
|
||||
import static java.lang.Math.abs;
|
||||
import static java.lang.Double.isNaN;
|
||||
import static java.lang.Math.abs;
|
||||
import static java.lang.Double.isNaN;
|
||||
import static java.lang.Math.abs;
|
||||
import static java.lang.Double.isNaN;
|
||||
import static java.lang.Math.abs;
|
||||
import static java.lang.Double.isNaN;
|
||||
import static java.lang.Math.abs;
|
||||
import static java.lang.Double.isNaN;
|
||||
import static java.lang.Math.abs;
|
||||
import static java.lang.Double.isNaN;
|
||||
import static java.lang.Math.abs;
|
||||
import static java.lang.Double.isNaN;
|
||||
import static java.lang.Math.abs;
|
||||
import static java.lang.Double.isNaN;
|
||||
import static java.lang.Math.abs;
|
||||
import static java.lang.Double.isNaN;
|
||||
import static java.lang.Math.abs;
|
||||
import static java.lang.Double.isNaN;
|
||||
import static java.lang.Math.abs;
|
||||
import static java.lang.Double.isNaN;
|
||||
import static java.lang.Math.abs;
|
||||
import static java.lang.Double.isNaN;
|
||||
import static java.lang.Math.abs;
|
||||
import static java.lang.Double.isNaN;
|
||||
import static java.lang.Math.abs;
|
||||
import static java.lang.Double.isNaN;
|
||||
import static java.lang.Math.abs;
|
||||
import static java.lang.Double.isNaN;
|
||||
import static java.lang.Math.abs;
|
||||
import static java.lang.Double.isNaN;
|
||||
import static java.lang.Math.abs;
|
||||
import static java.lang.Double.isNaN;
|
||||
import static java.lang.Math.abs;
|
||||
import static java.lang.Double.isNaN;
|
||||
import static java.lang.Math.abs;
|
||||
import static java.lang.Double.isNaN;
|
||||
import static java.lang.Math.abs;
|
||||
import static java.lang.Double.isNaN;
|
||||
import static java.lang.Math.abs;
|
||||
import static java.lang.Double.isNaN;
|
||||
import static java.lang.Math.abs;
|
||||
import static java.lang.Double.isNaN;
|
||||
import static java.lang.Math.abs;
|
||||
import static java.lang.Double.isNaN;
|
||||
import static java.lang.Math.abs;
|
||||
import static java.lang.Double.isNaN;
|
||||
import static java.lang.Math.abs;
|
||||
import static java.lang.Double.isNaN;
|
||||
import static java.lang.Math.abs;
|
||||
import static java.lang.Double.isNaN;
|
||||
import static java.lang.Math.abs;
|
||||
import static java.lang.Double.isNaN;
|
||||
import static java.lang.Math.abs;
|
||||
import static java.lang.Double.isNaN;
|
||||
import static java.lang.Math.abs;
|
||||
import static java.lang.Double.isNaN;
|
||||
import static java.lang.Math.abs;
|
||||
import static java.lang.Math.*;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -131,7 +68,7 @@ public class GaussResolution extends AbstractParametricFunction implements Trans
|
||||
@Override
|
||||
public ParametricFunction getConvolutedSpectrum(final RangedNamedSetSpectrum bare) {
|
||||
return new AbstractParametricFunction(combineNamesWithEquals(this.namesAsArray(), bare.namesAsArray())) {
|
||||
int maxEval = GlobalContext.instance().getInt("INTEGR_POINTS", 500);
|
||||
int maxEval = Global.instance().getInt("INTEGR_POINTS", 500);
|
||||
|
||||
@Override
|
||||
public double derivValue(String parName, double x, NamedValueSet set) {
|
||||
|
@ -6,7 +6,7 @@
|
||||
package inr.numass.models.sterile;
|
||||
|
||||
import hep.dataforge.context.Context;
|
||||
import hep.dataforge.context.GlobalContext;
|
||||
import hep.dataforge.context.Global;
|
||||
import hep.dataforge.description.NodeDef;
|
||||
import hep.dataforge.description.ValueDef;
|
||||
import hep.dataforge.exceptions.NotDefinedException;
|
||||
@ -79,11 +79,11 @@ public class SterileNeutrinoSpectrum extends AbstractParametricFunction {
|
||||
}
|
||||
|
||||
public SterileNeutrinoSpectrum(Meta configuration) {
|
||||
this(GlobalContext.instance(), configuration);
|
||||
this(Global.instance(), configuration);
|
||||
}
|
||||
|
||||
public SterileNeutrinoSpectrum() {
|
||||
this(GlobalContext.instance(), Meta.empty());
|
||||
this(Global.instance(), Meta.empty());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -15,18 +15,20 @@
|
||||
*/
|
||||
package inr.numass.utils;
|
||||
|
||||
import hep.dataforge.context.GlobalContext;
|
||||
import hep.dataforge.context.Global;
|
||||
import hep.dataforge.tables.DataPoint;
|
||||
import hep.dataforge.tables.ListTable;
|
||||
import hep.dataforge.tables.MapPoint;
|
||||
import hep.dataforge.tables.Table;
|
||||
import inr.numass.data.SpectrumDataAdapter;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.util.Locale;
|
||||
import static java.util.Locale.setDefault;
|
||||
import java.util.Scanner;
|
||||
|
||||
import static java.util.Locale.setDefault;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Darksnake
|
||||
@ -36,7 +38,7 @@ public class OldDataReader {
|
||||
public static Table readConfig(String path) throws FileNotFoundException {
|
||||
String[] list = {"X", "time", "ushift"};
|
||||
ListTable.Builder res = new ListTable.Builder(list);
|
||||
File file = GlobalContext.instance().io().getFile(path);
|
||||
File file = Global.instance().io().getFile(path);
|
||||
Scanner sc = new Scanner(file);
|
||||
sc.nextLine();
|
||||
|
||||
@ -58,7 +60,7 @@ public class OldDataReader {
|
||||
public static Table readData(String path, double Elow) {
|
||||
SpectrumDataAdapter factory = new SpectrumDataAdapter();
|
||||
ListTable.Builder res = new ListTable.Builder(factory.getFormat());
|
||||
File file = GlobalContext.instance().io().getFile(path);
|
||||
File file = Global.instance().io().getFile(path);
|
||||
double x;
|
||||
int count;
|
||||
int time;
|
||||
@ -110,7 +112,7 @@ public class OldDataReader {
|
||||
public static Table readDataAsGun(String path, double Elow) {
|
||||
SpectrumDataAdapter factory = new SpectrumDataAdapter();
|
||||
ListTable.Builder res = new ListTable.Builder(factory.getFormat());
|
||||
File file = GlobalContext.instance().io().getFile(path);
|
||||
File file = Global.instance().io().getFile(path);
|
||||
double x;
|
||||
long count;
|
||||
int time;
|
||||
@ -143,7 +145,7 @@ public class OldDataReader {
|
||||
public static Table readSpectrumData(String path) {
|
||||
SpectrumDataAdapter factory = new SpectrumDataAdapter();
|
||||
ListTable.Builder res = new ListTable.Builder(factory.getFormat());
|
||||
File file = GlobalContext.instance().io().getFile(path);
|
||||
File file = Global.instance().io().getFile(path);
|
||||
double x;
|
||||
double count;
|
||||
double time;
|
||||
|
@ -10,7 +10,7 @@ import hep.dataforge.actions.ActionManager;
|
||||
import hep.dataforge.actions.ActionStateListener;
|
||||
import hep.dataforge.actions.ActionUtils;
|
||||
import hep.dataforge.context.Context;
|
||||
import hep.dataforge.context.GlobalContext;
|
||||
import hep.dataforge.context.Global;
|
||||
import hep.dataforge.data.DataNode;
|
||||
import hep.dataforge.data.FileDataFactory;
|
||||
import hep.dataforge.description.ActionDescriptor;
|
||||
@ -367,13 +367,13 @@ public class NumassWorkbenchController implements Initializable, StagePaneHolder
|
||||
} catch (Exception ex) {
|
||||
if (ex instanceof java.util.concurrent.CancellationException) {
|
||||
//cach cancelation exception
|
||||
GlobalContext.instance().getLogger().info("Interrupted by user");
|
||||
Global.instance().getLogger().info("Interrupted by user");
|
||||
Platform.runLater(() -> {
|
||||
statusBar.setText("Execution interrupted by user");
|
||||
});
|
||||
} else {
|
||||
//cach all other exceptions
|
||||
GlobalContext.instance().getLogger().error("Exception while executing action chain", ex);
|
||||
Global.instance().getLogger().error("Exception while executing action chain", ex);
|
||||
ex.printStackTrace(System.err);
|
||||
Platform.runLater(() -> {
|
||||
//printing stack trace to the default output
|
||||
|
@ -5,7 +5,7 @@
|
||||
*/
|
||||
package inr.numass.workbench;
|
||||
|
||||
import hep.dataforge.context.GlobalContext;
|
||||
import hep.dataforge.context.Global;
|
||||
import inr.numass.Numass;
|
||||
import javafx.application.Application;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
@ -55,7 +55,7 @@ public class Workbench extends Application {
|
||||
|
||||
@Override
|
||||
public void stop() throws Exception {
|
||||
GlobalContext.instance().close();
|
||||
Global.instance().close();
|
||||
super.stop();
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
*/
|
||||
package inr.numass.models;
|
||||
|
||||
import hep.dataforge.context.GlobalContext;
|
||||
import hep.dataforge.context.Global;
|
||||
import hep.dataforge.plots.data.PlottableData;
|
||||
import hep.dataforge.plots.data.PlottableXYFunction;
|
||||
import hep.dataforge.plots.jfreechart.JFreeChartFrame;
|
||||
@ -30,7 +30,7 @@ public class TransmissionInterpolatorTest {
|
||||
public static void main(String[] args) {
|
||||
JFreeChartFrame frame = NumassPlugin.displayJFreeChart("TransmissionInterpolatorTest", null);
|
||||
//JFreeChartFrame.drawFrame("TransmissionInterpolatorTest", null);
|
||||
TransmissionInterpolator interpolator = TransmissionInterpolator.fromFile(GlobalContext.instance(),
|
||||
TransmissionInterpolator interpolator = TransmissionInterpolator.fromFile(Global.instance(),
|
||||
"d:\\sterile-new\\loss2014-11\\.dataforge\\merge\\empty_sum.onComplete", "Uset", "CR", 15, 0.8, 19002d);
|
||||
frame.add(PlottableData.plot("data", interpolator.getX(), interpolator.getY()));
|
||||
frame.add(PlottableXYFunction.plotFunction("interpolated", x->interpolator.value(x), interpolator.getXmin(), interpolator.getXmax(), 2000));
|
||||
|
@ -15,7 +15,7 @@
|
||||
*/
|
||||
package inr.numass.storage;
|
||||
|
||||
import hep.dataforge.context.GlobalContext;
|
||||
import hep.dataforge.context.Global;
|
||||
import hep.dataforge.data.binary.Binary;
|
||||
import hep.dataforge.exceptions.StorageException;
|
||||
import hep.dataforge.io.ColumnedDataReader;
|
||||
@ -147,7 +147,7 @@ public class NumassDataLoader extends AbstractLoader implements ObjectLoader<Env
|
||||
|
||||
private static Envelope readFile(FileObject file) {
|
||||
//VFS file reading seems to work basly in parallel
|
||||
synchronized (GlobalContext.instance()) {
|
||||
synchronized (Global.instance()) {
|
||||
String fileName = file.getName().getBaseName();
|
||||
if (fileName.equals(META_FRAGMENT_NAME)
|
||||
|| fileName.equals(HV_FRAGMENT_NAME)
|
||||
|
@ -6,13 +6,9 @@
|
||||
package inr.numass.storage;
|
||||
|
||||
import hep.dataforge.context.Context;
|
||||
import hep.dataforge.context.GlobalContext;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
import hep.dataforge.context.Global;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
@ -32,7 +28,7 @@ public class SetDirectionUtility {
|
||||
|
||||
static synchronized boolean isReversed(String setName, Function<String, Boolean> provider) {
|
||||
if (!isLoaded) {
|
||||
load(GlobalContext.instance());
|
||||
load(Global.instance());
|
||||
}
|
||||
return directionMap.computeIfAbsent(setName, provider);
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ package inr.numass.viewer;
|
||||
|
||||
import hep.dataforge.computation.ProgressCallback;
|
||||
import hep.dataforge.context.Context;
|
||||
import hep.dataforge.context.GlobalContext;
|
||||
import hep.dataforge.context.Global;
|
||||
import hep.dataforge.exceptions.StorageException;
|
||||
import hep.dataforge.fx.fragments.FragmentWindow;
|
||||
import hep.dataforge.fx.fragments.LogFragment;
|
||||
@ -104,7 +104,7 @@ public class MainViewerController implements Initializable {
|
||||
LogFragment logFragment = new LogFragment();
|
||||
logFragment.hookStd();
|
||||
new FragmentWindow(logFragment).bindTo(consoleButton);
|
||||
new FragmentWindow(WorkManagerFragment.attachToContext(GlobalContext.instance())).bindTo(processManagerButton);
|
||||
new FragmentWindow(WorkManagerFragment.attachToContext(Global.instance())).bindTo(processManagerButton);
|
||||
|
||||
mspController = new MspViewController(getContext());
|
||||
this.mspTab.setContent(mspController.getRoot());
|
||||
@ -148,7 +148,7 @@ public class MainViewerController implements Initializable {
|
||||
}
|
||||
|
||||
private Context getContext() {
|
||||
return GlobalContext.instance();
|
||||
return Global.instance();
|
||||
}
|
||||
|
||||
public void setRootStorage(NumassStorage root) {
|
||||
|
@ -15,15 +15,16 @@
|
||||
*/
|
||||
package inr.numass.viewer;
|
||||
|
||||
import hep.dataforge.context.GlobalContext;
|
||||
import hep.dataforge.context.Global;
|
||||
import hep.dataforge.storage.commons.StorageManager;
|
||||
import inr.numass.storage.NumassDataLoader;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import javafx.application.Application;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author darksnake
|
||||
@ -37,7 +38,7 @@ public class TestDirectoryViewer extends Application {
|
||||
NumassDataLoader reader = NumassDataLoader.fromLocalDir(null, new File("C:\\Users\\darksnake\\Dropbox\\PlayGround\\data-test\\20150703143643_1\\"));
|
||||
// NumassLoader reader = NumassLoader.fromZip(null, new File("C:\\Users\\darksnake\\Dropbox\\PlayGround\\data-test\\20150703143643_1.zip"));
|
||||
|
||||
NumassLoaderViewComponent comp = new NumassLoaderViewComponent(GlobalContext.instance());
|
||||
NumassLoaderViewComponent comp = new NumassLoaderViewComponent(Global.instance());
|
||||
comp.loadData(reader);
|
||||
// FXMLLoader fxml = new FXMLLoader(getClass().getResource("/fxml/DirectoryViewer.fxml"));
|
||||
//
|
||||
|
Loading…
Reference in New Issue
Block a user