Updates to plot output

This commit is contained in:
Alexander Nozik 2018-05-15 20:55:33 +03:00
parent 0a18e10275
commit 1742d03b44
4 changed files with 48 additions and 33 deletions

View File

@ -84,11 +84,9 @@ class TimeAnalyzerAction : OneToOneAction<NumassPoint, Table>() {
histPlot.add(histogramPlot) histPlot.add(histogramPlot)
//val cr = input.events.count().toDouble() / input.length.toMillis() *1000
histPlot.add( histPlot.add(
XYFunctionPlot.plot(name + "_theory", 0.0, binSize * binNum) { XYFunctionPlot.plot(name + "_theory", 0.0, binSize * binNum) {
trueCR * Math.exp(- it * trueCR / 1e6) trueCR * Math.exp(-it * trueCR / 1e6) * binSize
} }
) )
} }

View File

@ -160,8 +160,9 @@ class AmplitudeView : View(title = "Numass amplitude spectrum plot", icon = Imag
} }
fun clear() { fun clear() {
frame.plots.clear() data.clear()
plots.clear() // frame.plots.clear()
// plots.clear()
invalidate() invalidate()
} }

View File

@ -56,10 +56,12 @@ class MainView(val context: Context = Global.getContext("viewer")) : View(title
if (homeDir == null) { if (homeDir == null) {
chooser.initialDirectory = File(".").absoluteFile chooser.initialDirectory = File(".").absoluteFile
} else { } else {
chooser.initialDirectory = File(homeDir) val file = File(homeDir)
if (file.isDirectory) {
chooser.initialDirectory = file
} else {
chooser.initialDirectory = file.parentFile
} }
} catch (ex: Exception) {
NumassProperties.setNumassProperty("numass.viewer.lastPath", null)
} }
val rootDir = chooser.showDialog(primaryStage.scene.window) val rootDir = chooser.showDialog(primaryStage.scene.window)
@ -73,6 +75,10 @@ class MainView(val context: Context = Global.getContext("viewer")) : View(title
load(rootDir.toPath()) load(rootDir.toPath())
} }
} }
} catch (ex: Exception) {
NumassProperties.setNumassProperty("numass.viewer.lastPath", null)
error("Error", content = "Failed to laod file with message: ${ex.message}")
}
} }
} }
button("Load file") { button("Load file") {
@ -86,9 +92,7 @@ class MainView(val context: Context = Global.getContext("viewer")) : View(title
} else { } else {
chooser.initialDirectory = File(homeDir) chooser.initialDirectory = File(homeDir)
} }
} catch (ex: Exception) {
NumassProperties.setNumassProperty("numass.viewer.lastPath", null)
}
val file = chooser.showOpenDialog(primaryStage.scene.window) val file = chooser.showOpenDialog(primaryStage.scene.window)
if (file != null) { if (file != null) {
@ -100,6 +104,10 @@ class MainView(val context: Context = Global.getContext("viewer")) : View(title
load(file.toPath()) load(file.toPath())
} }
} }
} catch (ex: Exception) {
NumassProperties.setNumassProperty("numass.viewer.lastPath", null)
error("Error", content = "Failed to laod file with message: ${ex.message}")
}
} }
} }
@ -144,6 +152,7 @@ class MainView(val context: Context = Global.getContext("viewer")) : View(title
NumassDataLoader.fromDir(context, path) NumassDataLoader.fromDir(context, path)
} ui { } ui {
contentView = SpectrumView().apply { contentView = SpectrumView().apply {
clear()
set(it.name, CachedSet(it)) set(it.name, CachedSet(it))
} }
infoView = MetaViewer(it.meta) infoView = MetaViewer(it.meta)

View File

@ -17,10 +17,17 @@ import tornadofx.*
class StorageView(val storage: Storage) : View(title = "Numass storage", icon = dfIconView) { class StorageView(val storage: Storage) : View(title = "Numass storage", icon = dfIconView) {
private val ampView: AmplitudeView by inject(); private val ampView: AmplitudeView by inject()
private val spectrumView: SpectrumView by inject(); private val spectrumView: SpectrumView by inject()
private val hvView: HVView by inject(); private val hvView: HVView by inject()
private val scView: SlowControlView by inject(); private val scView: SlowControlView by inject()
init {
ampView.clear()
spectrumView.clear()
hvView.clear()
scView.clear()
}
private inner class Container(val id: String, val content: Any) { private inner class Container(val id: String, val content: Any) {
val checkedProperty = SimpleBooleanProperty(false) val checkedProperty = SimpleBooleanProperty(false)