Histogram builder

This commit is contained in:
darksnake 2017-06-29 16:57:17 +03:00
parent c08e52a398
commit 7f89c69643
3 changed files with 17 additions and 8 deletions

View File

@ -6,6 +6,7 @@
package inr.numass;
import hep.dataforge.context.Global;
import org.jetbrains.annotations.Nullable;
import java.io.File;
import java.io.FileInputStream;
@ -41,12 +42,16 @@ public class NumassProperties {
}
}
public synchronized static void setNumassProperty(String key, String value) {
public synchronized static void setNumassProperty(String key, @Nullable String value) {
try {
Properties props = new Properties();
File store = getNumassPropertiesFile();
props.load(new FileInputStream(store));
props.setProperty(key, value);
if(value == null){
props.remove(key);
} else {
props.setProperty(key, value);
}
props.store(new FileOutputStream(store), "");
} catch (IOException ex) {
Global.instance().getLogger().error("Failed to save numass properties", ex);

View File

@ -29,13 +29,13 @@ shell.eval {
NumassStorage storage = NumassStorageFactory.buildLocal(rootDir);
def hv = 15000;
def hv = 14000;
def point = storage.provide("loader::set_2/rawPoint::$hv", RawNMPoint.class).get();
def t0 = (1..150).collect { 5.5e-6 + 2e-7 * it }
def plotPoints = t0.collect {
def result = PointAnalyzer.analyzePoint(point, it,500,3100)
def result = PointAnalyzer.analyzePoint(point, it)
MapPoint.fromMap("x.value": it, "y.value": result.cr, "y.err": result.crErr);
}
//def cr = t0.collect { PointAnalyzer.analyzePoint(point, it).cr }

View File

@ -70,10 +70,14 @@ class MainView : View("Numass data viewer") {
val chooser = DirectoryChooser()
chooser.title = "Select numass storage root"
val storageRoot = NumassProperties.getNumassProperty("numass.storage.root")
if (storageRoot == null) {
chooser.initialDirectory = File(".").absoluteFile
} else {
chooser.initialDirectory = File(storageRoot)
try {
if (storageRoot == null) {
chooser.initialDirectory = File(".").absoluteFile
} else {
chooser.initialDirectory = File(storageRoot)
}
} catch (ex: Exception){
NumassProperties.setNumassProperty("numass.storage.root", null)
}
val rootDir = chooser.showDialog(primaryStage.scene.window)