fixes to grind and numass

This commit is contained in:
darksnake 2016-08-11 15:45:53 +03:00
parent 8cc6d0365f
commit cb1951babd
14 changed files with 132 additions and 187 deletions

View File

@ -15,20 +15,14 @@
*/
package inr.numass.scripts
import hep.dataforge.fitting.ParamSet
import hep.dataforge.maths.integration.RiemanIntegrator
import hep.dataforge.maths.integration.UnivariateIntegrator
import hep.dataforge.plots.PlotFrame
import hep.dataforge.plots.data.PlottableXYFunction
import hep.dataforge.plots.jfreechart.JFreeChartFrame
import hep.dataforge.stat.fit.ParamSet
import inr.numass.models.LossCalculator
import org.apache.commons.math3.analysis.UnivariateFunction
import org.apache.commons.math3.analysis.solvers.BisectionSolver
import inr.numass.models.LossCalculator
import inr.numass.models.ResolutionFunction
import inr.numass.Numass
ParamSet params = new ParamSet()
.setParValue("exPos", 12.76)

View File

@ -17,7 +17,7 @@ package inr.numass.scripts
import hep.dataforge.context.Context
import hep.dataforge.data.DataNode
import hep.dataforge.fitting.FitTaskResult
import hep.dataforge.stat.fit.FitTaskResult
import inr.numass.Main
import inr.numass.Numass

View File

@ -13,31 +13,23 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package inr.numass.scripts;
package inr.numass.scripts
import hep.dataforge.context.GlobalContext;
import hep.dataforge.tables.ListTable;
import hep.dataforge.fitting.FitManager;
import hep.dataforge.fitting.FitState;
import hep.dataforge.fitting.MINUITPlugin
import hep.dataforge.fitting.ParamSet;
import hep.dataforge.fitting.models.XYModel;
import hep.dataforge.fitting.likelihood.BayesianManager
import hep.dataforge.context.GlobalContext
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
import inr.numass.models.BetaSpectrum;
import inr.numass.models.ModularSpectrum;
import inr.numass.models.NBkgSpectrum;
import inr.numass.models.RangedNamedSetSpectrum;
import inr.numass.models.BetaSpectrum
import inr.numass.models.ModularSpectrum
import inr.numass.models.NBkgSpectrum
import inr.numass.models.ResolutionFunction
import static inr.numass.utils.OldDataReader.readData;
import java.io.File;
import java.io.PrintWriter;
import java.util.Locale;
import org.apache.commons.math3.analysis.BivariateFunction
import inr.numass.models.ResolutionFunction
import static inr.numass.utils.OldDataReader.readData
PrintWriter out = GlobalContext.out();
Locale.setDefault(Locale.US);

View File

@ -13,26 +13,23 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package inr.numass.scripts;
package inr.numass.scripts
import hep.dataforge.context.GlobalContext;
import static hep.dataforge.context.GlobalContext.out;
import hep.dataforge.tables.ListTable;
import hep.dataforge.fitting.FitManager;
import hep.dataforge.fitting.FitState;
import hep.dataforge.fitting.FitTask;
import hep.dataforge.fitting.ParamSet;
import hep.dataforge.fitting.models.XYModel;
import hep.dataforge.exceptions.NamingException;
import inr.numass.data.SpectrumDataAdapter;
import inr.numass.data.SpectrumGenerator;
import hep.dataforge.context.GlobalContext
import hep.dataforge.stat.fit.FitManager
import hep.dataforge.stat.fit.FitState
import hep.dataforge.stat.fit.ParamSet
import hep.dataforge.stat.models.XYModel
import hep.dataforge.tables.ListTable
import inr.numass.data.SpectrumDataAdapter
import inr.numass.data.SpectrumGenerator
import inr.numass.models.BetaSpectrum
import inr.numass.models.ModularSpectrum;
import inr.numass.models.NBkgSpectrum;
import inr.numass.utils.DataModelUtils;
import java.io.FileNotFoundException;
import java.util.Locale;
import static java.util.Locale.setDefault;
import inr.numass.models.ModularSpectrum
import inr.numass.models.NBkgSpectrum
import inr.numass.utils.DataModelUtils
import static hep.dataforge.context.GlobalContext.out
import static java.util.Locale.setDefault
/**
*

View File

@ -17,7 +17,7 @@ package inr.numass.scripts;
import hep.dataforge.meta.MetaBuilder;
import hep.dataforge.context.GlobalContext;
import hep.dataforge.fitting.ParamSet;
import hep.dataforge.stat.fit.ParamSet;
import inr.numass.data.SpectrumInformation;
import inr.numass.models.ModularSpectrum;
import inr.numass.models.BetaSpectrum;

View File

@ -13,32 +13,21 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package inr.numass.scripts;
package inr.numass.scripts
import hep.dataforge.context.GlobalContext;
import static hep.dataforge.context.GlobalContext.out;
import hep.dataforge.tables.ListTable;
import hep.dataforge.fitting.FitManager;
import hep.dataforge.fitting.FitState;
import hep.dataforge.fitting.FitTask;
import hep.dataforge.fitting.MINUITPlugin
import hep.dataforge.fitting.ParamSet;
import hep.dataforge.fitting.models.XYModel;
import hep.dataforge.exceptions.NamingException;
import hep.dataforge.exceptions.PackFormatException;
import inr.numass.data.SpectrumDataAdapter;
import inr.numass.data.SpectrumGenerator;
import hep.dataforge.stat.fit.*
import hep.dataforge.stat.models.XYModel
import hep.dataforge.tables.ListTable
import inr.numass.data.SpectrumDataAdapter
import inr.numass.data.SpectrumGenerator
import inr.numass.models.BetaSpectrum
import inr.numass.models.ModularSpectrum;
import inr.numass.models.NBkgSpectrum;
import inr.numass.utils.DataModelUtils;
import hep.dataforge.plotfit.PlotFitResultAction;
import java.io.FileNotFoundException;
import java.util.Locale;
import static java.util.Locale.setDefault;
import inr.numass.utils.TritiumUtils;
import inr.numass.data.SpectrumDataAdapter;
import inr.numass.models.ModularSpectrum
import inr.numass.models.NBkgSpectrum
import inr.numass.utils.DataModelUtils
import inr.numass.utils.TritiumUtils
import static hep.dataforge.context.GlobalContext.out
import static java.util.Locale.setDefault
/**
*

View File

@ -13,22 +13,18 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package inr.numass.scripts;
package inr.numass.scripts
import hep.dataforge.context.GlobalContext;
import hep.dataforge.fitting.FitManager;
import hep.dataforge.fitting.ParamSet;
import hep.dataforge.fitting.models.XYModel;
import hep.dataforge.exceptions.NamingException;
import hep.dataforge.io.FittingIOUtils;
import inr.numass.data.SpectrumDataAdapter;
import inr.numass.models.GunSpectrum;
import inr.numass.models.NBkgSpectrum;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.Locale;
import static java.util.Locale.setDefault;
import hep.dataforge.context.GlobalContext
import hep.dataforge.stat.fit.FitManager
import hep.dataforge.stat.fit.ParamSet
import hep.dataforge.stat.models.XYModel
import hep.dataforge.io.FittingIOUtils
import inr.numass.data.SpectrumDataAdapter
import inr.numass.models.GunSpectrum
import inr.numass.models.NBkgSpectrum
import static java.util.Locale.setDefault
setDefault(Locale.US);
GlobalContext global = GlobalContext.instance();

View File

@ -13,37 +13,20 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package inr.numass.scripts;
package inr.numass.scripts
import hep.dataforge.context.GlobalContext;
import static hep.dataforge.context.GlobalContext.out;
import hep.dataforge.tables.ListTable;
import hep.dataforge.fitting.FitManager;
import hep.dataforge.fitting.FitState;
import hep.dataforge.fitting.FitTask;
import hep.dataforge.fitting.MINUITPlugin
import hep.dataforge.fitting.ParamSet;
import hep.dataforge.fitting.models.XYModel;
import hep.dataforge.fitting.parametric.ParametricFunction
import hep.dataforge.exceptions.NamingException;
import hep.dataforge.exceptions.PackFormatException;
import inr.numass.data.SpectrumDataAdapter;
import inr.numass.data.SpectrumGenerator;
import inr.numass.models.BetaSpectrum
import inr.numass.models.ModularSpectrum;
import inr.numass.models.NBkgSpectrum;
import inr.numass.models.sterile.SterileNeutrinoSpectrum
import inr.numass.utils.DataModelUtils;
import hep.dataforge.plotfit.PlotFitResultAction;
import java.io.FileNotFoundException;
import java.util.Locale;
import static java.util.Locale.setDefault;
import inr.numass.utils.TritiumUtils;
import inr.numass.data.SpectrumDataAdapter;
import hep.dataforge.context.GlobalContext
import hep.dataforge.grind.GrindMetaBuilder
import hep.dataforge.io.FittingIOUtils
import hep.dataforge.meta.Meta
import hep.dataforge.grind.GrindMetaBuilder
import hep.dataforge.stat.fit.ParamSet
import hep.dataforge.stat.models.XYModel
import hep.dataforge.stat.parametric.ParametricFunction
import inr.numass.data.SpectrumDataAdapter
import inr.numass.models.NBkgSpectrum
import inr.numass.models.sterile.SterileNeutrinoSpectrum
import static java.util.Locale.setDefault
/**
*

View File

@ -13,36 +13,21 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package inr.numass.scripts;
package inr.numass.scripts
import hep.dataforge.context.GlobalContext;
import static hep.dataforge.context.GlobalContext.out;
import hep.dataforge.tables.ListTable;
import hep.dataforge.fitting.FitManager;
import hep.dataforge.fitting.FitState;
import hep.dataforge.fitting.FitTask;
import hep.dataforge.fitting.MINUITPlugin
import hep.dataforge.fitting.ParamSet;
import hep.dataforge.fitting.models.XYModel;
import hep.dataforge.exceptions.NamingException;
import hep.dataforge.exceptions.PackFormatException;
import inr.numass.data.SpectrumDataAdapter;
import inr.numass.data.SpectrumGenerator;
import hep.dataforge.stat.fit.*
import hep.dataforge.stat.models.XYModel
import hep.dataforge.tables.ListTable
import inr.numass.data.SpectrumDataAdapter
import inr.numass.data.SpectrumGenerator
import inr.numass.models.BetaSpectrum
import inr.numass.models.ModularSpectrum
import inr.numass.models.NBkgSpectrum;
import inr.numass.models.NBkgSpectrum
import inr.numass.models.ResolutionFunction
import inr.numass.utils.DataModelUtils;
import hep.dataforge.plotfit.PlotFitResultAction;
import hep.dataforge.plots.PlotFrame
import hep.dataforge.plots.data.PlottableXYFunction
import hep.dataforge.plots.jfreechart.JFreeChartFrame
import java.io.FileNotFoundException;
import java.util.Locale;
import org.apache.commons.math3.analysis.BivariateFunction
import inr.numass.utils.DataModelUtils
import static java.util.Locale.setDefault;
import static hep.dataforge.context.GlobalContext.out
import static java.util.Locale.setDefault
/**
*

View File

@ -13,36 +13,22 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package inr.numass.scripts;
package inr.numass.scripts
import hep.dataforge.context.GlobalContext;
import static hep.dataforge.context.GlobalContext.out;
import hep.dataforge.tables.ListTable;
import hep.dataforge.fitting.FitManager;
import hep.dataforge.fitting.FitState;
import hep.dataforge.fitting.FitTask;
import hep.dataforge.fitting.MINUITPlugin
import hep.dataforge.fitting.ParamSet;
import hep.dataforge.fitting.models.XYModel;
import hep.dataforge.exceptions.NamingException;
import hep.dataforge.exceptions.PackFormatException;
import inr.numass.data.SpectrumDataAdapter;
import inr.numass.data.SpectrumGenerator;
import hep.dataforge.stat.fit.*
import hep.dataforge.stat.models.XYModel
import hep.dataforge.tables.ListTable
import inr.numass.data.SpectrumDataAdapter
import inr.numass.data.SpectrumGenerator
import inr.numass.models.BetaSpectrum
import inr.numass.models.ModularSpectrum;
import inr.numass.models.NBkgSpectrum;
import inr.numass.models.ModularSpectrum
import inr.numass.models.NBkgSpectrum
import inr.numass.models.ResolutionFunction
import inr.numass.utils.DataModelUtils;
import hep.dataforge.plotfit.PlotFitResultAction;
import hep.dataforge.plots.PlotFrame
import hep.dataforge.plots.data.PlottableXYFunction
import hep.dataforge.plots.jfreechart.JFreeChartFrame
import java.io.FileNotFoundException;
import java.util.Locale;
import inr.numass.utils.DataModelUtils
import org.apache.commons.math3.analysis.BivariateFunction
import static java.util.Locale.setDefault;
import static hep.dataforge.context.GlobalContext.out
import static java.util.Locale.setDefault
/**
*

View File

@ -22,7 +22,7 @@ import inr.numass.models.ExperimentalVariableLossSpectrum
import org.apache.commons.math3.analysis.UnivariateFunction
import inr.numass.Numass
import hep.dataforge.fitting.ParamSet
import hep.dataforge.stat.fit.ParamSet
import hep.dataforge.io.PrintFunction

View File

@ -0,0 +1,10 @@
package inr.numass.scripts
import hep.dataforge.grind.GrindLauncher
/**
* Created by darksnake on 11-Aug-16.
*/
new GrindLauncher().from { new File("D:\\Work\\Numass\\sterile2016\\workspace.groovy") }.runTask("numass.prepare", "fill_2")

View File

@ -13,26 +13,23 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package inr.numass.scripts;
package inr.numass.scripts
import hep.dataforge.context.GlobalContext;
import hep.dataforge.data.DataSet;
import hep.dataforge.tables.ListTable;
import hep.dataforge.fitting.FitManager;
import hep.dataforge.fitting.FitState;
import hep.dataforge.fitting.ParamSet;
import hep.dataforge.fitting.models.XYModel;
import hep.dataforge.fitting.likelihood.BayesianManager
import static hep.dataforge.maths.RandomUtils.setSeed;
import inr.numass.data.SpectrumGenerator;
import hep.dataforge.context.GlobalContext
import hep.dataforge.data.DataSet
import hep.dataforge.stat.fit.FitManager
import hep.dataforge.stat.fit.FitState
import hep.dataforge.stat.fit.ParamSet
import hep.dataforge.stat.likelihood.BayesianManager
import hep.dataforge.stat.models.XYModel
import hep.dataforge.tables.ListTable
import inr.numass.data.SpectrumGenerator
import inr.numass.models.BetaSpectrum
import inr.numass.models.ModularSpectrum
import inr.numass.models.NBkgSpectrum;
import static inr.numass.utils.DataModelUtils.getUniformSpectrumConfiguration;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import inr.numass.models.NBkgSpectrum
import static hep.dataforge.maths.RandomUtils.setSeed
import static inr.numass.utils.DataModelUtils.getUniformSpectrumConfiguration
PrintWriter out = GlobalContext.out();
FitManager fm = new FitManager();

View File

@ -13,23 +13,25 @@ import hep.dataforge.data.DataTree;
import hep.dataforge.meta.Meta;
import hep.dataforge.meta.Template;
import hep.dataforge.tables.Table;
import hep.dataforge.tables.TransformTableAction;
import hep.dataforge.workspace.GenericTask;
import hep.dataforge.workspace.TaskModel;
import hep.dataforge.workspace.TaskState;
import inr.numass.actions.MergeDataAction;
import inr.numass.actions.MonitorCorrectAction;
import inr.numass.actions.PrepareDataAction;
import inr.numass.actions.ReadNumassStorageAction;
import inr.numass.storage.NumassData;
/**
* Prepare data task
*
* Prepare data task
*
* @author Alexander Nozik
*/
public class NumassPrepareTask extends GenericTask {
/*
<action type="readStorage" uri="file://D:\Work\Numass\data\2016_04\T2_data\">
<action type="readStorage" uri="file://D:\Work\Numass\data\2016_04\T2_data\">
<include pattern="Fill_2*"/>
<exclude pattern="Fill_2_4_Empty*"/>
<exclude pattern="Fill_2_1.set_1*"/>
@ -54,20 +56,34 @@ public class NumassPrepareTask extends GenericTask {
Meta prepareMeta = Template.compileTemplate(config.getNode("prepare"), config);
DataNode<Table> tables = runAction(new PrepareDataAction(), callback, context, data, prepareMeta);
state.setData("prepare", tables);
if (config.hasNode("monitor")) {
Meta monitorMeta = Template.compileTemplate(config.getNode("monitor"), config);
tables = runAction(new MonitorCorrectAction(), callback, context, tables, monitorMeta);
state.setData("monitor", tables);
}
//merging if needed
if (config.hasNode("merge")) {
DataTree.Builder resultBuilder = DataTree.builder(Table.class);
tables.dataStream().forEach(pair -> resultBuilder.putData(pair.getKey(), pair.getValue()));
DataNode<Table> finalTables = tables;
config.getNodes("merge").forEach(mergeNode -> {
Meta mergeMeta = Template.compileTemplate(mergeNode, config);
DataNode<Table> mergeData = runAction(new MergeDataAction(), callback, context, tables, mergeMeta);
DataNode<Table> mergeData = runAction(new MergeDataAction(), callback, context, finalTables, mergeMeta);
mergeData.dataStream().forEach(pair -> {
resultBuilder.putData("merge." + pair.getKey(), pair.getValue());
});
});
} else {
state.finish(tables);
tables = resultBuilder.build();
}
if (config.hasNode("transform")) {
Meta filterMeta = Template.compileTemplate(config.getNode("transform"), config);
tables = runAction(new TransformTableAction(), callback, context, tables, filterMeta);
}
state.finish(tables);
return state;
}