Plots structure update

This commit is contained in:
Alexander Nozik 2017-10-11 21:55:48 +03:00
parent 262d5f44d6
commit ad73dc8fe6
17 changed files with 57 additions and 57 deletions

View File

@ -8,7 +8,7 @@ import hep.dataforge.fx.fragments.FragmentWindow
import hep.dataforge.fx.fragments.LogFragment import hep.dataforge.fx.fragments.LogFragment
import hep.dataforge.meta.Meta import hep.dataforge.meta.Meta
import hep.dataforge.plots.PlotUtils import hep.dataforge.plots.PlotUtils
import hep.dataforge.plots.data.TimePlottable import hep.dataforge.plots.data.TimePlot
import hep.dataforge.plots.data.TimePlottableGroup import hep.dataforge.plots.data.TimePlottableGroup
import hep.dataforge.plots.fx.FXPlotFrame import hep.dataforge.plots.fx.FXPlotFrame
import hep.dataforge.plots.fx.PlotContainer import hep.dataforge.plots.fx.PlotContainer
@ -182,7 +182,7 @@ class PKT8ViewConnection : DeviceViewConnection<PKT8Device>(), MeasurementListen
.filter { channel -> !plottables.has(channel.name) } .filter { channel -> !plottables.has(channel.name) }
.forEachOrdered { channel -> .forEachOrdered { channel ->
//plot config from device configuration //plot config from device configuration
val plottable = TimePlottable(channel.name) val plottable = TimePlot(channel.name)
plottable.configure(channel.meta()) plottable.configure(channel.meta())
plottables.add(plottable) plottables.add(plottable)
plotFrame.add(plottable) plotFrame.add(plottable)

View File

@ -24,7 +24,7 @@ import hep.dataforge.fx.fragments.LogFragment
import hep.dataforge.meta.Meta import hep.dataforge.meta.Meta
import hep.dataforge.meta.MetaBuilder import hep.dataforge.meta.MetaBuilder
import hep.dataforge.plots.PlotUtils import hep.dataforge.plots.PlotUtils
import hep.dataforge.plots.data.TimePlottable import hep.dataforge.plots.data.TimePlot
import hep.dataforge.plots.data.TimePlottableGroup import hep.dataforge.plots.data.TimePlottableGroup
import hep.dataforge.plots.fx.FXPlotFrame import hep.dataforge.plots.fx.FXPlotFrame
import hep.dataforge.plots.fx.PlotContainer import hep.dataforge.plots.fx.PlotContainer
@ -93,7 +93,7 @@ class MspViewConnection() : DeviceViewConnection<MspDevice>(), DeviceListener, N
for (peakMeta in plotFrameMeta.getMetaList("peakJump.peak")) { for (peakMeta in plotFrameMeta.getMetaList("peakJump.peak")) {
val mass = peakMeta.getString("mass") val mass = peakMeta.getString("mass")
if (!this.has(mass)) { if (!this.has(mass)) {
val newPlottable = TimePlottable(mass, mass) val newPlottable = TimePlot(mass, mass)
newPlottable.configure(peakMeta) newPlottable.configure(peakMeta)
newPlottable.setMaxItems(1000) newPlottable.setMaxItems(1000)
newPlottable.setPrefItems(400) newPlottable.setPrefItems(400)

View File

@ -1,8 +1,8 @@
package inr.numass.control package inr.numass.control
import hep.dataforge.kodex.KMetaBuilder import hep.dataforge.kodex.KMetaBuilder
import hep.dataforge.plots.Plot
import hep.dataforge.plots.PlotFrame import hep.dataforge.plots.PlotFrame
import hep.dataforge.plots.Plottable
import hep.dataforge.plots.fx.PlotContainer import hep.dataforge.plots.fx.PlotContainer
import hep.dataforge.plots.jfreechart.JFreeChartFrame import hep.dataforge.plots.jfreechart.JFreeChartFrame
import hep.dataforge.values.Value import hep.dataforge.values.Value
@ -139,7 +139,7 @@ fun EventTarget.switch(text: String = "", op: (ToggleSwitch.() -> Unit)? = null)
/** /**
* Add plot * Add plot
*/ */
fun BorderPane.plot(plottables: Iterable<Plottable> = Collections.emptyList(), metaTransform: (KMetaBuilder.() -> Unit)? = null): PlotFrame { fun BorderPane.plot(plottables: Iterable<Plot> = Collections.emptyList(), metaTransform: (KMetaBuilder.() -> Unit)? = null): PlotFrame {
val meta = KMetaBuilder("plotFrame"); val meta = KMetaBuilder("plotFrame");
metaTransform?.invoke(meta) metaTransform?.invoke(meta)
val plot = JFreeChartFrame(meta) val plot = JFreeChartFrame(meta)

View File

@ -12,7 +12,7 @@ import hep.dataforge.control.measurements.Measurement
import hep.dataforge.control.measurements.MeasurementListener import hep.dataforge.control.measurements.MeasurementListener
import hep.dataforge.fx.fragments.FragmentWindow import hep.dataforge.fx.fragments.FragmentWindow
import hep.dataforge.fx.fragments.LogFragment import hep.dataforge.fx.fragments.LogFragment
import hep.dataforge.plots.data.TimePlottable import hep.dataforge.plots.data.TimePlot
import hep.dataforge.plots.data.TimePlottableGroup import hep.dataforge.plots.data.TimePlottableGroup
import hep.dataforge.values.Value import hep.dataforge.values.Value
import inr.numass.control.DeviceViewConnection import inr.numass.control.DeviceViewConnection
@ -67,7 +67,7 @@ class VacCollectorViewConnection : DeviceViewConnection<VacCollectorDevice>() {
private val plottables = TimePlottableGroup().apply { private val plottables = TimePlottableGroup().apply {
viewList.forEach { viewList.forEach {
val plot = TimePlottable(it.getTitle(), it.device.name) val plot = TimePlot(it.getTitle(), it.device.name)
plot.configure(it.device.meta()) plot.configure(it.device.meta())
add(plot) add(plot)
} }

View File

@ -17,7 +17,7 @@ package inr.numass.scripts
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.PlotXYFunction
import hep.dataforge.plots.jfreechart.JFreeChartFrame import hep.dataforge.plots.jfreechart.JFreeChartFrame
import hep.dataforge.stat.fit.ParamSet import hep.dataforge.stat.fit.ParamSet
import inr.numass.models.LossCalculator import inr.numass.models.LossCalculator
@ -37,7 +37,7 @@ ParamSet params = new ParamSet()
UnivariateFunction scatterFunction = LossCalculator.getSingleScatterFunction(params); UnivariateFunction scatterFunction = LossCalculator.getSingleScatterFunction(params);
PlotFrame frame = JFreeChartFrame.drawFrame("Differential scatter function", null); PlotFrame frame = JFreeChartFrame.drawFrame("Differential scatter function", null);
frame.add(PlottableXYFunction.plotFunction("differential", scatterFunction, 0, 100, 400)); frame.add(PlotXYFunction.plotFunction("differential", scatterFunction, 0, 100, 400));
UnivariateIntegrator integrator = NumassContext.defaultIntegrator; UnivariateIntegrator integrator = NumassContext.defaultIntegrator;
@ -88,7 +88,7 @@ UnivariateFunction integral = {double u ->
} }
frame.add(PlottableXYFunction.plotFunction("integral", integral, 0, 100, 800)); frame.add(PlotXYFunction.plotFunction("integral", integral, 0, 100, 800));
BisectionSolver solver = new BisectionSolver(1e-3); BisectionSolver solver = new BisectionSolver(1e-3);

View File

@ -17,7 +17,7 @@ package inr.numass.scripts
import hep.dataforge.io.PrintFunction import hep.dataforge.io.PrintFunction
import hep.dataforge.maths.integration.UnivariateIntegrator import hep.dataforge.maths.integration.UnivariateIntegrator
import hep.dataforge.plots.data.PlottableXYFunction import hep.dataforge.plots.data.PlotXYFunction
import hep.dataforge.plots.jfreechart.JFreeChartFrame import hep.dataforge.plots.jfreechart.JFreeChartFrame
import hep.dataforge.stat.fit.ParamSet import hep.dataforge.stat.fit.ParamSet
import inr.numass.models.ExperimentalVariableLossSpectrum import inr.numass.models.ExperimentalVariableLossSpectrum
@ -45,17 +45,17 @@ JFreeChartFrame frame = JFreeChartFrame.drawFrame("Experimental Loss Test", null
UnivariateIntegrator integrator = NumassContext.defaultIntegrator UnivariateIntegrator integrator = NumassContext.defaultIntegrator
UnivariateFunction exFunc = lsp.excitation(params.getValue("exPos"), params.getValue("exW")); UnivariateFunction exFunc = lsp.excitation(params.getValue("exPos"), params.getValue("exW"));
frame.add(PlottableXYFunction.plotFunction("ex", exFunc, 0d, 50d, 500)); frame.add(PlotXYFunction.plotFunction("ex", exFunc, 0d, 50d, 500));
println "excitation norm factor " + integrator.integrate(0, 50, exFunc) println "excitation norm factor " + integrator.integrate(0, 50, exFunc)
UnivariateFunction ionFunc = lsp.ionization(params.getValue("ionPos"), params.getValue("ionW")); UnivariateFunction ionFunc = lsp.ionization(params.getValue("ionPos"), params.getValue("ionW"));
frame.add(PlottableXYFunction.plotFunction("ion", ionFunc, 0d, 50d, 500)); frame.add(PlotXYFunction.plotFunction("ion", ionFunc, 0d, 50d, 500));
println "ionization norm factor " + integrator.integrate(0, 200, ionFunc) println "ionization norm factor " + integrator.integrate(0, 200, ionFunc)
UnivariateFunction sumFunc = lsp.singleScatterFunction(params); UnivariateFunction sumFunc = lsp.singleScatterFunction(params);
frame.add(PlottableXYFunction.plotFunction("sum", sumFunc, 0d, 50d, 500)); frame.add(PlotXYFunction.plotFunction("sum", sumFunc, 0d, 50d, 500));
println "sum norm factor " + integrator.integrate(0, 100, sumFunc) println "sum norm factor " + integrator.integrate(0, 100, sumFunc)
@ -65,4 +65,4 @@ PrintFunction.printFunctionSimple(new PrintWriter(System.out), sumFunc, 0d, 50d,
JFreeChartFrame integerFrame = JFreeChartFrame.drawFrame("Experimental Loss Test", null); JFreeChartFrame integerFrame = JFreeChartFrame.drawFrame("Experimental Loss Test", null);
UnivariateFunction integr = { d-> lsp.value(d,params)} UnivariateFunction integr = { d-> lsp.value(d,params)}
integerFrame.add(PlottableXYFunction.plotFunction("integr", integr, 18950d, 19005d, 500)); integerFrame.add(PlotXYFunction.plotFunction("integr", integr, 18950d, 19005d, 500));

View File

@ -15,7 +15,7 @@
*/ */
package inr.numass.scripts package inr.numass.scripts
import hep.dataforge.plots.data.PlottableXYFunction import hep.dataforge.plots.data.PlotXYFunction
import hep.dataforge.plots.jfreechart.JFreeChartFrame import hep.dataforge.plots.jfreechart.JFreeChartFrame
import org.apache.commons.math3.analysis.UnivariateFunction import org.apache.commons.math3.analysis.UnivariateFunction
@ -43,4 +43,4 @@ UnivariateFunction excitation = excitationSpectrum(lines,0.08)
JFreeChartFrame frame = JFreeChartFrame.drawFrame("theoretical loss spectrum", null); JFreeChartFrame frame = JFreeChartFrame.drawFrame("theoretical loss spectrum", null);
frame.add(PlottableXYFunction.plotFunction("excitation", excitation, 0d, 20d, 500)); frame.add(PlotXYFunction.plotFunction("excitation", excitation, 0d, 20d, 500));

View File

@ -14,7 +14,7 @@ import hep.dataforge.grind.GrindShell
import hep.dataforge.grind.helpers.PlotHelper import hep.dataforge.grind.helpers.PlotHelper
import hep.dataforge.io.ColumnedDataWriter import hep.dataforge.io.ColumnedDataWriter
import hep.dataforge.meta.Meta import hep.dataforge.meta.Meta
import hep.dataforge.plots.data.PlottableData import hep.dataforge.plots.data.PlotData
import hep.dataforge.plots.data.PlottableGroup import hep.dataforge.plots.data.PlottableGroup
import hep.dataforge.plots.fx.FXPlotManager import hep.dataforge.plots.fx.FXPlotManager
import hep.dataforge.tables.Table import hep.dataforge.tables.Table
@ -64,11 +64,11 @@ shell.eval {
//Showing selected points //Showing selected points
def showPoints = { Map points, int binning = 20, int loChannel = 300, int upChannel = 2000 -> def showPoints = { Map points, int binning = 20, int loChannel = 300, int upChannel = 2000 ->
PlottableGroup<PlottableData> plotGroup = new PlottableGroup<>(); PlottableGroup<PlotData> plotGroup = new PlottableGroup<>();
def adapter = new XYAdapter(CHANNEL_KEY, COUNT_RATE_KEY) def adapter = new XYAdapter(CHANNEL_KEY, COUNT_RATE_KEY)
points.each { points.each {
plotGroup.add( plotGroup.add(
PlottableData.plot( PlotData.plot(
it.key as String, it.key as String,
adapter, adapter,
NumassDataUtils.spectrumWithBinning(it.value as Table, binning) NumassDataUtils.spectrumWithBinning(it.value as Table, binning)

View File

@ -24,8 +24,8 @@ import hep.dataforge.meta.Laminate;
import hep.dataforge.meta.Meta; import hep.dataforge.meta.Meta;
import hep.dataforge.plots.PlotFrame; import hep.dataforge.plots.PlotFrame;
import hep.dataforge.plots.PlotUtils; import hep.dataforge.plots.PlotUtils;
import hep.dataforge.plots.data.PlottableData; import hep.dataforge.plots.data.PlotData;
import hep.dataforge.plots.data.PlottableXYFunction; import hep.dataforge.plots.data.PlotXYFunction;
import hep.dataforge.stat.fit.FitResult; import hep.dataforge.stat.fit.FitResult;
import hep.dataforge.stat.fit.FitState; import hep.dataforge.stat.fit.FitState;
import hep.dataforge.stat.models.XYModel; import hep.dataforge.stat.models.XYModel;
@ -69,7 +69,7 @@ public class PlotFitResultAction extends OneToOneAction<FitResult, FitResult> {
PlotFrame frame = PlotUtils.getPlotManager(context) PlotFrame frame = PlotUtils.getPlotManager(context)
.getPlotFrame(getName(), name, metaData.getMeta("plot", Meta.empty())); .getPlotFrame(getName(), name, metaData.getMeta("plot", Meta.empty()));
PlottableXYFunction fit = new PlottableXYFunction("fit"); PlotXYFunction fit = new PlotXYFunction("fit");
fit.setDensity(100, false); fit.setDensity(100, false);
fit.setSmoothing(true); fit.setSmoothing(true);
// ensuring all data points are calculated explicitly // ensuring all data points are calculated explicitly
@ -78,7 +78,7 @@ public class PlotFitResultAction extends OneToOneAction<FitResult, FitResult> {
frame.add(fit); frame.add(fit);
frame.add(PlottableData.plot("data", adapter, data)); frame.add(PlotData.plot("data", adapter, data));
return input; return input;
} }

View File

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

View File

@ -8,7 +8,7 @@ import hep.dataforge.kodex.configure
import hep.dataforge.maths.histogram.UnivariateHistogram import hep.dataforge.maths.histogram.UnivariateHistogram
import hep.dataforge.meta.Laminate import hep.dataforge.meta.Laminate
import hep.dataforge.plots.PlotManager import hep.dataforge.plots.PlotManager
import hep.dataforge.plots.data.PlottableData import hep.dataforge.plots.data.PlotData
import hep.dataforge.tables.Table import hep.dataforge.tables.Table
import hep.dataforge.tables.ValueMap import hep.dataforge.tables.ValueMap
import hep.dataforge.values.ValueType import hep.dataforge.values.ValueType
@ -75,7 +75,7 @@ class TimeAnalyzedAction : OneToOneAction<NumassPoint, Table>() {
} }
} }
histPlot.add(PlottableData(name) histPlot.add(PlotData(name)
.configure { .configure {
"showLine" to true "showLine" to true
"showSymbol" to false "showSymbol" to false
@ -116,7 +116,7 @@ class TimeAnalyzedAction : OneToOneAction<NumassPoint, Table>() {
} }
pm.getPlotFrame(getName(), "stat-method").add( pm.getPlotFrame(getName(), "stat-method").add(
PlottableData(name).configure { PlotData(name).configure {
"showLine" to true "showLine" to true
"thickness" to 4 "thickness" to 4
"title" to "${name}_${input.voltage}" "title" to "${name}_${input.voltage}"

View File

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

View File

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

View File

@ -27,7 +27,7 @@ import hep.dataforge.names.AlphanumComparator;
import hep.dataforge.names.Name; import hep.dataforge.names.Name;
import hep.dataforge.plots.PlotUtils; import hep.dataforge.plots.PlotUtils;
import hep.dataforge.plots.data.PlotDataUtils; import hep.dataforge.plots.data.PlotDataUtils;
import hep.dataforge.plots.data.XYPlottable; import hep.dataforge.plots.data.XYPlot;
import hep.dataforge.plots.fx.PlotContainer; import hep.dataforge.plots.fx.PlotContainer;
import hep.dataforge.plots.jfreechart.JFreeChartFrame; import hep.dataforge.plots.jfreechart.JFreeChartFrame;
import hep.dataforge.storage.api.PointLoader; import hep.dataforge.storage.api.PointLoader;
@ -85,7 +85,7 @@ public class MspViewController implements Encapsulated {
/** /**
* update detector pane with new data * update detector pane with new data
*/ */
private void updateMspPane(Iterable<? extends XYPlottable> mspData) { private void updateMspPane(Iterable<? extends XYPlot> mspData) {
JFreeChartFrame frame = new JFreeChartFrame(); JFreeChartFrame frame = new JFreeChartFrame();
PlotUtils.setYAxis(frame, "partial pressure", "mbar", "log"); PlotUtils.setYAxis(frame, "partial pressure", "mbar", "log");
frame.getConfig().setValue("yAxis.range.lower", 1e-10); frame.getConfig().setValue("yAxis.range.lower", 1e-10);
@ -93,7 +93,7 @@ public class MspViewController implements Encapsulated {
PlotUtils.setXAxis(frame, "time", null, "time"); PlotUtils.setXAxis(frame, "time", null, "time");
// StreamSupport.stream(mspData.spliterator(), false) // StreamSupport.stream(mspData.spliterator(), false)
// .sorted((XYPlottable o1, XYPlottable o2) // .sorted((XYPlot o1, XYPlot o2)
// -> Integer.valueOf(o1.getName()).compareTo(Integer.valueOf(o2.getName()))).forEach((pl) -> frame.add(pl)); // -> Integer.valueOf(o1.getName()).compareTo(Integer.valueOf(o2.getName()))).forEach((pl) -> frame.add(pl));
frame.addAll(mspData); frame.addAll(mspData);
@ -123,7 +123,7 @@ public class MspViewController implements Encapsulated {
// for (String name : point.names()) { // for (String name : point.names()) {
// if (!name.equals("timestamp")) { // if (!name.equals("timestamp")) {
// if (!getPlottables.has(name)) { // if (!getPlottables.has(name)) {
// getPlottables.addPlottable(new TimePlottable(name, name)); // getPlottables.addPlottable(new TimePlot(name, name));
// } // }
// } // }
// } // }
@ -222,7 +222,7 @@ public class MspViewController implements Encapsulated {
// for (String name : point.names()) { // for (String name : point.names()) {
// if (!name.equals("timestamp")) { // if (!name.equals("timestamp")) {
// if (!getPlottables.has(name)) { // if (!getPlottables.has(name)) {
// getPlottables.add(new TimePlottable(name, name)); // getPlottables.add(new TimePlot(name, name));
// } // }
// } // }
// } // }

View File

@ -7,10 +7,10 @@ import hep.dataforge.kodex.buildMeta
import hep.dataforge.meta.Meta import hep.dataforge.meta.Meta
import hep.dataforge.meta.MetaBuilder import hep.dataforge.meta.MetaBuilder
import hep.dataforge.plots.XYPlotFrame import hep.dataforge.plots.XYPlotFrame
import hep.dataforge.plots.data.PlotData
import hep.dataforge.plots.data.PlotDataUtils import hep.dataforge.plots.data.PlotDataUtils
import hep.dataforge.plots.data.PlottableData
import hep.dataforge.plots.data.PlottableGroup import hep.dataforge.plots.data.PlottableGroup
import hep.dataforge.plots.data.TimePlottable import hep.dataforge.plots.data.TimePlot
import hep.dataforge.plots.fx.PlotContainer import hep.dataforge.plots.fx.PlotContainer
import hep.dataforge.plots.jfreechart.JFreeChartFrame import hep.dataforge.plots.jfreechart.JFreeChartFrame
import hep.dataforge.storage.commons.JSONMetaWriter import hep.dataforge.storage.commons.JSONMetaWriter
@ -80,8 +80,8 @@ class NumassLoaderView : View() {
private val spectra = HashMap<Double, Table>();//spectra cache private val spectra = HashMap<Double, Table>();//spectra cache
val spectrumData = PlottableData("spectrum") val spectrumData = PlotData("spectrum")
val hvPlotData = PlottableGroup<TimePlottable>() val hvPlotData = PlottableGroup<TimePlot>()
//private var points = FXCollections.observableArrayList<NumassPoint>() //private var points = FXCollections.observableArrayList<NumassPoint>()
val detectorPlotFrame = JFreeChartFrame( val detectorPlotFrame = JFreeChartFrame(
@ -247,7 +247,7 @@ class NumassLoaderView : View() {
for (dp in it) { for (dp in it) {
val block = dp.getString("block", "default") val block = dp.getString("block", "default")
if (!hvPlotData.has(block)) { if (!hvPlotData.has(block)) {
hvPlotData.add(TimePlottable(block)) hvPlotData.add(TimePlot(block))
} }
hvPlotData.get(block).put(dp.getValue("timestamp").timeValue(), dp.getValue("value")) hvPlotData.get(block).put(dp.getValue("timestamp").timeValue(), dp.getValue("value"))
} }
@ -324,7 +324,7 @@ class NumassLoaderView : View() {
val index = AtomicInteger(0); val index = AtomicInteger(0);
data.points.map { point -> data.points.map { point ->
val seriesName = String.format("%d: %.2f", index.incrementAndGet(), point.voltage) val seriesName = String.format("%d: %.2f", index.incrementAndGet(), point.voltage)
PlottableData.plot( PlotData.plot(
seriesName, seriesName,
XYAdapter(NumassAnalyzer.CHANNEL_KEY, valueAxis), XYAdapter(NumassAnalyzer.CHANNEL_KEY, valueAxis),
NumassDataUtils.spectrumWithBinning(getSpectrum(point), binning) NumassDataUtils.spectrumWithBinning(getSpectrum(point), binning)

View File

@ -3,8 +3,8 @@ package inr.numass.viewer
import hep.dataforge.kodex.buildMeta import hep.dataforge.kodex.buildMeta
import hep.dataforge.kodex.configure import hep.dataforge.kodex.configure
import hep.dataforge.meta.Meta import hep.dataforge.meta.Meta
import hep.dataforge.plots.Plottable import hep.dataforge.plots.Plot
import hep.dataforge.plots.data.PlottableData import hep.dataforge.plots.data.PlotData
import hep.dataforge.plots.fx.PlotContainer import hep.dataforge.plots.fx.PlotContainer
import hep.dataforge.plots.jfreechart.JFreeChartFrame import hep.dataforge.plots.jfreechart.JFreeChartFrame
import hep.dataforge.storage.api.PointLoader import hep.dataforge.storage.api.PointLoader
@ -33,10 +33,10 @@ class SlowControlView : View("My View") {
fun load(loader: PointLoader) { fun load(loader: PointLoader) {
runAsync { runAsync {
val data = getData(loader) val data = getData(loader)
ArrayList<Plottable>().apply { ArrayList<Plot>().apply {
loader.format.columns.filter { it.name != "timestamp" }.forEach { loader.format.columns.filter { it.name != "timestamp" }.forEach {
val adapter = XYAdapter("timestamp", it.name); val adapter = XYAdapter("timestamp", it.name);
this += PlottableData.plot(it.name, adapter, data).configure { this += PlotData.plot(it.name, adapter, data).configure {
"showLine" to true "showLine" to true
"showSymbol" to false "showSymbol" to false
"showErrors" to false "showErrors" to false

View File

@ -1,6 +1,6 @@
package inr.numass.viewer.test package inr.numass.viewer.test
import hep.dataforge.plots.data.PlottableData import hep.dataforge.plots.data.PlotData
import hep.dataforge.plots.fx.PlotContainer import hep.dataforge.plots.fx.PlotContainer
import hep.dataforge.plots.jfreechart.JFreeChartFrame import hep.dataforge.plots.jfreechart.JFreeChartFrame
import hep.dataforge.tables.ValueMap import hep.dataforge.tables.ValueMap
@ -16,7 +16,7 @@ class JFCTest : View("My View") {
val plot = JFreeChartFrame(); val plot = JFreeChartFrame();
val container = PlotContainer(); val container = PlotContainer();
val data = PlottableData("data"); val data = PlotData("data");
val button = button("test") { val button = button("test") {
action { action {