Started to remove PlotManager
This commit is contained in:
parent
86f7af61d3
commit
6277b551c0
@ -200,7 +200,7 @@ class PKT8Display : DeviceDisplayFX<PKT8Device>(), PKT8ValueListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun getPlot(channelName: String): Plot? {
|
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 {
|
TimePlot(it.name).apply {
|
||||||
configure(it.meta)
|
configure(it.meta)
|
||||||
plotFrame.add(this)
|
plotFrame.add(this)
|
||||||
|
@ -22,9 +22,9 @@ import hep.dataforge.description.TypedActionDef;
|
|||||||
import hep.dataforge.meta.Laminate;
|
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.XYFunctionPlot;
|
import hep.dataforge.plots.XYFunctionPlot;
|
||||||
import hep.dataforge.plots.data.DataPlot;
|
import hep.dataforge.plots.data.DataPlot;
|
||||||
|
import hep.dataforge.plots.output.PlotOutputKt;
|
||||||
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;
|
||||||
@ -62,9 +62,7 @@ public class PlotFitResultAction extends OneToOneAction<FitResult, FitResult> {
|
|||||||
throw new RuntimeException("No adapter defined for data interpretation");
|
throw new RuntimeException("No adapter defined for data interpretation");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PlotFrame frame = PlotOutputKt.getPlotFrame(context, getName(), name, metaData.getMeta("frame", Meta.empty()));
|
||||||
PlotFrame frame = PlotUtils.INSTANCE.getPlotManager(context)
|
|
||||||
.getPlotFrame(getName(), name, metaData.getMeta("frame", Meta.empty()));
|
|
||||||
|
|
||||||
XYFunctionPlot fit = new XYFunctionPlot("fit", Meta.empty(), (Double x) -> model.getSpectrum().value(x, input.getParameters()));
|
XYFunctionPlot fit = new XYFunctionPlot("fit", Meta.empty(), (Double x) -> model.getSpectrum().value(x, input.getParameters()));
|
||||||
fit.setDensity(100);
|
fit.setDensity(100);
|
||||||
|
@ -6,9 +6,9 @@ import hep.dataforge.description.*
|
|||||||
import hep.dataforge.kodex.configure
|
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.PlotPlugin
|
|
||||||
import hep.dataforge.plots.XYFunctionPlot
|
import hep.dataforge.plots.XYFunctionPlot
|
||||||
import hep.dataforge.plots.data.DataPlot
|
import hep.dataforge.plots.data.DataPlot
|
||||||
|
import hep.dataforge.plots.output.getPlotFrame
|
||||||
import hep.dataforge.tables.Adapters
|
import hep.dataforge.tables.Adapters
|
||||||
import hep.dataforge.tables.Table
|
import hep.dataforge.tables.Table
|
||||||
import hep.dataforge.values.ValueType
|
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 {
|
override fun execute(context: Context, name: String, input: NumassPoint, inputMeta: Laminate): Table {
|
||||||
val log = getLog(context, name);
|
val log = getLog(context, name);
|
||||||
|
|
||||||
val pm = context[PlotPlugin::class.java];
|
|
||||||
|
|
||||||
val initialEstimate = analyzer.analyze(input, inputMeta)
|
val initialEstimate = analyzer.analyze(input, inputMeta)
|
||||||
val trueCR = initialEstimate.getDouble("cr")
|
val trueCR = initialEstimate.getDouble("cr")
|
||||||
|
|
||||||
@ -62,9 +60,7 @@ class TimeAnalyzerAction : OneToOneAction<NumassPoint, Table>() {
|
|||||||
|
|
||||||
if (inputMeta.getBoolean("plotHist", true)) {
|
if (inputMeta.getBoolean("plotHist", true)) {
|
||||||
|
|
||||||
val histPlot = pm.getPlotFrame(name, "histogram");
|
val histPlot = context.getPlotFrame(name, "histogram") {
|
||||||
|
|
||||||
histPlot.configure {
|
|
||||||
node("xAxis") {
|
node("xAxis") {
|
||||||
"title" to "delay"
|
"title" to "delay"
|
||||||
"units" to "us"
|
"units" to "us"
|
||||||
@ -88,7 +84,7 @@ class TimeAnalyzerAction : OneToOneAction<NumassPoint, Table>() {
|
|||||||
|
|
||||||
histPlot.add(
|
histPlot.add(
|
||||||
XYFunctionPlot.plot(name + "_theory", 0.0, binSize * binNum) {
|
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<NumassPoint, Table>() {
|
|||||||
configure(inputMeta.getMetaOrEmpty("plot"))
|
configure(inputMeta.getMetaOrEmpty("plot"))
|
||||||
}
|
}
|
||||||
|
|
||||||
pm.getPlotFrame(name, "stat-method")
|
context.getPlotFrame(name, "stat-method") {
|
||||||
.configure {
|
"xAxis" to {
|
||||||
"xAxis" to {
|
"title" to "delay"
|
||||||
"title" to "delay"
|
"units" to "us"
|
||||||
"units" to "us"
|
}
|
||||||
}
|
"yAxis" to {
|
||||||
"yAxis" to {
|
"title" to "Relative count rate"
|
||||||
"title" to "Relative count rate"
|
}
|
||||||
}
|
}.add(statPlot)
|
||||||
}.add(statPlot)
|
|
||||||
|
|
||||||
(1..100).map { inputMeta.getDouble("t0Step", 1000.0) * it }.map { t ->
|
(1..100).map { inputMeta.getDouble("t0Step", 1000.0) * it }.map { t ->
|
||||||
val result = analyzer.analyze(input, inputMeta.builder.setValue("t0", t))
|
val result = analyzer.analyze(input, inputMeta.builder.setValue("t0", t))
|
||||||
|
@ -7,8 +7,8 @@ import hep.dataforge.kodex.buildMeta
|
|||||||
import hep.dataforge.kodex.configure
|
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.PlotPlugin
|
|
||||||
import hep.dataforge.plots.data.DataPlot
|
import hep.dataforge.plots.data.DataPlot
|
||||||
|
import hep.dataforge.plots.output.getPlotFrame
|
||||||
import hep.dataforge.tables.Adapters
|
import hep.dataforge.tables.Adapters
|
||||||
import hep.dataforge.tables.Table
|
import hep.dataforge.tables.Table
|
||||||
import hep.dataforge.values.ValueType
|
import hep.dataforge.values.ValueType
|
||||||
@ -43,7 +43,6 @@ class TimeSpectrumAction : OneToOneAction<NumassPoint, Table>() {
|
|||||||
val t0 = inputMeta.getDouble("t0", 30e3);
|
val t0 = inputMeta.getDouble("t0", 30e3);
|
||||||
val loChannel = inputMeta.getInt("window.lo", 500);
|
val loChannel = inputMeta.getInt("window.lo", 500);
|
||||||
val upChannel = inputMeta.getInt("window.up", 10000);
|
val upChannel = inputMeta.getInt("window.up", 10000);
|
||||||
val pm = context.get(PlotPlugin::class.java);
|
|
||||||
|
|
||||||
|
|
||||||
val trueCR = analyzer.analyze(input, buildMeta {
|
val trueCR = analyzer.analyze(input, buildMeta {
|
||||||
@ -70,9 +69,7 @@ class TimeSpectrumAction : OneToOneAction<NumassPoint, Table>() {
|
|||||||
|
|
||||||
if (inputMeta.getBoolean("plotHist", true)) {
|
if (inputMeta.getBoolean("plotHist", true)) {
|
||||||
|
|
||||||
val histPlot = pm.getPlotFrame(name, "histogram");
|
val histPlot = context.getPlotFrame(name, "histogram"){
|
||||||
|
|
||||||
histPlot.configure {
|
|
||||||
node("xAxis") {
|
node("xAxis") {
|
||||||
"axisTitle" to "delay"
|
"axisTitle" to "delay"
|
||||||
"axisUnits" to "us"
|
"axisUnits" to "us"
|
||||||
@ -107,7 +104,7 @@ class TimeSpectrumAction : OneToOneAction<NumassPoint, Table>() {
|
|||||||
configure(inputMeta.getMetaOrEmpty("plot"))
|
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 ->
|
(1..100).map { 1000 * it }.map { t ->
|
||||||
val result = analyzer.analyze(input, buildMeta {
|
val result = analyzer.analyze(input, buildMeta {
|
||||||
|
Loading…
Reference in New Issue
Block a user