Started to remove PlotManager

This commit is contained in:
Alexander Nozik 2018-05-20 14:43:30 +03:00
parent 86f7af61d3
commit 6277b551c0
4 changed files with 18 additions and 28 deletions

View File

@ -200,7 +200,7 @@ class PKT8Display : DeviceDisplayFX<PKT8Device>(), PKT8ValueListener {
}
private fun getPlot(channelName: String): Plot? {
return plotFrame[channelName] ?: device.channels.values.find { it.name == channelName }?.let {
return plotFrame[channelName] as? Plot ?: device.channels.values.find { it.name == channelName }?.let {
TimePlot(it.name).apply {
configure(it.meta)
plotFrame.add(this)

View File

@ -22,9 +22,9 @@ import hep.dataforge.description.TypedActionDef;
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.output.PlotOutputKt;
import hep.dataforge.stat.fit.FitResult;
import hep.dataforge.stat.fit.FitState;
import hep.dataforge.stat.models.XYModel;
@ -62,9 +62,7 @@ public class PlotFitResultAction extends OneToOneAction<FitResult, FitResult> {
throw new RuntimeException("No adapter defined for data interpretation");
}
PlotFrame frame = PlotUtils.INSTANCE.getPlotManager(context)
.getPlotFrame(getName(), name, metaData.getMeta("frame", Meta.empty()));
PlotFrame frame = PlotOutputKt.getPlotFrame(context, getName(), name, metaData.getMeta("frame", Meta.empty()));
XYFunctionPlot fit = new XYFunctionPlot("fit", Meta.empty(), (Double x) -> model.getSpectrum().value(x, input.getParameters()));
fit.setDensity(100);

View File

@ -6,9 +6,9 @@ import hep.dataforge.description.*
import hep.dataforge.kodex.configure
import hep.dataforge.maths.histogram.UnivariateHistogram
import hep.dataforge.meta.Laminate
import hep.dataforge.plots.PlotPlugin
import hep.dataforge.plots.XYFunctionPlot
import hep.dataforge.plots.data.DataPlot
import hep.dataforge.plots.output.getPlotFrame
import hep.dataforge.tables.Adapters
import hep.dataforge.tables.Table
import hep.dataforge.values.ValueType
@ -40,8 +40,6 @@ class TimeAnalyzerAction : OneToOneAction<NumassPoint, Table>() {
override fun execute(context: Context, name: String, input: NumassPoint, inputMeta: Laminate): Table {
val log = getLog(context, name);
val pm = context[PlotPlugin::class.java];
val initialEstimate = analyzer.analyze(input, inputMeta)
val trueCR = initialEstimate.getDouble("cr")
@ -62,9 +60,7 @@ class TimeAnalyzerAction : OneToOneAction<NumassPoint, Table>() {
if (inputMeta.getBoolean("plotHist", true)) {
val histPlot = pm.getPlotFrame(name, "histogram");
histPlot.configure {
val histPlot = context.getPlotFrame(name, "histogram") {
node("xAxis") {
"title" to "delay"
"units" to "us"
@ -103,8 +99,7 @@ class TimeAnalyzerAction : OneToOneAction<NumassPoint, Table>() {
configure(inputMeta.getMetaOrEmpty("plot"))
}
pm.getPlotFrame(name, "stat-method")
.configure {
context.getPlotFrame(name, "stat-method") {
"xAxis" to {
"title" to "delay"
"units" to "us"

View File

@ -7,8 +7,8 @@ import hep.dataforge.kodex.buildMeta
import hep.dataforge.kodex.configure
import hep.dataforge.maths.histogram.UnivariateHistogram
import hep.dataforge.meta.Laminate
import hep.dataforge.plots.PlotPlugin
import hep.dataforge.plots.data.DataPlot
import hep.dataforge.plots.output.getPlotFrame
import hep.dataforge.tables.Adapters
import hep.dataforge.tables.Table
import hep.dataforge.values.ValueType
@ -43,7 +43,6 @@ class TimeSpectrumAction : OneToOneAction<NumassPoint, Table>() {
val t0 = inputMeta.getDouble("t0", 30e3);
val loChannel = inputMeta.getInt("window.lo", 500);
val upChannel = inputMeta.getInt("window.up", 10000);
val pm = context.get(PlotPlugin::class.java);
val trueCR = analyzer.analyze(input, buildMeta {
@ -70,9 +69,7 @@ class TimeSpectrumAction : OneToOneAction<NumassPoint, Table>() {
if (inputMeta.getBoolean("plotHist", true)) {
val histPlot = pm.getPlotFrame(name, "histogram");
histPlot.configure {
val histPlot = context.getPlotFrame(name, "histogram"){
node("xAxis") {
"axisTitle" to "delay"
"axisUnits" to "us"
@ -107,7 +104,7 @@ class TimeSpectrumAction : OneToOneAction<NumassPoint, Table>() {
configure(inputMeta.getMetaOrEmpty("plot"))
}
pm.getPlotFrame(name, "stat-method").add(statPlot)
context.getPlotFrame(name, "stat-method").add(statPlot)
(1..100).map { 1000 * it }.map { t ->
val result = analyzer.analyze(input, buildMeta {