[no commit message]
This commit is contained in:
parent
ac8340006d
commit
36fd859c8e
@ -24,7 +24,6 @@ import hep.dataforge.description.NodeDef;
|
||||
import hep.dataforge.description.TypedActionDef;
|
||||
import hep.dataforge.description.ValueDef;
|
||||
import hep.dataforge.exceptions.ContentException;
|
||||
import hep.dataforge.io.log.Logable;
|
||||
import hep.dataforge.meta.Laminate;
|
||||
import hep.dataforge.meta.Meta;
|
||||
import hep.dataforge.plots.PlotsPlugin;
|
||||
@ -34,22 +33,23 @@ import hep.dataforge.plots.data.PlottableFunction;
|
||||
import org.apache.commons.math3.analysis.UnivariateFunction;
|
||||
import hep.dataforge.tables.PointSource;
|
||||
import hep.dataforge.tables.Table;
|
||||
import hep.dataforge.io.reports.Reportable;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author darksnake
|
||||
*/
|
||||
@TypedActionDef(name = "plotFit", description = "Plot fit result", inputType = FitState.class, outputType = FitState.class)
|
||||
@TypedActionDef(name = "plotFit", info = "Plot fit result", inputType = FitState.class, outputType = FitState.class)
|
||||
@NodeDef(name = "adapter", info = "adapter for DataSet being fitted. By default is taken from model.")
|
||||
@ValueDef(name = "plotTitle", def = "", info = "The title of the plot.")
|
||||
public class PlotFitResultAction extends OneToOneAction<FitState, FitState> {
|
||||
|
||||
@Override
|
||||
protected FitState execute(Context context,Logable log, String name, Laminate metaData, FitState input) {
|
||||
protected FitState execute(Context context,Reportable log, String name, Laminate metaData, FitState input) {
|
||||
|
||||
PointSource data = input.getDataSet();
|
||||
if (!(input.getModel() instanceof XYModel)) {
|
||||
log.logError("The fit model should be instance of XYModel for this action. Action failed!");
|
||||
log.reportError("The fit model should be instance of XYModel for this action. Action failed!");
|
||||
return input;
|
||||
}
|
||||
XYModel model = (XYModel) input.getModel();
|
||||
|
@ -43,6 +43,18 @@ import static java.util.Locale.setDefault;
|
||||
import static java.util.Locale.setDefault;
|
||||
import static java.util.Locale.setDefault;
|
||||
import static java.util.Locale.setDefault;
|
||||
import static java.util.Locale.setDefault;
|
||||
import static java.util.Locale.setDefault;
|
||||
import static java.util.Locale.setDefault;
|
||||
import static java.util.Locale.setDefault;
|
||||
import static java.util.Locale.setDefault;
|
||||
import static java.util.Locale.setDefault;
|
||||
import static java.util.Locale.setDefault;
|
||||
import static java.util.Locale.setDefault;
|
||||
import static java.util.Locale.setDefault;
|
||||
import static java.util.Locale.setDefault;
|
||||
import static java.util.Locale.setDefault;
|
||||
import static java.util.Locale.setDefault;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -11,13 +11,13 @@ import hep.dataforge.tables.DataPoint;
|
||||
import hep.dataforge.tables.ListTable;
|
||||
import hep.dataforge.tables.MapPoint;
|
||||
import hep.dataforge.description.TypedActionDef;
|
||||
import hep.dataforge.io.log.Logable;
|
||||
import hep.dataforge.meta.Laminate;
|
||||
import hep.dataforge.meta.Meta;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import hep.dataforge.tables.PointSource;
|
||||
import hep.dataforge.tables.Table;
|
||||
import hep.dataforge.io.reports.Reportable;
|
||||
|
||||
/**
|
||||
* Adjust errors for all numass points in the dataset
|
||||
@ -28,7 +28,7 @@ import hep.dataforge.tables.Table;
|
||||
public class AdjustErrorsAction extends OneToOneAction<Table, Table> {
|
||||
|
||||
@Override
|
||||
protected Table execute(Context context, Logable log, String name, Laminate meta, Table input) {
|
||||
protected Table execute(Context context, Reportable log, String name, Laminate meta, Table input) {
|
||||
List<DataPoint> points = new ArrayList<>();
|
||||
for (DataPoint dp : input) {
|
||||
points.add(evalPoint(meta, dp));
|
||||
|
@ -20,13 +20,13 @@ import hep.dataforge.context.Context;
|
||||
import hep.dataforge.description.TypedActionDef;
|
||||
import hep.dataforge.description.ValueDef;
|
||||
import hep.dataforge.exceptions.ContentException;
|
||||
import hep.dataforge.io.log.Logable;
|
||||
import hep.dataforge.meta.Laminate;
|
||||
import inr.numass.data.RawNMFile;
|
||||
import inr.numass.data.RawNMPoint;
|
||||
import inr.numass.debunch.DebunchReport;
|
||||
import inr.numass.debunch.FrameAnalizer;
|
||||
import java.io.PrintWriter;
|
||||
import hep.dataforge.io.reports.Reportable;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -41,8 +41,8 @@ import java.io.PrintWriter;
|
||||
public class DebunchAction extends OneToOneAction<RawNMFile, RawNMFile> {
|
||||
|
||||
@Override
|
||||
protected RawNMFile execute(Context context, Logable log, String name, Laminate meta, RawNMFile source) throws ContentException {
|
||||
log.log("File {} started", source.getName());
|
||||
protected RawNMFile execute(Context context, Reportable log, String name, Laminate meta, RawNMFile source) throws ContentException {
|
||||
log.report("File {} started", source.getName());
|
||||
|
||||
int upper = meta.getInt("upperchanel", RawNMPoint.MAX_CHANEL);
|
||||
int lower = meta.getInt("lowerchanel", 0);
|
||||
@ -57,7 +57,7 @@ public class DebunchAction extends OneToOneAction<RawNMFile, RawNMFile> {
|
||||
if (cr < maxCR) {
|
||||
DebunchReport report = new FrameAnalizer(rejectionprob, framelength, lower, upper).debunchPoint(point);
|
||||
|
||||
log.log("Debunching file '{}', point '{}': {} percent events {} percent time in bunches",
|
||||
log.report("Debunching file '{}', point '{}': {} percent events {} percent time in bunches",
|
||||
source.getName(), point.getUset(), report.eventsFiltred() * 100, report.timeFiltred() * 100);
|
||||
point = report.getPoint();
|
||||
}
|
||||
@ -65,9 +65,9 @@ public class DebunchAction extends OneToOneAction<RawNMFile, RawNMFile> {
|
||||
}).forEach((point) -> {
|
||||
res.putPoint(point);
|
||||
});
|
||||
log.log("File {} completed", source.getName());
|
||||
log.report("File {} completed", source.getName());
|
||||
|
||||
log.getLog().print(new PrintWriter(buildActionOutput(context, name)));
|
||||
log.getReport().print(new PrintWriter(buildActionOutput(context, name)));
|
||||
|
||||
// res.configure(source.meta());
|
||||
return res;
|
||||
|
@ -20,12 +20,12 @@ import hep.dataforge.context.Context;
|
||||
import hep.dataforge.description.TypedActionDef;
|
||||
import hep.dataforge.exceptions.ContentException;
|
||||
import hep.dataforge.io.ColumnedDataWriter;
|
||||
import hep.dataforge.io.log.Logable;
|
||||
import hep.dataforge.meta.Laminate;
|
||||
import hep.dataforge.meta.Meta;
|
||||
import inr.numass.data.NMFile;
|
||||
import inr.numass.data.NMPoint;
|
||||
import java.io.OutputStream;
|
||||
import hep.dataforge.io.reports.Reportable;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -35,8 +35,8 @@ import java.io.OutputStream;
|
||||
public class FindBorderAction extends OneToOneAction<NMFile, NMFile> {
|
||||
|
||||
@Override
|
||||
protected NMFile execute(Context context, Logable log, String name, Laminate meta, NMFile source) throws ContentException {
|
||||
log.log("File {} started", source.getName());
|
||||
protected NMFile execute(Context context, Reportable log, String name, Laminate meta, NMFile source) throws ContentException {
|
||||
log.report("File {} started", source.getName());
|
||||
|
||||
int upperBorder = meta.getInt("upper", 4096);
|
||||
int lowerBorder = meta.getInt("lower", 0);
|
||||
@ -46,7 +46,7 @@ public class FindBorderAction extends OneToOneAction<NMFile, NMFile> {
|
||||
if (substractReference > 0) {
|
||||
referencePoint = source.getByUset(substractReference);
|
||||
if (referencePoint == null) {
|
||||
log.log("Reference point {} not found", substractReference);
|
||||
log.report("Reference point {} not found", substractReference);
|
||||
}
|
||||
}
|
||||
|
||||
@ -56,7 +56,7 @@ public class FindBorderAction extends OneToOneAction<NMFile, NMFile> {
|
||||
|
||||
ColumnedDataWriter.writeDataSet(stream, bData, String.format("%s : lower = %d upper = %d", source.getName(), lowerBorder, upperBorder));
|
||||
|
||||
log.log("File {} completed", source.getName());
|
||||
log.report("File {} completed", source.getName());
|
||||
return source;
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,6 @@ import hep.dataforge.data.DataNode;
|
||||
import hep.dataforge.description.NodeDef;
|
||||
import hep.dataforge.description.TypedActionDef;
|
||||
import hep.dataforge.io.ColumnedDataWriter;
|
||||
import hep.dataforge.io.log.Logable;
|
||||
import hep.dataforge.meta.Meta;
|
||||
import hep.dataforge.meta.MetaBuilder;
|
||||
import hep.dataforge.tables.DataPoint;
|
||||
@ -36,12 +35,13 @@ import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import hep.dataforge.tables.Table;
|
||||
import hep.dataforge.io.reports.Reportable;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Darksnake
|
||||
*/
|
||||
@TypedActionDef(name = "merge", inputType = Table.class, outputType = Table.class, description = "Merge different numass data files into one.")
|
||||
@TypedActionDef(name = "merge", inputType = Table.class, outputType = Table.class, info = "Merge different numass data files into one.")
|
||||
@NodeDef(name = "grouping", info = "The defenition of grouping rule for this merge", target = "method::hep.dataforge.actions.GroupBuilder.byAnnotation")
|
||||
public class MergeDataAction extends ManyToOneAction<Table, Table> {
|
||||
|
||||
@ -62,13 +62,13 @@ public class MergeDataAction extends ManyToOneAction<Table, Table> {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Table execute(Context context, Logable log, String nodeName, Map<String, Table> data, Meta meta) {
|
||||
protected Table execute(Context context, Reportable log, String nodeName, Map<String, Table> data, Meta meta) {
|
||||
Table res = mergeDataSets(nodeName, data.values());
|
||||
return new ListTable(res.getFormat(),res.sort("Uset", true));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void afterGroup(Context context, Logable log, String groupName, Meta outputMeta, Table output) {
|
||||
protected void afterGroup(Context context, Reportable log, String groupName, Meta outputMeta, Table output) {
|
||||
OutputStream stream = buildActionOutput(context, groupName);
|
||||
ColumnedDataWriter.writeDataSet(stream, output, outputMeta.toString());
|
||||
}
|
||||
@ -76,7 +76,7 @@ public class MergeDataAction extends ManyToOneAction<Table, Table> {
|
||||
@Override
|
||||
protected MetaBuilder outputMeta(DataNode<Table> input) {
|
||||
|
||||
String numassPath = input.stream().<String>map(item -> item.getValue().meta().getString("numass.path", null))
|
||||
String numassPath = input.dataStream().<String>map(item -> item.getValue().meta().getString("numass.path", null))
|
||||
.reduce("", (String path, String newPath) -> {
|
||||
if (path == null) {
|
||||
return null;
|
||||
|
@ -24,7 +24,6 @@ import hep.dataforge.description.TypedActionDef;
|
||||
import hep.dataforge.description.ValueDef;
|
||||
import hep.dataforge.exceptions.ContentException;
|
||||
import hep.dataforge.io.ColumnedDataWriter;
|
||||
import hep.dataforge.io.log.Logable;
|
||||
import hep.dataforge.meta.Laminate;
|
||||
import hep.dataforge.meta.Meta;
|
||||
import hep.dataforge.values.Value;
|
||||
@ -38,6 +37,7 @@ import java.util.TreeMap;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import hep.dataforge.tables.PointSource;
|
||||
import hep.dataforge.tables.Table;
|
||||
import hep.dataforge.io.reports.Reportable;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -55,13 +55,13 @@ public class MonitorCorrectAction extends OneToOneAction<Table, Table> {
|
||||
//FIXME remove from state
|
||||
|
||||
@Override
|
||||
protected Table execute(Context context, Logable log, String name, Laminate meta, Table sourceData) throws ContentException {
|
||||
protected Table execute(Context context, Reportable log, String name, Laminate meta, Table sourceData) throws ContentException {
|
||||
|
||||
double monitor = meta.getDouble("monitorPoint", Double.NaN);
|
||||
|
||||
TreeMap<LocalDateTime, DataPoint> index = getMonitorIndex(monitor, sourceData);
|
||||
if (index.isEmpty()) {
|
||||
log.logError("No monitor points found");
|
||||
log.reportError("No monitor points found");
|
||||
return sourceData;
|
||||
}
|
||||
double norm = 0;
|
||||
|
@ -26,7 +26,6 @@ import hep.dataforge.description.ValueDef;
|
||||
import hep.dataforge.exceptions.ContentException;
|
||||
import hep.dataforge.io.ColumnedDataWriter;
|
||||
import hep.dataforge.io.XMLMetaWriter;
|
||||
import hep.dataforge.io.log.Logable;
|
||||
import hep.dataforge.meta.Laminate;
|
||||
import hep.dataforge.meta.Meta;
|
||||
import inr.numass.data.NMFile;
|
||||
@ -37,6 +36,7 @@ import java.time.Instant;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import hep.dataforge.tables.Table;
|
||||
import hep.dataforge.io.reports.Reportable;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -59,7 +59,7 @@ public class PrepareDataAction extends OneToOneAction<NMFile, Table> {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ListTable execute(Context context, Logable log, String name, Laminate meta, NMFile dataFile) {
|
||||
protected ListTable execute(Context context, Reportable log, String name, Laminate meta, NMFile dataFile) {
|
||||
// log.logString("File %s started", dataFile.getName());
|
||||
|
||||
int upper = meta.getInt("upperWindow", RawNMPoint.MAX_CHANEL - 1);
|
||||
|
@ -22,19 +22,19 @@ import hep.dataforge.description.NodeDef;
|
||||
import hep.dataforge.description.TypedActionDef;
|
||||
import hep.dataforge.description.ValueDef;
|
||||
import hep.dataforge.exceptions.ContentException;
|
||||
import hep.dataforge.io.log.Logable;
|
||||
import hep.dataforge.meta.Laminate;
|
||||
import static inr.numass.NumassIO.getNumassData;
|
||||
import inr.numass.data.NMFile;
|
||||
import inr.numass.data.RawNMFile;
|
||||
import java.io.File;
|
||||
import hep.dataforge.io.reports.Reportable;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Darksnake
|
||||
*/
|
||||
@TypedActionDef(name = "readData",
|
||||
inputType = Binary.class, outputType = NMFile.class, description = "Read binary numass data file")
|
||||
inputType = Binary.class, outputType = NMFile.class, info = "Read binary numass data file")
|
||||
@ValueDef(name = "fileName", info = "The name of the file. By default equals file name.")
|
||||
@ValueDef(name = "HVdev", info = "Divider for HV measurements. Should be set to 1.0 for numass data 2014",
|
||||
def = "2.468555393226049", type = "NUMBER")
|
||||
@ -43,7 +43,7 @@ import java.io.File;
|
||||
public class ReadNumassDataAction extends OneToOneAction<Binary, NMFile> {
|
||||
|
||||
@Override
|
||||
protected NMFile execute(Context context, Logable log, String name, Laminate meta, Binary source) throws ContentException {
|
||||
protected NMFile execute(Context context, Reportable log, String name, Laminate meta, Binary source) throws ContentException {
|
||||
// log.logString("File '%s' started", source.getName());
|
||||
RawNMFile raw = getNumassData(source, meta);
|
||||
if (meta.getBoolean("paw", false)) {
|
||||
|
@ -28,7 +28,6 @@ import hep.dataforge.datafitter.models.Histogram;
|
||||
import hep.dataforge.description.TypedActionDef;
|
||||
import hep.dataforge.io.ColumnedDataWriter;
|
||||
import hep.dataforge.io.PrintFunction;
|
||||
import hep.dataforge.io.log.Logable;
|
||||
import hep.dataforge.maths.GridCalculator;
|
||||
import hep.dataforge.maths.NamedDoubleSet;
|
||||
import hep.dataforge.maths.NamedMatrix;
|
||||
@ -54,19 +53,20 @@ import org.apache.commons.math3.stat.StatUtils;
|
||||
import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import hep.dataforge.tables.Table;
|
||||
import hep.dataforge.io.reports.Reportable;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author darksnake
|
||||
*/
|
||||
@TypedActionDef(name = "showLoss", inputType = FitState.class, outputType = FitState.class,
|
||||
description = "Show loss spectrum for fit with loss model. Calculate excitation to ionisation ratio.")
|
||||
info = "Show loss spectrum for fit with loss model. Calculate excitation to ionisation ratio.")
|
||||
public class ShowLossSpectrumAction extends OneToOneAction<FitState, FitState> {
|
||||
|
||||
private static final String[] names = {"X", "exPos", "ionPos", "exW", "ionW", "exIonRatio"};
|
||||
|
||||
@Override
|
||||
protected FitState execute(Context context, Logable log, String name, Laminate meta, FitState input) {
|
||||
protected FitState execute(Context context, Reportable log, String name, Laminate meta, FitState input) {
|
||||
ParamSet pars = input.getParameters();
|
||||
if (!pars.names().contains(names)) {
|
||||
LoggerFactory.getLogger(getClass()).error("Wrong input FitState. Must be loss spectrum fit.");
|
||||
@ -102,9 +102,9 @@ public class ShowLossSpectrumAction extends OneToOneAction<FitState, FitState> {
|
||||
if (calculateRatio) {
|
||||
threshold = meta.getDouble("ionThreshold", 17);
|
||||
ionRatio = calcultateIonRatio(pars, threshold);
|
||||
log.log("The ionization ratio (using threshold {}) is {}", threshold, ionRatio);
|
||||
log.report("The ionization ratio (using threshold {}) is {}", threshold, ionRatio);
|
||||
ionRatioError = calultateIonRatioError(context, name, input, threshold);
|
||||
log.log("the ionization ration standard deviation (using threshold {}) is {}", threshold, ionRatioError);
|
||||
log.report("the ionization ration standard deviation (using threshold {}) is {}", threshold, ionRatioError);
|
||||
}
|
||||
|
||||
if (meta.getBoolean("printResult", false)) {
|
||||
|
@ -20,7 +20,6 @@ import hep.dataforge.context.Context;
|
||||
import hep.dataforge.description.TypedActionDef;
|
||||
import hep.dataforge.exceptions.ContentException;
|
||||
import hep.dataforge.io.ColumnedDataWriter;
|
||||
import hep.dataforge.io.log.Logable;
|
||||
import hep.dataforge.meta.Laminate;
|
||||
import hep.dataforge.meta.Meta;
|
||||
import hep.dataforge.plots.fx.FXPlotUtils;
|
||||
@ -38,6 +37,7 @@ import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer;
|
||||
import org.jfree.data.xy.XYSeries;
|
||||
import org.jfree.data.xy.XYSeriesCollection;
|
||||
import org.jfree.ui.RectangleEdge;
|
||||
import hep.dataforge.io.reports.Reportable;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -47,8 +47,8 @@ import org.jfree.ui.RectangleEdge;
|
||||
public class ShowSpectrumAction extends OneToOneAction<NMFile, NMFile> {
|
||||
|
||||
@Override
|
||||
protected NMFile execute(Context context, Logable log, String name, Laminate meta, NMFile source) throws ContentException {
|
||||
log.log("File {} started", source.getName());
|
||||
protected NMFile execute(Context context, Reportable log, String name, Laminate meta, NMFile source) throws ContentException {
|
||||
log.report("File {} started", source.getName());
|
||||
|
||||
List<NMPoint> printPoints = new ArrayList<>();
|
||||
List<NMPoint> showPoints = new ArrayList<>();
|
||||
@ -78,7 +78,7 @@ public class ShowSpectrumAction extends OneToOneAction<NMFile, NMFile> {
|
||||
|
||||
}
|
||||
|
||||
log.log("File {} completed", source.getName());
|
||||
log.report("File {} completed", source.getName());
|
||||
return source;
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,6 @@ import hep.dataforge.context.Context;
|
||||
import hep.dataforge.description.TypedActionDef;
|
||||
import hep.dataforge.exceptions.ContentException;
|
||||
import hep.dataforge.io.ColumnedDataWriter;
|
||||
import hep.dataforge.io.log.Logable;
|
||||
import hep.dataforge.meta.Laminate;
|
||||
import hep.dataforge.meta.Meta;
|
||||
import inr.numass.data.NMFile;
|
||||
@ -30,6 +29,7 @@ import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.apache.commons.math3.util.Pair;
|
||||
import hep.dataforge.io.reports.Reportable;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -46,7 +46,7 @@ public class SlicingAction extends OneToOneAction<NMFile, NMFile> {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected NMFile execute(Context context, Logable log, String name, Laminate meta, NMFile source) throws ContentException {
|
||||
protected NMFile execute(Context context, Reportable log, String name, Laminate meta, NMFile source) throws ContentException {
|
||||
boolean normalize;
|
||||
Map<String, Pair<Integer, Integer>> slicingConfig;
|
||||
|
||||
@ -66,7 +66,7 @@ public class SlicingAction extends OneToOneAction<NMFile, NMFile> {
|
||||
if (slicingConfig == null) {
|
||||
throw new RuntimeException("Slice configuration not defined");
|
||||
}
|
||||
log.log("File {} started", source.getName());
|
||||
log.report("File {} started", source.getName());
|
||||
|
||||
SlicedData sData = new SlicedData(source, slicingConfig, normalize);
|
||||
|
||||
@ -74,7 +74,7 @@ public class SlicingAction extends OneToOneAction<NMFile, NMFile> {
|
||||
|
||||
ColumnedDataWriter.writeDataSet(stream, sData, null);
|
||||
|
||||
log.log("File {} completed", source.getName());
|
||||
log.report("File {} completed", source.getName());
|
||||
|
||||
return source;
|
||||
}
|
||||
|
@ -26,7 +26,6 @@ import hep.dataforge.tables.MapPoint;
|
||||
import hep.dataforge.datafitter.FitState;
|
||||
import hep.dataforge.description.TypedActionDef;
|
||||
import hep.dataforge.io.ColumnedDataWriter;
|
||||
import hep.dataforge.io.log.Logable;
|
||||
import hep.dataforge.meta.Meta;
|
||||
import hep.dataforge.values.Value;
|
||||
import java.io.OutputStream;
|
||||
@ -34,12 +33,13 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import hep.dataforge.tables.Table;
|
||||
import hep.dataforge.io.reports.Reportable;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Darksnake
|
||||
*/
|
||||
@TypedActionDef(name = "summary", inputType = FitState.class, outputType = Table.class, description = "Generate summary for fit results of different datasets.")
|
||||
@TypedActionDef(name = "summary", inputType = FitState.class, outputType = Table.class, info = "Generate summary for fit results of different datasets.")
|
||||
public class SummaryAction extends ManyToOneAction<FitState, Table> {
|
||||
|
||||
public static final String SUMMARY_NAME = "sumName";
|
||||
@ -58,7 +58,7 @@ public class SummaryAction extends ManyToOneAction<FitState, Table> {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Table execute(Context context, Logable log, String nodeName, Map<String, FitState> input, Meta meta) {
|
||||
protected Table execute(Context context, Reportable log, String nodeName, Map<String, FitState> input, Meta meta) {
|
||||
String[] parNames = meta.getStringArray("parnames");
|
||||
String[] names = new String[2 * parNames.length + 2];
|
||||
names[0] = "file";
|
||||
@ -108,7 +108,7 @@ public class SummaryAction extends ManyToOneAction<FitState, Table> {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void afterGroup(Context context, Logable log, String groupName, Meta outputMeta, Table output) {
|
||||
protected void afterGroup(Context context, Reportable log, String groupName, Meta outputMeta, Table output) {
|
||||
OutputStream stream = buildActionOutput(context, groupName);
|
||||
ColumnedDataWriter.writeDataSet(stream, output, groupName);
|
||||
|
||||
|
@ -31,6 +31,14 @@ import static java.util.Locale.setDefault;
|
||||
import static java.util.Locale.setDefault;
|
||||
import static java.util.Locale.setDefault;
|
||||
import static java.util.Locale.setDefault;
|
||||
import static java.util.Locale.setDefault;
|
||||
import static java.util.Locale.setDefault;
|
||||
import static java.util.Locale.setDefault;
|
||||
import static java.util.Locale.setDefault;
|
||||
import static java.util.Locale.setDefault;
|
||||
import static java.util.Locale.setDefault;
|
||||
import static java.util.Locale.setDefault;
|
||||
import static java.util.Locale.setDefault;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -83,7 +83,6 @@ public class NumassServer extends AbstractNetworkListener {
|
||||
int port = meta().getInt("ratpack.port", 8336);
|
||||
ratpack = RatpackServer.start((RatpackServerSpec server) -> server
|
||||
.serverConfig((ServerConfigBuilder config) -> config
|
||||
// .baseDir(Paths.get(getClass().getClassLoader().getResource("ratpack").toURI()))
|
||||
.baseDir(BaseDir.find())
|
||||
.address(InetAddress.getLocalHost())
|
||||
.port(port))
|
||||
@ -97,8 +96,8 @@ public class NumassServer extends AbstractNetworkListener {
|
||||
|
||||
private void startRun(Meta annotation) throws StorageException {
|
||||
String path = annotation.getString("path", DEFAULT_RUN_PATH);
|
||||
Meta meta = annotation.getNode("meta", null);
|
||||
run = new NumassRun(path, new NumassStorage(root, path, meta), getResponseFactory());
|
||||
//Meta meta = annotation.getNode("meta", null);
|
||||
run = new NumassRun(path, NumassStorage.buildNumassStorage(root, path, false, true), getResponseFactory());
|
||||
getRootState().setValue("numass.current.run", path);
|
||||
}
|
||||
|
||||
@ -142,7 +141,7 @@ public class NumassServer extends AbstractNetworkListener {
|
||||
*/
|
||||
private void updateRun() throws StorageException {
|
||||
String currentRun = getRootState().getString("numass.current.run", DEFAULT_RUN_PATH);
|
||||
this.run = new NumassRun(currentRun, new NumassStorage(root, currentRun, null), getResponseFactory());
|
||||
this.run = new NumassRun(currentRun, NumassStorage.buildNumassStorage(root, currentRun, false, true), getResponseFactory());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -8,6 +8,7 @@ package inr.numass.server;
|
||||
import freemarker.template.Template;
|
||||
import hep.dataforge.exceptions.StorageException;
|
||||
import hep.dataforge.storage.api.ObjectLoader;
|
||||
import hep.dataforge.storage.api.PointLoader;
|
||||
import hep.dataforge.storage.api.Storage;
|
||||
import hep.dataforge.storage.servlet.StorageRatpackHandler;
|
||||
import hep.dataforge.storage.servlet.Utils;
|
||||
@ -67,6 +68,21 @@ public class NumassStorageHandler extends StorageRatpackHandler {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String pointLoaderPlotOptions(PointLoader loader) {
|
||||
if (loader.getName().contains("msp") || loader.getName().contains("vac")) {
|
||||
return " legend: { \n"
|
||||
+ " position: 'bottom' \n"
|
||||
+ " },\n"
|
||||
+ " title: '" + loader.getName() + "',\n"
|
||||
+ " vAxis:{\n"
|
||||
+ " logScale: true\n"
|
||||
+ " }";
|
||||
} else {
|
||||
return super.pointLoaderPlotOptions(loader);
|
||||
}
|
||||
}
|
||||
|
||||
private String render(NumassNote note) {
|
||||
return String.format("<strong id=\"%s\">%s</strong> %s", note.ref(), formatter.format(note.time()), note.content());
|
||||
}
|
||||
|
@ -85,6 +85,14 @@ public class NumassStorage extends FileStorage {
|
||||
}
|
||||
}
|
||||
|
||||
public static NumassStorage buildNumassStorage(FileStorage parent, String path, boolean readOnly, boolean monitor) throws StorageException {
|
||||
Meta meta = new MetaBuilder("storage")
|
||||
.setValue("type", "file.numass")
|
||||
.setValue("readOnly", readOnly)
|
||||
.setValue("monitor", monitor);
|
||||
return new NumassStorage(parent, path, meta);
|
||||
}
|
||||
|
||||
public static NumassStorage buildNumassRoot(String uri, boolean readOnly, boolean monitor) throws StorageException {
|
||||
try {
|
||||
Meta meta = new MetaBuilder("storage")
|
||||
@ -97,7 +105,7 @@ public class NumassStorage extends FileStorage {
|
||||
}
|
||||
}
|
||||
|
||||
public NumassStorage(FileStorage parent, String path, Meta config) throws StorageException {
|
||||
protected NumassStorage(FileStorage parent, String path, Meta config) throws StorageException {
|
||||
super(parent, path, config);
|
||||
super.refresh();
|
||||
//TODO read meta from numass_group_meta to .numass element
|
||||
@ -228,7 +236,7 @@ public class NumassStorage extends FileStorage {
|
||||
}
|
||||
|
||||
public static EventBuilder builder(String source, String fileName, int fileSize) {
|
||||
return new EventBuilder("numass.storage.pushData")
|
||||
return EventBuilder.make("numass.storage.pushData")
|
||||
.setSource(source)
|
||||
.setMetaValue(FILE_NAME_KEY, fileName)
|
||||
.setMetaValue(FILE_SIZE_KEY, fileSize);
|
||||
|
@ -21,7 +21,6 @@ package inr.numass.viewer;
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
import hep.dataforge.context.Context;
|
||||
import hep.dataforge.context.DFProcess;
|
||||
import hep.dataforge.context.ProcessManager;
|
||||
import hep.dataforge.exceptions.StorageException;
|
||||
import hep.dataforge.tables.DataPoint;
|
||||
@ -36,9 +35,6 @@ import hep.dataforge.storage.api.Storage;
|
||||
import hep.dataforge.values.Value;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.stream.StreamSupport;
|
||||
import javafx.application.Platform;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
|
@ -125,9 +125,8 @@ public class NumassLoaderTreeBuilder {
|
||||
callback.updateProgress(-1, 1);
|
||||
callback.updateProgress(0, storage.loaders().size());
|
||||
for (Loader loader : storage.loaders().values()) {
|
||||
callback.updateMessage("Building numass data loader " + loader.getName());
|
||||
|
||||
if (loader instanceof NumassData) {
|
||||
callback.updateMessage("Building numass data loader " + loader.getName());
|
||||
NumassData numassLoader = (NumassData) loader;
|
||||
TreeItem<TreeItemValue> numassLoaderTreeItem = new TreeItem<>(buildValue(numassLoader));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user