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 package inr.numass.scripts
import hep.dataforge.fitting.ParamSet
import hep.dataforge.maths.integration.RiemanIntegrator
import hep.dataforge.maths.integration.UnivariateIntegrator import hep.dataforge.maths.integration.UnivariateIntegrator
import hep.dataforge.plots.PlotFrame import hep.dataforge.plots.PlotFrame
import hep.dataforge.plots.data.PlottableXYFunction import hep.dataforge.plots.data.PlottableXYFunction
import hep.dataforge.plots.jfreechart.JFreeChartFrame 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.UnivariateFunction
import org.apache.commons.math3.analysis.solvers.BisectionSolver 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() ParamSet params = new ParamSet()
.setParValue("exPos", 12.76) .setParValue("exPos", 12.76)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -13,37 +13,20 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package inr.numass.scripts; package inr.numass.scripts
import hep.dataforge.context.GlobalContext; import hep.dataforge.context.GlobalContext
import static hep.dataforge.context.GlobalContext.out; import hep.dataforge.grind.GrindMetaBuilder
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.io.FittingIOUtils import hep.dataforge.io.FittingIOUtils
import hep.dataforge.meta.Meta 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 * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package inr.numass.scripts; package inr.numass.scripts
import hep.dataforge.context.GlobalContext; import hep.dataforge.stat.fit.*
import static hep.dataforge.context.GlobalContext.out; import hep.dataforge.stat.models.XYModel
import hep.dataforge.tables.ListTable; import hep.dataforge.tables.ListTable
import hep.dataforge.fitting.FitManager; import inr.numass.data.SpectrumDataAdapter
import hep.dataforge.fitting.FitState; import inr.numass.data.SpectrumGenerator
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 inr.numass.models.BetaSpectrum import inr.numass.models.BetaSpectrum
import inr.numass.models.ModularSpectrum import inr.numass.models.ModularSpectrum
import inr.numass.models.NBkgSpectrum; import inr.numass.models.NBkgSpectrum
import inr.numass.models.ResolutionFunction import inr.numass.models.ResolutionFunction
import inr.numass.utils.DataModelUtils; 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 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 * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package inr.numass.scripts; package inr.numass.scripts
import hep.dataforge.context.GlobalContext; import hep.dataforge.stat.fit.*
import static hep.dataforge.context.GlobalContext.out; import hep.dataforge.stat.models.XYModel
import hep.dataforge.tables.ListTable; import hep.dataforge.tables.ListTable
import hep.dataforge.fitting.FitManager; import inr.numass.data.SpectrumDataAdapter
import hep.dataforge.fitting.FitState; import inr.numass.data.SpectrumGenerator
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 inr.numass.models.BetaSpectrum import inr.numass.models.BetaSpectrum
import inr.numass.models.ModularSpectrum; import inr.numass.models.ModularSpectrum
import inr.numass.models.NBkgSpectrum; import inr.numass.models.NBkgSpectrum
import inr.numass.models.ResolutionFunction import inr.numass.models.ResolutionFunction
import inr.numass.utils.DataModelUtils; 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 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 org.apache.commons.math3.analysis.UnivariateFunction
import inr.numass.Numass import inr.numass.Numass
import hep.dataforge.fitting.ParamSet import hep.dataforge.stat.fit.ParamSet
import hep.dataforge.io.PrintFunction 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 * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package inr.numass.scripts; package inr.numass.scripts
import hep.dataforge.context.GlobalContext; import hep.dataforge.context.GlobalContext
import hep.dataforge.data.DataSet; import hep.dataforge.data.DataSet
import hep.dataforge.tables.ListTable; import hep.dataforge.stat.fit.FitManager
import hep.dataforge.fitting.FitManager; import hep.dataforge.stat.fit.FitState
import hep.dataforge.fitting.FitState; import hep.dataforge.stat.fit.ParamSet
import hep.dataforge.fitting.ParamSet; import hep.dataforge.stat.likelihood.BayesianManager
import hep.dataforge.fitting.models.XYModel; import hep.dataforge.stat.models.XYModel
import hep.dataforge.fitting.likelihood.BayesianManager import hep.dataforge.tables.ListTable
import static hep.dataforge.maths.RandomUtils.setSeed; import inr.numass.data.SpectrumGenerator
import inr.numass.data.SpectrumGenerator;
import inr.numass.models.BetaSpectrum import inr.numass.models.BetaSpectrum
import inr.numass.models.ModularSpectrum import inr.numass.models.ModularSpectrum
import inr.numass.models.NBkgSpectrum; 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 static hep.dataforge.maths.RandomUtils.setSeed
import static inr.numass.utils.DataModelUtils.getUniformSpectrumConfiguration
PrintWriter out = GlobalContext.out(); PrintWriter out = GlobalContext.out();
FitManager fm = new FitManager(); FitManager fm = new FitManager();

View File

@ -13,10 +13,12 @@ import hep.dataforge.data.DataTree;
import hep.dataforge.meta.Meta; import hep.dataforge.meta.Meta;
import hep.dataforge.meta.Template; import hep.dataforge.meta.Template;
import hep.dataforge.tables.Table; import hep.dataforge.tables.Table;
import hep.dataforge.tables.TransformTableAction;
import hep.dataforge.workspace.GenericTask; import hep.dataforge.workspace.GenericTask;
import hep.dataforge.workspace.TaskModel; import hep.dataforge.workspace.TaskModel;
import hep.dataforge.workspace.TaskState; import hep.dataforge.workspace.TaskState;
import inr.numass.actions.MergeDataAction; import inr.numass.actions.MergeDataAction;
import inr.numass.actions.MonitorCorrectAction;
import inr.numass.actions.PrepareDataAction; import inr.numass.actions.PrepareDataAction;
import inr.numass.actions.ReadNumassStorageAction; import inr.numass.actions.ReadNumassStorageAction;
import inr.numass.storage.NumassData; import inr.numass.storage.NumassData;
@ -29,7 +31,7 @@ import inr.numass.storage.NumassData;
public class NumassPrepareTask extends GenericTask { 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*"/> <include pattern="Fill_2*"/>
<exclude pattern="Fill_2_4_Empty*"/> <exclude pattern="Fill_2_4_Empty*"/>
<exclude pattern="Fill_2_1.set_1*"/> <exclude pattern="Fill_2_1.set_1*"/>
@ -54,20 +56,34 @@ public class NumassPrepareTask extends GenericTask {
Meta prepareMeta = Template.compileTemplate(config.getNode("prepare"), config); Meta prepareMeta = Template.compileTemplate(config.getNode("prepare"), config);
DataNode<Table> tables = runAction(new PrepareDataAction(), callback, context, data, prepareMeta); DataNode<Table> tables = runAction(new PrepareDataAction(), callback, context, data, prepareMeta);
state.setData("prepare", tables); 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 //merging if needed
if (config.hasNode("merge")) { if (config.hasNode("merge")) {
DataTree.Builder resultBuilder = DataTree.builder(Table.class); DataTree.Builder resultBuilder = DataTree.builder(Table.class);
tables.dataStream().forEach(pair -> resultBuilder.putData(pair.getKey(), pair.getValue())); tables.dataStream().forEach(pair -> resultBuilder.putData(pair.getKey(), pair.getValue()));
DataNode<Table> finalTables = tables;
config.getNodes("merge").forEach(mergeNode -> { config.getNodes("merge").forEach(mergeNode -> {
Meta mergeMeta = Template.compileTemplate(mergeNode, config); 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 -> { mergeData.dataStream().forEach(pair -> {
resultBuilder.putData("merge." + pair.getKey(), pair.getValue()); resultBuilder.putData("merge." + pair.getKey(), pair.getValue());
}); });
}); });
} else { tables = resultBuilder.build();
state.finish(tables);
} }
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; return state;
} }