Minor fixes

This commit is contained in:
Alexander Nozik 2017-10-23 14:38:44 +03:00
parent 44ebe4680a
commit 4655449966
2 changed files with 18 additions and 17 deletions

View File

@ -13,9 +13,10 @@ import hep.dataforge.data.DataNode
import hep.dataforge.grind.GrindShell import hep.dataforge.grind.GrindShell
import hep.dataforge.grind.helpers.PlotHelper import hep.dataforge.grind.helpers.PlotHelper
import hep.dataforge.io.ColumnedDataWriter import hep.dataforge.io.ColumnedDataWriter
import hep.dataforge.kodex.fx.plots.PlotManager
import hep.dataforge.meta.Meta import hep.dataforge.meta.Meta
import hep.dataforge.plots.PlotGroup
import hep.dataforge.plots.data.DataPlot import hep.dataforge.plots.data.DataPlot
import hep.dataforge.plots.data.PlottableGroup
import hep.dataforge.tables.Table import hep.dataforge.tables.Table
import hep.dataforge.tables.TableTransform import hep.dataforge.tables.TableTransform
import hep.dataforge.tables.XYAdapter import hep.dataforge.tables.XYAdapter
@ -28,9 +29,9 @@ import static inr.numass.data.api.NumassAnalyzer.CHANNEL_KEY
import static inr.numass.data.api.NumassAnalyzer.COUNT_RATE_KEY import static inr.numass.data.api.NumassAnalyzer.COUNT_RATE_KEY
Context ctx = Global.instance() Context ctx = Global.instance()
ctx.pluginManager().load(FXPlotManager) ctx.pluginManager().load(PlotManager)
ctx.pluginManager().load(NumassPlugin.class) ctx.pluginManager().load(NumassPlugin)
ctx.pluginManager().load(CachePlugin.class) ctx.pluginManager().load(CachePlugin)
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}")
@ -63,7 +64,7 @@ shell.eval {
//Showing selected points //Showing selected points
def showPoints = { Map points, int binning = 20, int loChannel = 300, int upChannel = 2000 -> def showPoints = { Map points, int binning = 20, int loChannel = 300, int upChannel = 2000 ->
PlottableGroup<DataPlot> plotGroup = new PlottableGroup<>(); def plotGroup = new PlotGroup("points");
def adapter = new XYAdapter(CHANNEL_KEY, COUNT_RATE_KEY) def adapter = new XYAdapter(CHANNEL_KEY, COUNT_RATE_KEY)
points.each { points.each {
plotGroup.add( plotGroup.add(
@ -79,7 +80,7 @@ shell.eval {
plotGroup.configure(showLine: true, showSymbol: false, showErrors: false, connectionType: "step") plotGroup.configure(showLine: true, showSymbol: false, showErrors: false, connectionType: "step")
def frame = (plots as PlotHelper).getManager().getPlotFrame("Spectra") def frame = (plots as PlotHelper).getManager().getPlotFrame("Spectra")
frame.configureValue("yAxis.type", "log") frame.configureValue("yAxis.type", "log")
frame.addAll(plotGroup) frame.add(plotGroup)
} }
showPoints(spectraMap.findAll { it.key in [16200d, 16400d, 16800d, 17000d, 17200d, 17700d] }) showPoints(spectraMap.findAll { it.key in [16200d, 16400d, 16800d, 17000d, 17200d, 17700d] })
@ -99,14 +100,12 @@ shell.eval {
2 2
) )
if(xHigh == 700){ if (xHigh == 700) {
ColumnedDataWriter.writeTable(System.out, correctionTable, "underflow parameters") ColumnedDataWriter.writeTable(System.out, correctionTable, "underflow parameters")
} }
Platform.runLater { Platform.runLater {
(plots as PlotHelper).plot(correctionTable, name: "upper_${xHigh}", frame: "Correction") { (plots as PlotHelper).plot(correctionTable, new XYAdapter("U", "correction"), "upper_${xHigh}", "Correction")
adapter("x.value": "U", "y.value": "correction")
}
} }
} }
} }

View File

@ -46,7 +46,7 @@ class UnderflowUtils {
def dataBuilder = DataSet.builder(NumassPoint); def dataBuilder = DataSet.builder(NumassPoint);
sets.sort { it.startTime } sets.sort { it.startTime }
.collectMany {NumassSet set -> set.points.collect() } .collectMany { NumassSet set -> set.points.collect() }
.groupBy { NumassPoint point -> point.voltage } .groupBy { NumassPoint point -> point.voltage }
.each { key, value -> .each { key, value ->
def point = new SimpleNumassPoint(key as double, value as List<NumassPoint>) def point = new SimpleNumassPoint(key as double, value as List<NumassPoint>)
@ -56,8 +56,10 @@ class UnderflowUtils {
DataNode<NumassPoint> data = dataBuilder.build() DataNode<NumassPoint> data = dataBuilder.build()
def generate = GrindPipe.<NumassPoint, Table> build(name: "generate") { def generate = GrindPipe.build("generate") {
return analyzer.getSpectrum(delegate.input as NumassPoint, delegate.meta) result { input ->
return analyzer.getSpectrum(input as NumassPoint, delegate.meta)
}
} }
DataNode<Table> spectra = generate.run(shell.context, data, meta.getMeta("generate")); DataNode<Table> spectra = generate.run(shell.context, data, meta.getMeta("generate"));