From 17f2470a03257e69ee599e36a07b40f09cb932c3 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Mon, 7 Aug 2017 21:30:07 +0300 Subject: [PATCH] Misc --- .../control/cryotemp/PKT8VirtualPort.java | 2 +- .../numass/data/analyzers/SmartAnalyzer.java | 27 ++++++++++++------- .../numass/scripts/PrintLossFunctions.groovy | 12 ++++----- 3 files changed, 24 insertions(+), 17 deletions(-) diff --git a/numass-control/cryotemp/src/main/java/inr/numass/control/cryotemp/PKT8VirtualPort.java b/numass-control/cryotemp/src/main/java/inr/numass/control/cryotemp/PKT8VirtualPort.java index 3b089181..d9117022 100644 --- a/numass-control/cryotemp/src/main/java/inr/numass/control/cryotemp/PKT8VirtualPort.java +++ b/numass-control/cryotemp/src/main/java/inr/numass/control/cryotemp/PKT8VirtualPort.java @@ -32,7 +32,7 @@ public class PKT8VirtualPort extends VirtualPort implements Metoid { case "s": String[] letters = {"a", "b", "c", "d", "e", "f", "g", "h"}; for (String letter : letters) { - Meta channelMeta = MetaUtils.findNodeByValue(meta(), "channel", "letter", Value.of(letter)); + Meta channelMeta = MetaUtils.findNodeByValue(meta(), "channel", "letter", Value.of(letter)).orElse(Meta.empty()); double average; double sigma; diff --git a/numass-core/src/main/java/inr/numass/data/analyzers/SmartAnalyzer.java b/numass-core/src/main/java/inr/numass/data/analyzers/SmartAnalyzer.java index ec310661..6c61e4a9 100644 --- a/numass-core/src/main/java/inr/numass/data/analyzers/SmartAnalyzer.java +++ b/numass-core/src/main/java/inr/numass/data/analyzers/SmartAnalyzer.java @@ -28,16 +28,23 @@ public class SmartAnalyzer extends AbstractAnalyzer { @Override public Values analyze(NumassBlock block, Meta config) { //TODO add result caching - //TODO do something more... smart... using information from point if block is point - switch (config.getString("type", "simple")) { - case "simple": - return simpleAnalyzer.analyze(block, config); - case "time": - return timeAnalyzer.analyze(block, config); - case "debunch": - return debunchAnalyzer.analyze(block, config); - default: - throw new IllegalArgumentException("Analyzer not found"); + if(config.hasValue("type")) { + switch (config.getString("type")) { + case "simple": + return simpleAnalyzer.analyze(block, config); + case "time": + return timeAnalyzer.analyze(block, config); + case "debunch": + return debunchAnalyzer.analyze(block, config); + default: + throw new IllegalArgumentException("Analyzer not found"); + } + } else { + if(config.hasValue("t0")){ + return timeAnalyzer.analyze(block,config); + } else { + return simpleAnalyzer.analyze(block,config); + } } } } diff --git a/numass-main/src/main/groovy/inr/numass/scripts/PrintLossFunctions.groovy b/numass-main/src/main/groovy/inr/numass/scripts/PrintLossFunctions.groovy index 54293e9e..a68b035e 100644 --- a/numass-main/src/main/groovy/inr/numass/scripts/PrintLossFunctions.groovy +++ b/numass-main/src/main/groovy/inr/numass/scripts/PrintLossFunctions.groovy @@ -10,7 +10,7 @@ import inr.numass.models.LossCalculator LossCalculator loss = LossCalculator.instance() -def X = 0.34 +def X = 0.36 def lossProbs = loss.getGunLossProbabilities(X); @@ -30,11 +30,11 @@ printf("%8s\t%8s\t%8s\t%8s\t%n", */ def singleScatter = loss.getSingleScatterFunction( - 12.587, - 11.11, - 1.20, - 11.02, - 2.43 + 12.860, + 16.62, + 1.71, + 12.09, + 4.59 ); for (double d = 0; d < 30; d += 0.3) {