Changed plots plugin behaviour from composition to inheritance.
This commit is contained in:
parent
0a261ad466
commit
a768e63831
@ -23,8 +23,8 @@ import hep.dataforge.description.ValueDef;
|
||||
import hep.dataforge.exceptions.ContentException;
|
||||
import hep.dataforge.meta.Laminate;
|
||||
import hep.dataforge.meta.Meta;
|
||||
import hep.dataforge.plots.PlotsPlugin;
|
||||
import hep.dataforge.plots.XYPlotFrame;
|
||||
import hep.dataforge.plots.PlotFrame;
|
||||
import hep.dataforge.plots.PlotUtils;
|
||||
import hep.dataforge.plots.data.PlottableData;
|
||||
import hep.dataforge.plots.data.PlottableXYFunction;
|
||||
import hep.dataforge.stat.fit.FitState;
|
||||
@ -36,7 +36,6 @@ import java.util.function.Function;
|
||||
import java.util.stream.StreamSupport;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author darksnake
|
||||
*/
|
||||
@TypedActionDef(name = "plotFit", info = "Plot fit result", inputType = FitState.class, outputType = FitState.class)
|
||||
@ -65,9 +64,8 @@ public class PlotFitResultAction extends OneToOneAction<FitState, FitState> {
|
||||
|
||||
Function<Double, Double> function = (x) -> model.getSpectrum().value(x, input.getParameters());
|
||||
|
||||
XYPlotFrame frame = (XYPlotFrame) PlotsPlugin
|
||||
.buildFrom(context).buildPlotFrame(getName(), name,
|
||||
metaData.getMeta("plot", Meta.empty()));
|
||||
PlotFrame frame = PlotUtils.getPlotManager(context)
|
||||
.buildPlotFrame(getName(), name, metaData.getMeta("plot", Meta.empty()));
|
||||
|
||||
PlottableXYFunction fit = new PlottableXYFunction("fit");
|
||||
fit.setDensity(100, false);
|
||||
|
@ -12,8 +12,8 @@ import hep.dataforge.io.ColumnedDataWriter;
|
||||
import hep.dataforge.meta.Laminate;
|
||||
import hep.dataforge.meta.Meta;
|
||||
import hep.dataforge.meta.MetaBuilder;
|
||||
import hep.dataforge.plots.PlotsPlugin;
|
||||
import hep.dataforge.plots.XYPlotFrame;
|
||||
import hep.dataforge.plots.PlotFrame;
|
||||
import hep.dataforge.plots.PlotUtils;
|
||||
import hep.dataforge.plots.data.PlottableData;
|
||||
import hep.dataforge.plots.data.XYPlottable;
|
||||
import hep.dataforge.tables.*;
|
||||
@ -82,11 +82,10 @@ public class ShowEnergySpectrumAction extends OneToOneAction<NumassData, Table>
|
||||
ColumnedDataWriter.writeDataSet(out, table, inputMeta.toString());
|
||||
|
||||
if (inputMeta.hasMeta("plot") || inputMeta.getBoolean("plot", false)) {
|
||||
XYPlotFrame frame = (XYPlotFrame) PlotsPlugin
|
||||
.buildFrom(context).buildPlotFrame(getName(), name,
|
||||
PlotFrame frame = PlotUtils.getPlotManager(context)
|
||||
.buildPlotFrame(getName(), name,
|
||||
inputMeta.getMeta("plot", Meta.empty()));
|
||||
fillDetectorData(valueMap).forEach(frame::add);
|
||||
|
||||
}
|
||||
return table;
|
||||
}
|
||||
|
@ -25,8 +25,8 @@ import hep.dataforge.maths.NamedMatrix;
|
||||
import hep.dataforge.maths.integration.UnivariateIntegrator;
|
||||
import hep.dataforge.meta.Laminate;
|
||||
import hep.dataforge.meta.MetaBuilder;
|
||||
import hep.dataforge.plots.PlotsPlugin;
|
||||
import hep.dataforge.plots.XYPlotFrame;
|
||||
import hep.dataforge.plots.PlotFrame;
|
||||
import hep.dataforge.plots.PlotUtils;
|
||||
import hep.dataforge.plots.data.PlottableData;
|
||||
import hep.dataforge.plots.data.PlottableXYFunction;
|
||||
import hep.dataforge.stat.fit.FitState;
|
||||
@ -124,7 +124,7 @@ public class ShowLossSpectrumAction extends OneToOneAction<FitState, FitState> {
|
||||
|
||||
UnivariateFunction scatterFunction;
|
||||
boolean calculateRatio = false;
|
||||
XYPlotFrame frame = (XYPlotFrame) PlotsPlugin.buildFrom(context)
|
||||
PlotFrame frame = PlotUtils.getPlotManager(context)
|
||||
.buildPlotFrame(getName(), name + ".loss",
|
||||
new MetaBuilder("plot")
|
||||
.setValue("plotTitle", "Differential scattering crossection for " + name)
|
||||
@ -266,11 +266,10 @@ public class ShowLossSpectrumAction extends OneToOneAction<FitState, FitState> {
|
||||
|
||||
Histogram hist = new Histogram(0.3, 0.5, 0.002);
|
||||
hist.fill(res);
|
||||
XYPlotFrame frame = (XYPlotFrame) PlotsPlugin.buildFrom(context)
|
||||
PlotFrame frame = PlotUtils.getPlotManager(context)
|
||||
.buildPlotFrame(getName(), name + ".ionRatio",
|
||||
new MetaBuilder("plot").setValue("plotTitle", "Ion ratio Distribution for " + name)
|
||||
);
|
||||
// XYPlotFrame frame = JFreeChartFrame.drawFrame("Ion ratio Distribution for " + name, null);
|
||||
frame.add(PlottableData.plot("ionRatio", new XYAdapter("binCenter", "count"), hist));
|
||||
|
||||
return new DescriptiveStatistics(res).getStandardDeviation();
|
||||
|
@ -17,7 +17,7 @@ package inr.numass.models;
|
||||
|
||||
import hep.dataforge.maths.integration.GaussRuleIntegrator;
|
||||
import hep.dataforge.maths.integration.UnivariateIntegrator;
|
||||
import hep.dataforge.plots.XYPlotFrame;
|
||||
import hep.dataforge.plots.PlotFrame;
|
||||
import hep.dataforge.plots.data.PlottableXYFunction;
|
||||
import hep.dataforge.stat.parametric.FunctionCaching;
|
||||
import hep.dataforge.values.NamedValueSet;
|
||||
@ -153,7 +153,7 @@ public class LossCalculator {
|
||||
return instance;
|
||||
}
|
||||
|
||||
public static void plotScatter(XYPlotFrame frame, NamedValueSet set) {
|
||||
public static void plotScatter(PlotFrame frame, NamedValueSet set) {
|
||||
//"X", "shift", "exPos", "ionPos", "exW", "ionW", "exIonRatio"
|
||||
|
||||
// JFreeChartFrame frame = JFreeChartFrame.drawFrame("Differential scattering crosssection", null);
|
||||
|
@ -7,7 +7,7 @@ package inr.numass;
|
||||
|
||||
import hep.dataforge.context.Context;
|
||||
import hep.dataforge.maths.MathPlugin;
|
||||
import hep.dataforge.plots.PlotsPlugin;
|
||||
import hep.dataforge.plots.PlotUtils;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
@ -27,7 +27,7 @@ public class NumassTest {
|
||||
|
||||
Context context = Numass.buildContext();
|
||||
MathPlugin.buildFrom(context);
|
||||
PlotsPlugin.buildFrom(context);
|
||||
PlotUtils.getPlotManager(context);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user