MetaMorph redone

This commit is contained in:
Alexander Nozik 2018-01-14 22:29:03 +03:00
parent 01c910682e
commit dc27bbb659
19 changed files with 34 additions and 43 deletions

View File

@ -3,7 +3,7 @@ package inr.numass.control.cryotemp
import hep.dataforge.control.devices.Sensor
import hep.dataforge.control.measurements.Measurement
import hep.dataforge.control.measurements.MeasurementListener
import hep.dataforge.description.DescriptorUtils
import hep.dataforge.description.Descriptors
import hep.dataforge.fx.bindWindow
import hep.dataforge.fx.dfIconView
import hep.dataforge.fx.fragments.LogFragment
@ -142,7 +142,7 @@ class PKT8Display : DeviceDisplay<PKT8Device>(), MeasurementListener {
private val plotFrame: PlotFrame by lazy {
JFreeChartFrame(plotFrameMeta).apply {
plots.descriptor = DescriptorUtils.buildDescriptor(TimePlot::class.java)
plots.descriptor = Descriptors.buildDescriptor(TimePlot::class.java)
PlotUtils.setXAxis(this, "timestamp", null, "time")
}
}

View File

@ -145,7 +145,7 @@ class TimeAnalyzer @JvmOverloads constructor(private val processor: SignalProces
if (cr < meta.getDouble("t0.minCR", 0.0)) {
0
} else {
Math.max(-1e9 / cr * Math.log(1.0 - fraction), meta.getDouble("t0.min", 0.0)!!).toInt()
Math.max(-1e9 / cr * Math.log(1.0 - fraction), meta.getDouble("t0.min", 0.0)).toInt()
}
} else {
0

View File

@ -17,7 +17,7 @@ package inr.numass.scripts
import hep.dataforge.maths.integration.UnivariateIntegrator
import hep.dataforge.plots.PlotFrame
import hep.dataforge.plots.data.XYFunctionPlot
import hep.dataforge.plots.XYFunctionPlot
import hep.dataforge.plots.jfreechart.JFreeChartFrame
import hep.dataforge.stat.fit.ParamSet
import inr.numass.models.LossCalculator

View File

@ -17,7 +17,7 @@ package inr.numass.scripts
import hep.dataforge.io.PrintFunction
import hep.dataforge.maths.integration.UnivariateIntegrator
import hep.dataforge.plots.data.XYFunctionPlot
import hep.dataforge.plots.XYFunctionPlot
import hep.dataforge.plots.jfreechart.JFreeChartFrame
import hep.dataforge.stat.fit.ParamSet
import inr.numass.models.ExperimentalVariableLossSpectrum

View File

@ -15,7 +15,7 @@
*/
package inr.numass.scripts
import hep.dataforge.plots.data.XYFunctionPlot
import hep.dataforge.plots.XYFunctionPlot
import hep.dataforge.plots.jfreechart.JFreeChartFrame
import org.apache.commons.math3.analysis.UnivariateFunction

View File

@ -6,7 +6,6 @@ import hep.dataforge.grind.Grind
import hep.dataforge.grind.GrindShell
import hep.dataforge.grind.helpers.PlotHelper
import hep.dataforge.stat.fit.ParamSet
import hep.dataforge.utils.MetaMorph
import hep.dataforge.values.Values
import inr.numass.NumassPlugin
import inr.numass.models.FSS

View File

@ -2,7 +2,7 @@ package inr.numass.scripts.temp
import hep.dataforge.context.Context
import hep.dataforge.context.Global
import hep.dataforge.description.DescriptorUtils
import hep.dataforge.description.Descriptors
import hep.dataforge.fx.plots.PlotManager
import hep.dataforge.grind.Grind
import hep.dataforge.grind.GrindShell
@ -63,7 +63,7 @@ new GrindShell(ctx).eval {
PlotFrame frame = (plots as PlotHelper).getManager().getPlotFrame("test", "spectra")
frame.plots.setDescriptor(DescriptorUtils.buildDescriptor(DataPlot))
frame.plots.setDescriptor(Descriptors.buildDescriptor(DataPlot))
frame.plots.configure(showErrors: false, showSymbol: false, showLine: true, connection: "step")
joined.points.filter { it.voltage in [14000d, 15000d, 16000d, 17000d, 18000d] }.forEach {
@ -75,7 +75,7 @@ new GrindShell(ctx).eval {
// def point = joined.points.find { it.voltage == 14000d } as NumassPoint
// PlotFrame pointFrame = (plots as PlotHelper).getManager().getPlotFrame("test", "14000")
//
// pointFrame.plots.setDescriptor(DescriptorUtils.buildDescriptor(DataPlot))
// pointFrame.plots.setDescriptor(Descriptors.buildDescriptor(DataPlot))
// pointFrame.plots.configure(showErrors: false, showSymbol: false, showLine: true, connection: "step")
//
// [0, 5, 10,15,20].forEach{

View File

@ -19,13 +19,12 @@ import hep.dataforge.actions.OneToOneAction;
import hep.dataforge.context.Context;
import hep.dataforge.description.NodeDef;
import hep.dataforge.description.TypedActionDef;
import hep.dataforge.description.ValueDef;
import hep.dataforge.meta.Laminate;
import hep.dataforge.meta.Meta;
import hep.dataforge.plots.PlotFrame;
import hep.dataforge.plots.PlotUtils;
import hep.dataforge.plots.XYFunctionPlot;
import hep.dataforge.plots.data.DataPlot;
import hep.dataforge.plots.data.XYFunctionPlot;
import hep.dataforge.stat.fit.FitResult;
import hep.dataforge.stat.fit.FitState;
import hep.dataforge.stat.models.XYModel;
@ -41,7 +40,6 @@ import java.util.stream.StreamSupport;
*/
@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 frame.")
public class PlotFitResultAction extends OneToOneAction<FitResult, FitResult> {
@Override

View File

@ -19,7 +19,7 @@ import hep.dataforge.actions.ActionManager;
import hep.dataforge.context.Context;
import hep.dataforge.context.Global;
import hep.dataforge.description.ActionDescriptor;
import hep.dataforge.description.DescriptorUtils;
import hep.dataforge.description.Descriptors;
import hep.dataforge.exceptions.DescriptorException;
import hep.dataforge.io.markup.MarkupBuilder;
import hep.dataforge.io.markup.MarkupUtils;
@ -48,7 +48,7 @@ public class Numass {
.ln()
.text("\t")
.content(
MarkupUtils.INSTANCE.markupDescriptor(DescriptorUtils.buildDescriptor("method::hep.dataforge.data.DataManager.read"))
MarkupUtils.INSTANCE.markupDescriptor(Descriptors.buildDescriptor("method::hep.dataforge.data.DataManager.read"))
)
.ln()
.text("***Allowed actions***", "red")

View File

@ -18,7 +18,6 @@ package inr.numass.actions;
import hep.dataforge.actions.OneToOneAction;
import hep.dataforge.context.Context;
import hep.dataforge.description.TypedActionDef;
import hep.dataforge.description.ValueDef;
import hep.dataforge.exceptions.ContentException;
import hep.dataforge.meta.Laminate;
import hep.dataforge.meta.Meta;
@ -41,15 +40,10 @@ import java.util.Map.Entry;
import java.util.TreeMap;
import java.util.concurrent.CopyOnWriteArrayList;
import static hep.dataforge.values.ValueType.NUMBER;
/**
* @author Darksnake
*/
@TypedActionDef(name = "monitor", inputType = Table.class, outputType = Table.class)
@ValueDef(name = "monitorPoint", type = {NUMBER}, required = true, info = "The Uset for monitor point")
@ValueDef(name = "monitorFile", info = "The outputfile for monitor points", def = "monitor.onComplete")
@ValueDef(name = "calculateRelative", info = "Calculate count rate relative to average monitor point", def = "false")
public class MonitorCorrectAction extends OneToOneAction<Table, Table> {
//private static final String[] monitorNames = {"timestamp", NumassAnalyzer.COUNT_KEY, NumassAnalyzer.COUNT_RATE_KEY, NumassAnalyzer.COUNT_RATE_KEY};

View File

@ -19,7 +19,7 @@ import hep.dataforge.maths.functions.FunctionCaching;
import hep.dataforge.maths.integration.GaussRuleIntegrator;
import hep.dataforge.maths.integration.UnivariateIntegrator;
import hep.dataforge.plots.PlotFrame;
import hep.dataforge.plots.data.XYFunctionPlot;
import hep.dataforge.plots.XYFunctionPlot;
import hep.dataforge.utils.Misc;
import hep.dataforge.values.Values;
import org.apache.commons.math3.analysis.BivariateFunction;
@ -180,12 +180,12 @@ public class LossCalculator {
final LossCalculator loss = LossCalculator.instance;
final List<Double> probs = loss.getGunLossProbabilities(set.getDouble("X"));
UnivariateFunction single = (double e) -> probs.get(1) * scatterFunction.value(e);
frame.add(XYFunctionPlot.plotFunction("Single scattering", 0, 100, 1000, single::value));
frame.add(XYFunctionPlot.Companion.plot("Single scattering", 0, 100, 1000, single::value));
for (int i = 2; i < probs.size(); i++) {
final int j = i;
UnivariateFunction scatter = (double e) -> probs.get(j) * loss.getLossValue(j, e, 0d);
frame.add(XYFunctionPlot.plotFunction(j + " scattering", 0, 100, 1000, scatter::value));
frame.add(XYFunctionPlot.Companion.plot(j + " scattering", 0, 100, 1000, scatter::value));
}
UnivariateFunction total = (eps) -> {
@ -199,11 +199,11 @@ public class LossCalculator {
return sum;
};
frame.add(XYFunctionPlot.plotFunction("Total loss", 0, 100, 1000, total::value));
frame.add(XYFunctionPlot.Companion.plot("Total loss", 0, 100, 1000, total::value));
} else {
frame.add(XYFunctionPlot.plotFunction("Differential crosssection", 0, 100, 2000, scatterFunction::value));
frame.add(XYFunctionPlot.Companion.plot("Differential crosssection", 0, 100, 2000, scatterFunction::value));
}
}

View File

@ -27,8 +27,8 @@ import hep.dataforge.io.IOManager
import hep.dataforge.meta.Meta
import hep.dataforge.names.Name
import hep.dataforge.plots.PlotUtils
import hep.dataforge.plots.XYFunctionPlot
import hep.dataforge.plots.data.DataPlot
import hep.dataforge.plots.data.XYFunctionPlot
import hep.dataforge.stat.fit.FitResult
import hep.dataforge.stat.models.XYModel
import hep.dataforge.tables.Adapters

View File

@ -4,7 +4,7 @@ import hep.dataforge.fx.plots.PlotManager
import hep.dataforge.kodex.buildMeta
import hep.dataforge.kodex.global
import hep.dataforge.maths.chain.Chain
import hep.dataforge.plots.data.XYFunctionPlot
import hep.dataforge.plots.XYFunctionPlot
import hep.dataforge.stat.PolynomialDistribution
import hep.dataforge.stat.fit.ParamSet
import inr.numass.NumassPlugin
@ -37,14 +37,14 @@ fun main(args: Array<String>) {
val sp = SterileNeutrinoSpectrum(global, meta)
val spectrumPlot = XYFunctionPlot.plotFunction("spectrum", 14000.0, 18600.0, 500) {
val spectrumPlot = XYFunctionPlot.plot("spectrum", 14000.0, 18600.0, 500) {
sp.value(it, allPars)
}
val distribution = PolynomialDistribution(0.0, 5000.0, 3.0);
val distributionPlot = XYFunctionPlot.plotFunction("distribution", 14000.0, 18500.0, 500) {
50*distribution.density(18575.0 - it)
val distributionPlot = XYFunctionPlot.plot("distribution", 14000.0, 18500.0, 500) {
50*distribution.density(18600.0 - it)
}
pm.getPlotFrame("beta").apply {

View File

@ -16,7 +16,7 @@
package inr.numass.scripts
import hep.dataforge.description.DescriptorUtils
import hep.dataforge.description.Descriptors
import hep.dataforge.fx.plots.PlotManager
import hep.dataforge.kodex.buildContext
import hep.dataforge.kodex.buildMeta
@ -61,7 +61,7 @@ fun main(args: Array<String>) {
val plots = context.getFeature(PlotManager::class.java)
val frame = plots.getPlotFrame("differential").apply {
this.plots.descriptor = DescriptorUtils.buildDescriptor(DataPlot::class)
this.plots.descriptor = Descriptors.buildDescriptor(DataPlot::class)
this.plots.configureValue("showLine", true)
}

View File

@ -16,7 +16,7 @@
package inr.numass.scripts
import hep.dataforge.description.DescriptorUtils
import hep.dataforge.description.Descriptors
import hep.dataforge.fx.plots.PlotManager
import hep.dataforge.kodex.buildContext
import hep.dataforge.kodex.buildMeta
@ -68,7 +68,7 @@ fun main(args: Array<String>) {
for (hv in arrayOf(14000.0, 14500.0, 15000.0, 15500.0, 16050.0)) {
val frame = plots.getPlotFrame("integral[$hv]").apply {
this.plots.descriptor = DescriptorUtils.buildDescriptor(DataPlot::class)
this.plots.descriptor = Descriptors.buildDescriptor(DataPlot::class)
this.plots.configureValue("showLine", true)
}

View File

@ -16,7 +16,7 @@
package inr.numass.scripts
import hep.dataforge.description.DescriptorUtils
import hep.dataforge.description.Descriptors
import hep.dataforge.fx.plots.PlotManager
import hep.dataforge.kodex.buildContext
import hep.dataforge.kodex.buildMeta
@ -50,7 +50,7 @@ fun main(args: Array<String>) {
val point = ProtoNumassPoint.readFile(Paths.get("D:\\Work\\Numass\\data\\2017_05_frames\\Fill_3_events\\set_33\\p36(30s)(HV1=17000).df"))
val frame = plots.getPlotFrame("integral").apply {
this.plots.descriptor = DescriptorUtils.buildDescriptor(DataPlot::class)
this.plots.descriptor = Descriptors.buildDescriptor(DataPlot::class)
this.plots.configureValue("showLine", true)
}

View File

@ -14,8 +14,8 @@ import hep.dataforge.meta.Meta
import hep.dataforge.meta.MetaUtils
import hep.dataforge.plots.PlotFrame
import hep.dataforge.plots.PlotUtils
import hep.dataforge.plots.XYFunctionPlot
import hep.dataforge.plots.data.DataPlot
import hep.dataforge.plots.data.XYFunctionPlot
import hep.dataforge.plots.jfreechart.JFreeChartFrame
import hep.dataforge.stat.fit.FitHelper
import hep.dataforge.stat.fit.FitResult

View File

@ -17,7 +17,7 @@ package inr.numass.models;
import hep.dataforge.maths.integration.GaussRuleIntegrator;
import hep.dataforge.plots.PlotFrame;
import hep.dataforge.plots.data.XYFunctionPlot;
import hep.dataforge.plots.XYFunctionPlot;
import inr.numass.NumassPluginKt;
import org.apache.commons.math3.analysis.UnivariateFunction;
@ -41,8 +41,8 @@ public class TestNeLossParametrisation {
System.out.println(norm);
frame.add(XYFunctionPlot.plotFunction("old", 0, 30, 300, oldFunction::value));
frame.add(XYFunctionPlot.plotFunction("new", 0, 30, 300, newFunction::value));
frame.add(XYFunctionPlot.Companion.plot("old", 0, 30, 300, oldFunction::value));
frame.add(XYFunctionPlot.Companion.plot("new", 0, 30, 300, newFunction::value));
}
public static UnivariateFunction getSingleScatterFunction(

View File

@ -16,8 +16,8 @@
package inr.numass.models;
import hep.dataforge.context.Global;
import hep.dataforge.plots.XYFunctionPlot;
import hep.dataforge.plots.data.DataPlot;
import hep.dataforge.plots.data.XYFunctionPlot;
import hep.dataforge.plots.jfreechart.JFreeChartFrame;
import inr.numass.NumassPluginKt;
@ -33,7 +33,7 @@ public class TransmissionInterpolatorTest {
TransmissionInterpolator interpolator = TransmissionInterpolator.fromFile(Global.instance(),
"d:\\sterile-new\\loss2014-11\\.dataforge\\merge\\empty_sum.onComplete", "Uset", "CR", 15, 0.8, 19002d);
frame.add(DataPlot.plot("data", interpolator.getX(), interpolator.getY()));
frame.add(XYFunctionPlot.plotFunction("interpolated", interpolator.getXmin(), interpolator.getXmax(), 2000, interpolator::value));
frame.add(XYFunctionPlot.Companion.plot("interpolated", interpolator.getXmin(), interpolator.getXmax(), 2000, interpolator::value));
// PrintFunction.printFuntionSimple(new PrintWriter(System.onComplete), interpolator, interpolator.getXmin(), interpolator.getXmax(), 500);
}