Minor fixes

This commit is contained in:
Alexander Nozik 2017-10-23 18:02:46 +03:00
parent 4655449966
commit edfa40ccdb
6 changed files with 32 additions and 15 deletions

View File

@ -37,7 +37,7 @@ 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) generate(t0: 3e4)
subtract(reference: 18500) subtract(reference: 18500)
fit(xlow: 450, xHigh: 700, upper: 3100, binning: 20) fit(xLow: 450, xHigh: 700, upper: 3100, binning: 20)
} }
@ -90,7 +90,7 @@ shell.eval {
Table correctionTable = TableTransform.filter( Table correctionTable = TableTransform.filter(
UnderflowFitter.fitAllPoints( UnderflowFitter.fitAllPoints(
spectraMap, spectraMap,
meta["fit.xlow"] as int, meta["fit.xLow"] as int,
xHigh, xHigh,
meta["fit.upper"] as int, meta["fit.upper"] as int,
meta["fit.binning"] as int meta["fit.binning"] as int
@ -105,7 +105,28 @@ shell.eval {
} }
Platform.runLater { Platform.runLater {
(plots as PlotHelper).plot(correctionTable, new XYAdapter("U", "correction"), "upper_${xHigh}", "Correction") (plots as PlotHelper).plot(correctionTable, new XYAdapter("U", "correction"), "upper_${xHigh}", "upper")
}
}
[400, 450, 500].each { xLow ->
println "Caclculate correctuion for lower linearity bound: ${xLow}"
Table correctionTable = TableTransform.filter(
UnderflowFitter.fitAllPoints(
spectraMap,
xLow,
meta["fit.xHigh"] as int,
meta["fit.upper"] as int,
meta["fit.binning"] as int
),
"correction",
0,
2
)
Platform.runLater {
(plots as PlotHelper).plot(correctionTable, new XYAdapter("U", "correction"), "lower_${xLow}", "lower")
} }
} }
} }

View File

@ -20,7 +20,7 @@ public class NumassIntegrator {
private static UnivariateIntegrator defaultIntegrator; private static UnivariateIntegrator defaultIntegrator;
private static UnivariateIntegrator highDensityIntegrator; private static UnivariateIntegrator highDensityIntegrator;
public static UnivariateIntegrator getFastInterator() { public synchronized static UnivariateIntegrator getFastInterator() {
if (fastInterator == null) { if (fastInterator == null) {
LoggerFactory.getLogger(NumassIntegrator.class).debug("Creating fast integrator"); LoggerFactory.getLogger(NumassIntegrator.class).debug("Creating fast integrator");
fastInterator = new GaussRuleIntegrator((int) (mult * 100)); fastInterator = new GaussRuleIntegrator((int) (mult * 100));
@ -28,7 +28,7 @@ public class NumassIntegrator {
return fastInterator; return fastInterator;
} }
public static UnivariateIntegrator getDefaultIntegrator() { public synchronized static UnivariateIntegrator getDefaultIntegrator() {
if (defaultIntegrator == null) { if (defaultIntegrator == null) {
LoggerFactory.getLogger(NumassIntegrator.class).debug("Creating default integrator"); LoggerFactory.getLogger(NumassIntegrator.class).debug("Creating default integrator");
defaultIntegrator = new GaussRuleIntegrator((int) (mult * 300)); defaultIntegrator = new GaussRuleIntegrator((int) (mult * 300));
@ -36,7 +36,7 @@ public class NumassIntegrator {
return defaultIntegrator; return defaultIntegrator;
} }
public static UnivariateIntegrator getHighDensityIntegrator() { public synchronized static UnivariateIntegrator getHighDensityIntegrator() {
if (highDensityIntegrator == null) { if (highDensityIntegrator == null) {
LoggerFactory.getLogger(NumassIntegrator.class).debug("Creating high precision integrator"); LoggerFactory.getLogger(NumassIntegrator.class).debug("Creating high precision integrator");
highDensityIntegrator = new GaussRuleIntegrator((int) (mult * 500)); highDensityIntegrator = new GaussRuleIntegrator((int) (mult * 500));

View File

@ -29,13 +29,13 @@ class NumassFitScanSummaryTask : AbstractTask<Table>() {
override fun run(model: TaskModel, data: DataNode<*>): DataNode<Table> { override fun run(model: TaskModel, data: DataNode<*>): DataNode<Table> {
val builder = DataSet.builder(Table::class.java) val builder = DataSet.builder(Table::class.java)
val action = FitSummaryAction() val action = FitSummaryAction()
val input = data.getCheckedNode("fitscan", FitResult::class.java) val input = data.checked(FitResult::class.java)
input.nodeStream().filter { it -> it.dataSize(false) > 0 }.forEach { node -> builder.putData(node.name, action.run(model.context, node, model.meta()).data) } input.nodeStream().filter { it -> it.dataSize(false) > 0 }.forEach { node -> builder.putData(node.name, action.run(model.context, node, model.meta()).data) }
return builder.build() return builder.build()
} }
override fun buildModel(model: TaskModel.Builder, meta: Meta) { override fun buildModel(model: TaskModel.Builder, meta: Meta) {
model.dependsOn("fitscan", meta, "fitscan") model.dependsOn("fitscan", meta)
} }

View File

@ -72,11 +72,7 @@ class NumassFitScanTask : AbstractTask<FitResult>() {
override fun buildModel(model: TaskModel.Builder, meta: Meta) { override fun buildModel(model: TaskModel.Builder, meta: Meta) {
model.configure(meta.getMetaOrEmpty("scan")) model.configure(meta.getMetaOrEmpty("scan"))
model.configure { it -> it.putNode(meta.getMetaOrEmpty("fit")) } model.configure { it -> it.putNode(meta.getMetaOrEmpty("fit")) }
when { model.dependsOn("filter", meta)
meta.hasMeta("filter") -> model.dependsOn("filter", meta, "prepare")
meta.hasMeta("empty") -> model.dependsOn("subtractEmpty", meta, "prepare")
else -> model.dependsOn("prepare", meta, "prepare")
}
} }
override fun getName(): String { override fun getName(): String {

View File

@ -56,6 +56,6 @@ class NumassFitTask : SingleActionTask<Table, FitResult>() {
} }
override fun buildModel(model: TaskModel.Builder, meta: Meta) { override fun buildModel(model: TaskModel.Builder, meta: Meta) {
model.dependsOn("transform", meta); model.dependsOn("filter", meta);
} }
} }

View File

@ -33,7 +33,7 @@ class NumassTableFilterTask : SingleActionTask<Table, Table>() {
override fun buildModel(model: TaskModel.Builder, meta: Meta) { override fun buildModel(model: TaskModel.Builder, meta: Meta) {
if (meta.hasMeta("empty")) { if (meta.hasMeta("empty")) {
model.dependsOn("did", meta) model.dependsOn("dif", meta)
} else { } else {
model.dependsOn("transform", meta) model.dependsOn("transform", meta)
} }