diff --git a/numass-control/cryotemp/src/main/kotlin/inr/numass/control/cryotemp/PKT8Display.kt b/numass-control/cryotemp/src/main/kotlin/inr/numass/control/cryotemp/PKT8Display.kt index d9913ab2..8eec2725 100644 --- a/numass-control/cryotemp/src/main/kotlin/inr/numass/control/cryotemp/PKT8Display.kt +++ b/numass-control/cryotemp/src/main/kotlin/inr/numass/control/cryotemp/PKT8Display.kt @@ -200,7 +200,7 @@ class PKT8Display : DeviceDisplayFX(), 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) diff --git a/numass-main/src/main/java/hep/dataforge/plotfit/PlotFitResultAction.java b/numass-main/src/main/java/hep/dataforge/plotfit/PlotFitResultAction.java index 88ccec0e..581a4fc2 100644 --- a/numass-main/src/main/java/hep/dataforge/plotfit/PlotFitResultAction.java +++ b/numass-main/src/main/java/hep/dataforge/plotfit/PlotFitResultAction.java @@ -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 { 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); diff --git a/numass-main/src/main/kotlin/inr/numass/actions/TimeAnalyzerAction.kt b/numass-main/src/main/kotlin/inr/numass/actions/TimeAnalyzerAction.kt index 8e724341..023f21c4 100644 --- a/numass-main/src/main/kotlin/inr/numass/actions/TimeAnalyzerAction.kt +++ b/numass-main/src/main/kotlin/inr/numass/actions/TimeAnalyzerAction.kt @@ -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() { 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() { 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" @@ -88,7 +84,7 @@ class TimeAnalyzerAction : OneToOneAction() { histPlot.add( XYFunctionPlot.plot(name + "_theory", 0.0, binSize * binNum) { - trueCR/1e6 * initialEstimate.getInt(NumassAnalyzer.COUNT_KEY) * binSize * Math.exp( - it * trueCR / 1e6) + trueCR / 1e6 * initialEstimate.getInt(NumassAnalyzer.COUNT_KEY) * binSize * Math.exp(-it * trueCR / 1e6) } ) } @@ -103,16 +99,15 @@ class TimeAnalyzerAction : OneToOneAction() { configure(inputMeta.getMetaOrEmpty("plot")) } - pm.getPlotFrame(name, "stat-method") - .configure { - "xAxis" to { - "title" to "delay" - "units" to "us" - } - "yAxis" to { - "title" to "Relative count rate" - } - }.add(statPlot) + context.getPlotFrame(name, "stat-method") { + "xAxis" to { + "title" to "delay" + "units" to "us" + } + "yAxis" to { + "title" to "Relative count rate" + } + }.add(statPlot) (1..100).map { inputMeta.getDouble("t0Step", 1000.0) * it }.map { t -> val result = analyzer.analyze(input, inputMeta.builder.setValue("t0", t)) diff --git a/numass-main/src/main/kotlin/inr/numass/actions/TimeSpectrumAction.kt b/numass-main/src/main/kotlin/inr/numass/actions/TimeSpectrumAction.kt index 53a6dc9d..246b17b5 100644 --- a/numass-main/src/main/kotlin/inr/numass/actions/TimeSpectrumAction.kt +++ b/numass-main/src/main/kotlin/inr/numass/actions/TimeSpectrumAction.kt @@ -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() { 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() { 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() { 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 {