Fix late modification for FakePlotFrame

This commit is contained in:
Alexander Nozik 2018-07-18 19:41:47 +03:00
parent 5e3351b2ba
commit 4b6fd59a5e
2 changed files with 13 additions and 35 deletions

View File

@ -297,7 +297,8 @@ class NumassPlugin : BasicPlugin() {
*/
@JvmOverloads
fun displayChart(title: String, context: Context = Global, width: Double = 800.0, height: Double = 600.0, meta: Meta = Meta.empty()): JFreeChartFrame {
val frame = JFreeChartFrame(meta)
val frame = JFreeChartFrame()
frame.configure(meta)
frame.configureValue("title", title)
context.pluginManager.load<FXPlugin>().display(PlotContainer(frame), width, height)
return frame

View File

@ -47,8 +47,6 @@ fun main(args: Array<String>) {
val context = buildContext("NUMASS", NumassPlugin::class.java, JFreeChartPlugin::class.java) {
output = FXOutputManager()
rootDir = "D:\\Work\\Numass\\sterile2018_04"
dataDir = "D:\\Work\\Numass\\data\\2018_04"
}
val spectrum = NBkgSpectrum(SterileNeutrinoSpectrum(context, Meta.empty()))
@ -113,7 +111,7 @@ fun main(args: Array<String>) {
val state = FitState(data, model, params)
val res = fm.runStage(state, "QOW", FitStage.TASK_RUN, "N", "E0","bkg")
val res = fm.runStage(state, "QOW", FitStage.TASK_RUN, "N", "E0", "bkg")
res.printState(PrintWriter(System.out))
res.printState(PrintWriter(context.output["fitResult", name].stream))
@ -129,31 +127,6 @@ fun main(args: Array<String>) {
}
/*
context.plot("trap") {
plots.configure {
"showLine" to true
"showSymbol" to false
"showErrors" to false
}
plots.setType<DataPlot>()
+plotSpectrum("base")
+plotSpectrum("noTrap", "trap" to 0.0)
}
context.plot("residuals") {
plots.configure {
"showLine" to true
"showSymbol" to false
"showErrors" to false
}
plots.setType<DataPlot>()
+plotResidual("sterile_1", "U2" to 1e-3)
+plotResidual("sterile_3", "msterile2" to (3000 * 3000).toDouble(), "U2" to 1e-3)
+plotResidual("X", "X" to 0.11)
+plotResidual("trap", "trap" to 0.99)
}*/
context.plot("fit", stage = "plots") {
plots.configure {
"showLine" to true
@ -162,20 +135,24 @@ fun main(args: Array<String>) {
"thickness" to 4.0
}
plots.setType<DataPlot>()
launch {
+plotResidual("trap", "trap" to 0.99)
+plotFitResidual("trap_fit", "trap" to 0.99)
}
launch {
try {
+plotFitResidual("trap_fit", "trap" to 0.99)
} catch (ex: Exception) {
context.logger.error("Failed to do fit", ex)
}
}
+plotResidual("X", "X" to 0.11)
launch {
+plotFitResidual("X_fit", "X" to 0.11)
}
launch {
+plotResidual("sterile_1", "U2" to 1e-3)
launch {
+plotFitResidual("sterile_1_fit", "U2" to 1e-3)
}
launch {
+plotResidual("sterile_3", "msterile2" to (3000 * 3000).toDouble(), "U2" to 1e-3)
launch {
+plotFitResidual("sterile_3_fit", "msterile2" to (3000 * 3000).toDouble(), "U2" to 1e-3)
}