From 4a1752ca07c7800c719159db2b032e95f15af93e Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Tue, 22 May 2018 17:00:32 +0300 Subject: [PATCH] Minor fixes to visualization. --- .../inr/numass/actions/TimeSpectrumAction.kt | 4 ++-- .../numass/scripts/timeanalysis/AnalyzePoint.kt | 4 +++- numass-viewer/build.gradle | 2 +- .../kotlin/inr/numass/viewer/AmplitudeView.kt | 15 +++++++++++---- .../src/main/kotlin/inr/numass/viewer/Cache.kt | 12 ++++-------- 5 files changed, 21 insertions(+), 16 deletions(-) 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 f2fc0d05..8bdc270e 100644 --- a/numass-main/src/main/kotlin/inr/numass/actions/TimeSpectrumAction.kt +++ b/numass-main/src/main/kotlin/inr/numass/actions/TimeSpectrumAction.kt @@ -84,8 +84,8 @@ class TimeSpectrumAction : OneToOneAction() { context.plot("histogram", name, histogramPlot) { "xAxis" to { - "axisTitle" to "delay" - "axisUnits" to "us" + "title" to "delay" + "units" to "us" } "yAxis" to { "type" to "log" diff --git a/numass-main/src/main/kotlin/inr/numass/scripts/timeanalysis/AnalyzePoint.kt b/numass-main/src/main/kotlin/inr/numass/scripts/timeanalysis/AnalyzePoint.kt index cde28184..94143580 100644 --- a/numass-main/src/main/kotlin/inr/numass/scripts/timeanalysis/AnalyzePoint.kt +++ b/numass-main/src/main/kotlin/inr/numass/scripts/timeanalysis/AnalyzePoint.kt @@ -6,6 +6,7 @@ import hep.dataforge.kodex.buildMeta import inr.numass.NumassPlugin import inr.numass.actions.TimeAnalyzerAction import inr.numass.data.NumassDataUtils +import inr.numass.data.analyzers.TimeAnalyzer import inr.numass.data.api.NumassPoint import inr.numass.data.api.NumassSet import inr.numass.data.api.SimpleNumassPoint @@ -25,8 +26,9 @@ fun main(args: Array) { "binNum" to 200 "t0Step" to 100 "chunkSize" to 3000 + "mean" to TimeAnalyzer.AveragingMethod.GEOMETRIC // "separateParallelBlocks" to true - node("window") { + "window" to { "lo" to 0 "up" to 4000 } diff --git a/numass-viewer/build.gradle b/numass-viewer/build.gradle index 79d2723e..05cb1a2f 100644 --- a/numass-viewer/build.gradle +++ b/numass-viewer/build.gradle @@ -12,7 +12,7 @@ if (!hasProperty('mainClass')) { mainClassName = mainClass -version = "0.5.1 - SNAPSHOT" +version = "0.5.2 - SNAPSHOT" description = "The viewer for numass data" diff --git a/numass-viewer/src/main/kotlin/inr/numass/viewer/AmplitudeView.kt b/numass-viewer/src/main/kotlin/inr/numass/viewer/AmplitudeView.kt index 70540cd0..ac23e70f 100644 --- a/numass-viewer/src/main/kotlin/inr/numass/viewer/AmplitudeView.kt +++ b/numass-viewer/src/main/kotlin/inr/numass/viewer/AmplitudeView.kt @@ -92,10 +92,15 @@ class AmplitudeView : View(title = "Numass amplitude spectrum plot", icon = Imag } binningProperty.onChange { - clear() + frame.plots.clear() + plots.clear() + invalidate() } + normalizeProperty.onChange { - clear() + frame.plots.clear() + plots.clear() + invalidate() } container.progressProperty.bind(progress) @@ -161,8 +166,10 @@ class AmplitudeView : View(title = "Numass amplitude spectrum plot", icon = Imag fun clear() { data.clear() -// frame.plots.clear() -// plots.clear() + plots.values.forEach{ + it.cancel() + } + plots.clear() invalidate() } diff --git a/numass-viewer/src/main/kotlin/inr/numass/viewer/Cache.kt b/numass-viewer/src/main/kotlin/inr/numass/viewer/Cache.kt index ebabdbe8..586a5d46 100644 --- a/numass-viewer/src/main/kotlin/inr/numass/viewer/Cache.kt +++ b/numass-viewer/src/main/kotlin/inr/numass/viewer/Cache.kt @@ -35,15 +35,11 @@ class CachedPoint(val point: NumassPoint) : NumassPoint by point { override val meta: Meta = point.meta - val channelSpectra: Deferred> - get() = async(start = CoroutineStart.LAZY) { - return@async point.channels.mapValues { (_, value) -> analyzer.getAmplitudeSpectrum(value) } - } + val channelSpectra: Deferred> = async(start = CoroutineStart.LAZY) { + point.channels.mapValues { (_, value) -> analyzer.getAmplitudeSpectrum(value) } + } - val spectrum: Deferred - get() = async(start = CoroutineStart.LAZY) { - analyzer.getAmplitudeSpectrum(point) - } + val spectrum: Deferred
= async(start = CoroutineStart.LAZY) { analyzer.getAmplitudeSpectrum(point) } } class CachedSet(set: NumassSet) : NumassSet by set {