From 97f27cdad16a585b94180bf5993ca428998844cc Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Thu, 19 Oct 2017 10:31:11 +0300 Subject: [PATCH] PlotContainer fixed --- .../numass/control/cryotemp/PKT8ViewConnection.kt | 4 ++-- .../main/kotlin/inr/numass/control/FXExtensions.kt | 2 +- .../groovy/inr/numass/scripts/times/TestProto.groovy | 2 +- .../hep/dataforge/plotfit/PlotFitResultAction.java | 4 ++-- .../main/java/inr/numass/tasks/NumassFitTask.java | 2 +- .../kotlin/inr/numass/viewer/NumassLoaderView.kt | 12 ++++++------ .../main/kotlin/inr/numass/viewer/SpectrumView.kt | 6 ++++-- .../main/kotlin/inr/numass/viewer/test/ViewerTest.kt | 6 +++--- 8 files changed, 20 insertions(+), 18 deletions(-) diff --git a/numass-control/cryotemp/src/main/kotlin/inr/numass/control/cryotemp/PKT8ViewConnection.kt b/numass-control/cryotemp/src/main/kotlin/inr/numass/control/cryotemp/PKT8ViewConnection.kt index 49a1bc27..3cc9bc91 100644 --- a/numass-control/cryotemp/src/main/kotlin/inr/numass/control/cryotemp/PKT8ViewConnection.kt +++ b/numass-control/cryotemp/src/main/kotlin/inr/numass/control/cryotemp/PKT8ViewConnection.kt @@ -176,12 +176,12 @@ class PKT8ViewConnection : DeviceViewConnection(), MeasurementListen init { val channels = device.chanels - //plot config from device configuration + //frame config from device configuration //Do not use view config here, it is applyed separately channels.stream() .filter { channel -> !plottables.has(channel.name) } .forEachOrdered { channel -> - //plot config from device configuration + //frame config from device configuration val plottable = TimePlot(channel.name) plottable.configure(channel.meta()) plottables.add(plottable) diff --git a/numass-control/src/main/kotlin/inr/numass/control/FXExtensions.kt b/numass-control/src/main/kotlin/inr/numass/control/FXExtensions.kt index 0135b240..2c1b1087 100644 --- a/numass-control/src/main/kotlin/inr/numass/control/FXExtensions.kt +++ b/numass-control/src/main/kotlin/inr/numass/control/FXExtensions.kt @@ -137,7 +137,7 @@ fun EventTarget.switch(text: String = "", op: (ToggleSwitch.() -> Unit)? = null) } /** - * Add plot + * Add frame */ fun BorderPane.plot(plottables: Iterable = Collections.emptyList(), metaTransform: (KMetaBuilder.() -> Unit)? = null): PlotFrame { val meta = KMetaBuilder("plotFrame"); diff --git a/numass-main/src/main/groovy/inr/numass/scripts/times/TestProto.groovy b/numass-main/src/main/groovy/inr/numass/scripts/times/TestProto.groovy index 957bf4a5..1c43b283 100644 --- a/numass-main/src/main/groovy/inr/numass/scripts/times/TestProto.groovy +++ b/numass-main/src/main/groovy/inr/numass/scripts/times/TestProto.groovy @@ -62,7 +62,7 @@ new GrindShell(ctx).eval { // ValueMap.ofMap("x.value": it + delta / 2, "y.value": result); // } // -// plot.plot(name: hv, frame: "discrepancy", discrepancyPlotPoints) +// frame.frame(name: hv, frame: "discrepancy", discrepancyPlotPoints) } 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 779df6be..37b89d35 100644 --- a/numass-main/src/main/java/hep/dataforge/plotfit/PlotFitResultAction.java +++ b/numass-main/src/main/java/hep/dataforge/plotfit/PlotFitResultAction.java @@ -40,7 +40,7 @@ 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 plot.") +@ValueDef(name = "plotTitle", def = "", info = "The title of the frame.") public class PlotFitResultAction extends OneToOneAction { @Override @@ -67,7 +67,7 @@ public class PlotFitResultAction extends OneToOneAction { Function function = (x) -> model.getSpectrum().value(x, input.getParameters()); PlotFrame frame = PlotUtils.getPlotManager(context) - .getPlotFrame(getName(), name, metaData.getMeta("plot", Meta.empty())); + .getPlotFrame(getName(), name, metaData.getMeta("frame", Meta.empty())); XYFunctionPlot fit = new XYFunctionPlot("fit"); fit.setDensity(100, false); diff --git a/numass-main/src/main/java/inr/numass/tasks/NumassFitTask.java b/numass-main/src/main/java/inr/numass/tasks/NumassFitTask.java index 2a7e3f0e..aba59ea8 100644 --- a/numass-main/src/main/java/inr/numass/tasks/NumassFitTask.java +++ b/numass-main/src/main/java/inr/numass/tasks/NumassFitTask.java @@ -52,7 +52,7 @@ public class NumassFitTask extends SingleActionTask { @Override protected Action getAction(TaskModel model) { Action action = new FitAction(); - if (model.meta().getBoolean("plot", false)) { + if (model.meta().getBoolean("frame", false)) { return ActionUtils.compose(action, new PlotFitResultAction()); } else { return action; diff --git a/numass-viewer/src/main/kotlin/inr/numass/viewer/NumassLoaderView.kt b/numass-viewer/src/main/kotlin/inr/numass/viewer/NumassLoaderView.kt index e2064538..bafe3fb2 100644 --- a/numass-viewer/src/main/kotlin/inr/numass/viewer/NumassLoaderView.kt +++ b/numass-viewer/src/main/kotlin/inr/numass/viewer/NumassLoaderView.kt @@ -118,7 +118,7 @@ class NumassLoaderView : View() { private val hvPlot: PlotContainer; init { - //setup detector pane plot and sidebar + //setup detector pane frame and sidebar val l = Label("Bin size:") l.padding = Insets(5.0) detectorBinningSelector.maxWidth = java.lang.Double.MAX_VALUE @@ -194,7 +194,7 @@ class NumassLoaderView : View() { validationSupport.registerValidator(dTimeField, Validator.createPredicateValidator(isNumber, "Must be number")) - //setup HV plot + //setup HV frame val hvPlotMeta = MetaBuilder("plot") .setValue("xAxis.axisTitle", "time") .setValue("xAxis.type", "time") @@ -214,9 +214,9 @@ class NumassLoaderView : View() { //setup info updateInfo(newData) - //setup hv plot + //setup hv frame updateHV(newData) - //setup spectrum plot + //setup spectrum frame updateSpectrum(newData) //setup detector data updateDetectorPane(newData) @@ -259,7 +259,7 @@ class NumassLoaderView : View() { (hvPlotData.opt(block).orElseThrow{RuntimeException()} as TimePlot) .put(dp.getValue("timestamp").timeValue(), dp.getValue("value")) } - hvPlot.plot.add(hvPlotData) + hvPlot.frame.add(hvPlotData) } } @@ -401,7 +401,7 @@ class NumassLoaderView : View() { fileChooser.initialFileName = data!!.name + "_detector.out" val destination = fileChooser.showSaveDialog(detectorPlotPane.scene.window) if (destination != null) { - val detectorData = DataPlotUtils.collectXYDataFromPlot(detectorPlot.plot as XYPlotFrame, true) + val detectorData = DataPlotUtils.collectXYDataFromPlot(detectorPlot.frame as XYPlotFrame, true) try { ColumnedDataWriter.writeTable( destination, diff --git a/numass-viewer/src/main/kotlin/inr/numass/viewer/SpectrumView.kt b/numass-viewer/src/main/kotlin/inr/numass/viewer/SpectrumView.kt index dcdcad49..a34f3d94 100644 --- a/numass-viewer/src/main/kotlin/inr/numass/viewer/SpectrumView.kt +++ b/numass-viewer/src/main/kotlin/inr/numass/viewer/SpectrumView.kt @@ -43,12 +43,12 @@ class SpectrumView( private val container = PlotContainer(frame); - private val loChannelProperty = SimpleIntegerProperty(0).apply { + private val loChannelProperty = SimpleIntegerProperty(500).apply { addListener { _ -> updateView() } } private var loChannel by loChannelProperty - private val upChannelProperty = SimpleIntegerProperty(4000).apply { + private val upChannelProperty = SimpleIntegerProperty(3100).apply { addListener { _ -> updateView() } } private var upChannel by upChannelProperty @@ -103,6 +103,8 @@ class SpectrumView( } items += RangeSlider().apply { + lowValue = 500.0 + highValue = 3100.0 highValueProperty().bindBidirectional(upChannelProperty) lowValueProperty().bindBidirectional(loChannelProperty) majorTickUnit = 500.0 diff --git a/numass-viewer/src/main/kotlin/inr/numass/viewer/test/ViewerTest.kt b/numass-viewer/src/main/kotlin/inr/numass/viewer/test/ViewerTest.kt index e20b8376..abf28f78 100644 --- a/numass-viewer/src/main/kotlin/inr/numass/viewer/test/ViewerTest.kt +++ b/numass-viewer/src/main/kotlin/inr/numass/viewer/test/ViewerTest.kt @@ -36,7 +36,7 @@ class ViewerTest : View(title = "Numass viewer test", icon = ImageView(dfIcon)) action { runAsync { val rootDir = File("D:\\Work\\Numass\\data\\2017_05\\Fill_2") - val set: NumassSet = NumassStorageFactory.buildLocal(rootDir).provide("loader::set_3", NumassSet::class.java) + val set: NumassSet = NumassStorageFactory.buildLocal(rootDir).provide("loader::set_2", NumassSet::class.java) .orElseThrow { RuntimeException("err") } update(set); } @@ -60,8 +60,8 @@ class ViewerTest : View(title = "Numass viewer test", icon = ImageView(dfIcon)) fun update(set: NumassSet) { amp.update(set.points.filter { it.voltage != 16000.0 }.collect(Collectors.toMap({ "point_${it.voltage}" }, { it }))); - sp.update(mapOf("test" to set)); - hv.update(set) + //sp.update(mapOf("test" to set)); + //hv.update(set) } }