diff --git a/numass-control/src/main/kotlin/inr/numass/control/NumassControlUtils.kt b/numass-control/src/main/kotlin/inr/numass/control/NumassControlUtils.kt index 8da6c718..e91216d8 100644 --- a/numass-control/src/main/kotlin/inr/numass/control/NumassControlUtils.kt +++ b/numass-control/src/main/kotlin/inr/numass/control/NumassControlUtils.kt @@ -16,8 +16,9 @@ import javafx.application.Application import javafx.scene.image.Image import javafx.stage.Stage import org.slf4j.LoggerFactory -import java.io.File import java.io.IOException +import java.nio.file.Files +import java.nio.file.Paths import java.text.ParseException import java.util.* import java.util.function.Predicate @@ -82,11 +83,11 @@ fun getConfig(app: Application): Optional { logger.info("Configuration path not defined. Loading configuration from {}", DEFAULT_CONFIG_LOCATION) configFileName = DEFAULT_CONFIG_LOCATION } - val configFile = File(configFileName) + val configFile = Paths.get(configFileName) - if (configFile.exists()) { + if (Files.exists(configFile)) { try { - val config = MetaFileReader.read(configFile).build() + val config = MetaFileReader.read(configFile) return Optional.of(config) } catch (e: IOException) { throw RuntimeException(e) diff --git a/numass-core/src/main/java/inr/numass/data/storage/ProtoNumassPoint.java b/numass-core/src/main/java/inr/numass/data/storage/ProtoNumassPoint.java index e5a8f8fb..60b7a47e 100644 --- a/numass-core/src/main/java/inr/numass/data/storage/ProtoNumassPoint.java +++ b/numass-core/src/main/java/inr/numass/data/storage/ProtoNumassPoint.java @@ -2,12 +2,12 @@ package inr.numass.data.storage; import hep.dataforge.io.envelopes.Envelope; import hep.dataforge.meta.Meta; -import hep.dataforge.storage.filestorage.FileEnvelope; import inr.numass.data.NumassProto; import inr.numass.data.api.NumassBlock; import inr.numass.data.api.NumassEvent; import inr.numass.data.api.NumassFrame; import inr.numass.data.api.NumassPoint; +import inr.numass.data.legacy.NumassFileEnvelope; import java.io.IOException; import java.io.InputStream; @@ -25,7 +25,7 @@ import java.util.stream.Stream; */ public class ProtoNumassPoint implements NumassPoint { public static ProtoNumassPoint readFile(Path path) { - return new ProtoNumassPoint(FileEnvelope.open(path, true)); + return new ProtoNumassPoint(NumassFileEnvelope.open(path, true)); } diff --git a/numass-main/src/main/groovy/inr/numass/scripts/times/TestPointAnalyzer.groovy b/numass-main/src/main/groovy/inr/numass/scripts/times/TestPointAnalyzer.groovy index 907020bb..84b736a3 100644 --- a/numass-main/src/main/groovy/inr/numass/scripts/times/TestPointAnalyzer.groovy +++ b/numass-main/src/main/groovy/inr/numass/scripts/times/TestPointAnalyzer.groovy @@ -31,12 +31,12 @@ new GrindShell(ctx).eval { def set = "set_2" - def hv = 18300; + def hv = 14000; def loader = storage.provide("loader::$set", NumassSet.class).get(); def point = loader.provide("$hv", NumassPoint.class).get() def loChannel = 450; - def upChannel = 3100; + def upChannel = 1800; def histogram = PointAnalyzer.histogram(point, loChannel, upChannel, 1, 500).asTable(); diff --git a/numass-main/src/main/groovy/inr/numass/scripts/times/TestProto.groovy b/numass-main/src/main/groovy/inr/numass/scripts/times/TestProto.groovy index bbaf552f..79a82d51 100644 --- a/numass-main/src/main/groovy/inr/numass/scripts/times/TestProto.groovy +++ b/numass-main/src/main/groovy/inr/numass/scripts/times/TestProto.groovy @@ -20,9 +20,11 @@ ctx.pluginManager().load(NumassPlugin.class) new GrindShell(ctx).eval { PlotHelper plot = plots - NumassPoint point = ProtoNumassPoint.readFile(Paths.get("D:\\Work\\Numass\\data\\2017_05\\Fill_3_events\\set_33\\p0(30s)(HV1=16000).df")) + //NumassPoint point = ProtoNumassPoint.readFile(Paths.get("D:\\Work\\Numass\\data\\test\\40_kHz_5s.df")) + NumassPoint point = ProtoNumassPoint.readFile(Paths.get("D:\\Work\\Numass\\data\\2017_05_frames\\Fill_3_events\\set_33\\p102(30s)(HV1=14000).df")) + //NumassPoint point = ProtoNumassPoint.readFile(Paths.get("D:\\Work\\Numass\\data\\2017_05_frames\\Fill_3_events\\set_33\\p0(30s)(HV1=16000).df")) - def loChannel = 0; + def loChannel = 500; def upChannel = 10000; def histogram = PointAnalyzer.histogram(point, loChannel, upChannel, 0.2, 1000).asTable(); @@ -35,7 +37,7 @@ new GrindShell(ctx).eval { } plot.plot(name: "test", frame: "histogram", showLine: true, showSymbol: false, showErrors: false, connectionType: "step", histogram, { - adapter("x.value": "x", "y.value": "count") + adapter("y.value": "count") }) def trueCR = PointAnalyzer.analyze(point, t0: 30e3, "window.lo": loChannel, "window.up": upChannel).getDouble("cr") @@ -47,7 +49,7 @@ new GrindShell(ctx).eval { def statPlotPoints = t0.collect { def result = PointAnalyzer.analyze(point, t0: it, "window.lo": loChannel, "window.up": upChannel) - ValueMap.ofMap("x": it / 1000, "y": result.getDouble("cr"), "y.err": result.getDouble(NumassAnalyzer.COUNT_RATE_ERROR_KEY)); + ValueMap.ofMap(x: it / 1000, y: result.getDouble("cr"), "y.err": result.getDouble(NumassAnalyzer.COUNT_RATE_ERROR_KEY)); } plot.plot(name: "total", frame: "stat-method", showLine: true, thickness: 4, statPlotPoints)