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,22 +56,28 @@ 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
}
}
val rootDir = chooser.showDialog(primaryStage.scene.window)
if (rootDir != null) {
NumassProperties.setNumassProperty("numass.viewer.lastPath", rootDir.absolutePath)
async {
runLater {
path = rootDir.toPath()
}
load(rootDir.toPath())
}
} }
} catch (ex: Exception) { } catch (ex: Exception) {
NumassProperties.setNumassProperty("numass.viewer.lastPath", null) NumassProperties.setNumassProperty("numass.viewer.lastPath", null)
} error("Error", content = "Failed to laod file with message: ${ex.message}")
val rootDir = chooser.showDialog(primaryStage.scene.window)
if (rootDir != null) {
NumassProperties.setNumassProperty("numass.viewer.lastPath", rootDir.absolutePath)
async {
runLater {
path = rootDir.toPath()
}
load(rootDir.toPath())
}
} }
} }
} }
@ -86,19 +92,21 @@ class MainView(val context: Context = Global.getContext("viewer")) : View(title
} else { } else {
chooser.initialDirectory = File(homeDir) chooser.initialDirectory = File(homeDir)
} }
val file = chooser.showOpenDialog(primaryStage.scene.window)
if (file != null) {
NumassProperties.setNumassProperty("numass.viewer.lastPath", file.parentFile.absolutePath)
async {
runLater {
path = file.toPath()
}
load(file.toPath())
}
}
} catch (ex: Exception) { } catch (ex: Exception) {
NumassProperties.setNumassProperty("numass.viewer.lastPath", null) NumassProperties.setNumassProperty("numass.viewer.lastPath", null)
} error("Error", content = "Failed to laod file with message: ${ex.message}")
val file = chooser.showOpenDialog(primaryStage.scene.window)
if (file != null) {
NumassProperties.setNumassProperty("numass.viewer.lastPath", file.parentFile.absolutePath)
async {
runLater {
path = file.toPath()
}
load(file.toPath())
}
} }
} }
} }
@ -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)