minor fixes

This commit is contained in:
Alexander Nozik 2017-09-18 15:32:21 +03:00
parent 2e8d0b03ca
commit dfbc1c6f5a
4 changed files with 15 additions and 12 deletions

View File

@ -16,8 +16,9 @@ import javafx.application.Application
import javafx.scene.image.Image import javafx.scene.image.Image
import javafx.stage.Stage import javafx.stage.Stage
import org.slf4j.LoggerFactory import org.slf4j.LoggerFactory
import java.io.File
import java.io.IOException import java.io.IOException
import java.nio.file.Files
import java.nio.file.Paths
import java.text.ParseException import java.text.ParseException
import java.util.* import java.util.*
import java.util.function.Predicate import java.util.function.Predicate
@ -82,11 +83,11 @@ fun getConfig(app: Application): Optional<Meta> {
logger.info("Configuration path not defined. Loading configuration from {}", DEFAULT_CONFIG_LOCATION) logger.info("Configuration path not defined. Loading configuration from {}", DEFAULT_CONFIG_LOCATION)
configFileName = DEFAULT_CONFIG_LOCATION configFileName = DEFAULT_CONFIG_LOCATION
} }
val configFile = File(configFileName) val configFile = Paths.get(configFileName)
if (configFile.exists()) { if (Files.exists(configFile)) {
try { try {
val config = MetaFileReader.read(configFile).build() val config = MetaFileReader.read(configFile)
return Optional.of(config) return Optional.of(config)
} catch (e: IOException) { } catch (e: IOException) {
throw RuntimeException(e) throw RuntimeException(e)

View File

@ -2,12 +2,12 @@ package inr.numass.data.storage;
import hep.dataforge.io.envelopes.Envelope; import hep.dataforge.io.envelopes.Envelope;
import hep.dataforge.meta.Meta; import hep.dataforge.meta.Meta;
import hep.dataforge.storage.filestorage.FileEnvelope;
import inr.numass.data.NumassProto; import inr.numass.data.NumassProto;
import inr.numass.data.api.NumassBlock; import inr.numass.data.api.NumassBlock;
import inr.numass.data.api.NumassEvent; import inr.numass.data.api.NumassEvent;
import inr.numass.data.api.NumassFrame; import inr.numass.data.api.NumassFrame;
import inr.numass.data.api.NumassPoint; import inr.numass.data.api.NumassPoint;
import inr.numass.data.legacy.NumassFileEnvelope;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
@ -25,7 +25,7 @@ import java.util.stream.Stream;
*/ */
public class ProtoNumassPoint implements NumassPoint { public class ProtoNumassPoint implements NumassPoint {
public static ProtoNumassPoint readFile(Path path) { public static ProtoNumassPoint readFile(Path path) {
return new ProtoNumassPoint(FileEnvelope.open(path, true)); return new ProtoNumassPoint(NumassFileEnvelope.open(path, true));
} }

View File

@ -31,12 +31,12 @@ new GrindShell(ctx).eval {
def set = "set_2" def set = "set_2"
def hv = 18300; def hv = 14000;
def loader = storage.provide("loader::$set", NumassSet.class).get(); def loader = storage.provide("loader::$set", NumassSet.class).get();
def point = loader.provide("$hv", NumassPoint.class).get() def point = loader.provide("$hv", NumassPoint.class).get()
def loChannel = 450; def loChannel = 450;
def upChannel = 3100; def upChannel = 1800;
def histogram = PointAnalyzer.histogram(point, loChannel, upChannel, 1, 500).asTable(); def histogram = PointAnalyzer.histogram(point, loChannel, upChannel, 1, 500).asTable();

View File

@ -20,9 +20,11 @@ ctx.pluginManager().load(NumassPlugin.class)
new GrindShell(ctx).eval { new GrindShell(ctx).eval {
PlotHelper plot = plots 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 upChannel = 10000;
def histogram = PointAnalyzer.histogram(point, loChannel, upChannel, 0.2, 1000).asTable(); 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, { 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") 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 statPlotPoints = t0.collect {
def result = PointAnalyzer.analyze(point, t0: it, "window.lo": loChannel, "window.up": upChannel) 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) plot.plot(name: "total", frame: "stat-method", showLine: true, thickness: 4, statPlotPoints)