Multiple plot fixes.
This commit is contained in:
parent
115cf378e4
commit
56d2988eaf
@ -14,7 +14,6 @@ import hep.dataforge.data.DataSet
|
|||||||
import hep.dataforge.grind.GrindShell
|
import hep.dataforge.grind.GrindShell
|
||||||
import hep.dataforge.grind.actions.GrindPipe
|
import hep.dataforge.grind.actions.GrindPipe
|
||||||
import hep.dataforge.grind.helpers.PlotHelper
|
import hep.dataforge.grind.helpers.PlotHelper
|
||||||
import hep.dataforge.io.ColumnedDataWriter
|
|
||||||
import hep.dataforge.meta.Meta
|
import hep.dataforge.meta.Meta
|
||||||
import hep.dataforge.plots.data.PlottableData
|
import hep.dataforge.plots.data.PlottableData
|
||||||
import hep.dataforge.plots.data.PlottableGroup
|
import hep.dataforge.plots.data.PlottableGroup
|
||||||
@ -32,6 +31,7 @@ import inr.numass.data.api.NumassSet
|
|||||||
import inr.numass.data.api.SimpleNumassPoint
|
import inr.numass.data.api.SimpleNumassPoint
|
||||||
import inr.numass.data.storage.NumassStorage
|
import inr.numass.data.storage.NumassStorage
|
||||||
import inr.numass.data.storage.NumassStorageFactory
|
import inr.numass.data.storage.NumassStorageFactory
|
||||||
|
import javafx.application.Platform
|
||||||
|
|
||||||
import java.util.stream.Collectors
|
import java.util.stream.Collectors
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ ctx.pluginManager().load(CachePlugin.class)
|
|||||||
|
|
||||||
Meta meta = buildMeta {
|
Meta meta = buildMeta {
|
||||||
data(dir: "D:\\Work\\Numass\\data\\2017_05\\Fill_2", mask: "set_.{1,3}")
|
data(dir: "D:\\Work\\Numass\\data\\2017_05\\Fill_2", mask: "set_.{1,3}")
|
||||||
generate(t0: 3e4, sort: false)
|
generate(t0: 3e4, sort: true)
|
||||||
subtract(reference: 18600)
|
subtract(reference: 18600)
|
||||||
fit(xlow: 450, xHigh: 700, upper: 3100, binning: 20)
|
fit(xlow: 450, xHigh: 700, upper: 3100, binning: 20)
|
||||||
}
|
}
|
||||||
@ -91,21 +91,25 @@ new GrindShell(ctx).eval {
|
|||||||
}
|
}
|
||||||
|
|
||||||
DataNode<Table> spectra = generate.run(context, data, meta.getMeta("generate"));
|
DataNode<Table> spectra = generate.run(context, data, meta.getMeta("generate"));
|
||||||
spectra = context.getFeature(CachePlugin).cacheNode("underflow", meta, spectra)
|
Meta id = buildMeta {
|
||||||
|
put meta.getMeta("data")
|
||||||
|
put meta.getMeta("generate")
|
||||||
|
}
|
||||||
|
spectra = context.getFeature(CachePlugin).cacheNode("underflow", id, spectra)
|
||||||
|
|
||||||
//subtracting reference point
|
//subtracting reference point
|
||||||
Map<Double, Table> spectraMap
|
Map<Double, Table> spectraMap
|
||||||
if (meta.hasValue("subtract.reference")) {
|
if (meta.hasValue("subtract.reference")) {
|
||||||
String referenceVoltage = meta["subtract.reference"].stringValue()
|
String referenceVoltage = meta["subtract.reference"]
|
||||||
println "subtracting reference point ${referenceVoltage}"
|
println "subtracting reference point ${referenceVoltage}"
|
||||||
def referencePoint = spectra.compute(referenceVoltage)
|
def referencePoint = spectra.compute(referenceVoltage)
|
||||||
spectraMap = spectra
|
spectraMap = spectra
|
||||||
.findAll { it.name != referenceVoltage }
|
.findAll { it.name != referenceVoltage }
|
||||||
.collectEntries {
|
.collectEntries {
|
||||||
[(it.meta["voltage"].doubleValue()): NumassDataUtils.subtractSpectrum(it.get(), referencePoint)]
|
[(it.meta["voltage"]): NumassDataUtils.subtractSpectrum(it.get(), referencePoint)]
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
spectraMap = spectra.collectEntries { return [(it.meta["voltage"].doubleValue()): it.get()] }
|
spectraMap = spectra.collectEntries { return [(it.meta["voltage"]): it.get()] }
|
||||||
}
|
}
|
||||||
|
|
||||||
//Showing selected points
|
//Showing selected points
|
||||||
@ -131,22 +135,27 @@ new GrindShell(ctx).eval {
|
|||||||
|
|
||||||
showPoints(spectraMap.findAll { it.key in [16200d, 16400d, 16800d, 17000d, 17200d, 17700d] })
|
showPoints(spectraMap.findAll { it.key in [16200d, 16400d, 16800d, 17000d, 17200d, 17700d] })
|
||||||
|
|
||||||
|
[550, 600, 650, 750].each { xHigh ->
|
||||||
|
println "Caclculate correctuion for upper linearity bound: ${xHigh}"
|
||||||
Table correctionTable = TableTransform.filter(
|
Table correctionTable = TableTransform.filter(
|
||||||
UnderflowFitter.fitAllPoints(
|
UnderflowFitter.fitAllPoints(
|
||||||
spectraMap,
|
spectraMap,
|
||||||
meta["fit.xlow"].intValue(),
|
meta["fit.xlow"] as int,
|
||||||
meta["fit.xHigh"].intValue(),
|
xHigh,
|
||||||
meta["fit.upper"].intValue(),
|
meta["fit.upper"] as int,
|
||||||
meta["fit.binning"].intValue()
|
meta["fit.binning"] as int
|
||||||
),
|
),
|
||||||
"correction",
|
"correction",
|
||||||
0,
|
0,
|
||||||
2
|
2
|
||||||
)
|
)
|
||||||
|
|
||||||
ColumnedDataWriter.writeTable(System.out, correctionTable, "underflow parameters")
|
// ColumnedDataWriter.writeTable(System.out, correctionTable, "underflow parameters")
|
||||||
|
|
||||||
(plots as PlotHelper).plot(correctionTable, name: "correction", frame: "Correction") {
|
Platform.runLater {
|
||||||
|
(plots as PlotHelper).plot(correctionTable, name: "upper_${xHigh}", frame: "Correction") {
|
||||||
adapter("x.value": "U", "y.value": "correction")
|
adapter("x.value": "U", "y.value": "correction")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -68,7 +68,7 @@ public class PlotFitResultAction extends OneToOneAction<FitResult, FitResult> {
|
|||||||
Function<Double, Double> function = (x) -> model.getSpectrum().value(x, input.getParameters());
|
Function<Double, Double> function = (x) -> model.getSpectrum().value(x, input.getParameters());
|
||||||
|
|
||||||
PlotFrame frame = PlotUtils.getPlotManager(context)
|
PlotFrame frame = PlotUtils.getPlotManager(context)
|
||||||
.buildPlotFrame(getName(), name, metaData.getMeta("plot", Meta.empty()));
|
.getPlotFrame(getName(), name, metaData.getMeta("plot", Meta.empty()));
|
||||||
|
|
||||||
PlottableXYFunction fit = new PlottableXYFunction("fit");
|
PlottableXYFunction fit = new PlottableXYFunction("fit");
|
||||||
fit.setDensity(100, false);
|
fit.setDensity(100, false);
|
||||||
|
Loading…
Reference in New Issue
Block a user