PKT8 to kotlin complete

This commit is contained in:
Alexander Nozik 2017-05-31 22:09:44 +03:00
parent 45658ed961
commit debd4a707d
6 changed files with 27 additions and 17 deletions

View File

@ -78,6 +78,7 @@ class PKT8ViewConnection : DeviceViewConnection<PKT8Device>(), MeasurementListen
addLogHandler(device.logger)
})
// need those to have strong references to listeners
private val plotView = CryoPlotView();
private val plotWindow = FragmentWindow(FXFragment.buildFromNode(plotView.title) { plotView.root })

View File

@ -28,15 +28,17 @@ import inr.numass.debunch.FrameAnalizer;
import java.io.PrintWriter;
import static hep.dataforge.values.ValueType.NUMBER;
/**
* @author Darksnake
*/
@TypedActionDef(name = "debunch", inputType = RawNMFile.class, outputType = RawNMFile.class)
@ValueDef(name = "upperchanel", type = "NUMBER", def = "4095", info = "An upper chanel for debuncing")
@ValueDef(name = "lowerchanel", type = "NUMBER", def = "0", info = "A lower chanel for debuncing")
@ValueDef(name = "rejectprob", type = "NUMBER", def = "1e-5", info = "Rejection probability")
@ValueDef(name = "framelength", type = "NUMBER", def = "5", info = "Frame length in seconds")
@ValueDef(name = "maxcr", type = "NUMBER", def = "100", info = "Maximum count rate for debunching")
@ValueDef(name = "upperchanel", type = {NUMBER}, def = "4095", info = "An upper chanel for debuncing")
@ValueDef(name = "lowerchanel", type = {NUMBER}, def = "0", info = "A lower chanel for debuncing")
@ValueDef(name = "rejectprob", type = {NUMBER}, def = "1e-5", info = "Rejection probability")
@ValueDef(name = "framelength", type = {NUMBER}, def = "5", info = "Frame length in seconds")
@ValueDef(name = "maxcr", type = {NUMBER}, def = "100", info = "Maximum count rate for debunching")
public class DebunchAction extends OneToOneAction<RawNMFile, RawNMFile> {
@Override

View File

@ -37,11 +37,13 @@ import java.util.Map.Entry;
import java.util.TreeMap;
import java.util.concurrent.CopyOnWriteArrayList;
import static hep.dataforge.values.ValueType.NUMBER;
/**
* @author Darksnake
*/
@TypedActionDef(name = "monitor", inputType = Table.class, outputType = Table.class)
@ValueDef(name = "monitorPoint", type = "NUMBER", required = true, info = "The Uset for monitor point")
@ValueDef(name = "monitorPoint", type = {NUMBER}, required = true, info = "The Uset for monitor point")
@ValueDef(name = "monitorFile", info = "The outputfile for monitor points", def = "monitor.onComplete")
@ValueDef(name = "calculateRelative", info = "Calculate count rate relative to average monitor point", def = "false")
public class MonitorCorrectAction extends OneToOneAction<Table, Table> {

View File

@ -44,16 +44,18 @@ import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
import static hep.dataforge.values.ValueType.NUMBER;
import static hep.dataforge.values.ValueType.STRING;
import static inr.numass.utils.TritiumUtils.pointExpression;
/**
* @author Darksnake
*/
@TypedActionDef(name = "prepareData", inputType = NumassData.class, outputType = Table.class)
@ValueDef(name = "lowerWindow", type = "NUMBER", def = "0", info = "Base for the window lowerWindow bound")
@ValueDef(name = "lowerWindowSlope", type = "NUMBER", def = "0", info = "Slope for the window lowerWindow bound")
@ValueDef(name = "upperWindow", type = "NUMBER", info = "Upper bound for window")
@ValueDef(name = "deadTime", type = "[NUMBER, STRING]", info = "Dead time in s. Could be an expression.")
@ValueDef(name = "lowerWindow", type = {NUMBER}, def = "0", info = "Base for the window lowerWindow bound")
@ValueDef(name = "lowerWindowSlope", type = {NUMBER}, def = "0", info = "Slope for the window lowerWindow bound")
@ValueDef(name = "upperWindow", type = {NUMBER}, info = "Upper bound for window")
@ValueDef(name = "deadTime", type = {NUMBER, STRING}, info = "Dead time in s. Could be an expression.")
@ValueDef(name = "correction",
info = "An expression to correct count number depending on potential `U`, point length `T` and point itself as `point`")
@ValueDef(name = "utransform", info = "Expression for voltage transformation. Uses U as input")
@ -103,9 +105,9 @@ public class PrepareDataAction extends OneToOneAction<NumassData, Table> {
utransform = Function.identity();
}
if(meta.hasMeta("debunch")){
if(dataFile instanceof NumassDataLoader){
dataFile = ((NumassDataLoader) dataFile).applyRawTransformation(raw->debunch(context,raw,meta.getMeta("debunch")));
if (meta.hasMeta("debunch")) {
if (dataFile instanceof NumassDataLoader) {
dataFile = ((NumassDataLoader) dataFile).applyRawTransformation(raw -> debunch(context, raw, meta.getMeta("debunch")));
} else {
throw new RuntimeException("Debunch not available");
}
@ -173,8 +175,8 @@ public class PrepareDataAction extends OneToOneAction<NumassData, Table> {
}
@ValueDef(name = "value", type = "[NUMBER, STRING]", info = "Value or function to multiply count rate")
@ValueDef(name = "err", type = "[NUMBER, STRING]", info = "error of the value")
@ValueDef(name = "value", type = {NUMBER, STRING}, info = "Value or function to multiply count rate")
@ValueDef(name = "err", type = {NUMBER, STRING}, info = "error of the value")
private Correction makeCorrection(Meta corrMeta) {
final String expr = corrMeta.getString("value");
final String errExpr = corrMeta.getString("err", "");

View File

@ -26,6 +26,7 @@ import hep.dataforge.meta.Laminate;
import inr.numass.data.NMFile;
import inr.numass.data.RawNMFile;
import static hep.dataforge.values.ValueType.NUMBER;
import static inr.numass.NumassIO.getNumassData;
/**
@ -36,7 +37,7 @@ import static inr.numass.NumassIO.getNumassData;
inputType = Binary.class, outputType = NMFile.class, info = "Read binary numass data file")
@ValueDef(name = "fileName", info = "The name of the file. By default equals file name.")
@ValueDef(name = "HVdev", info = "Divider for HV measurements. Should be set to 1.0 for numass data 2014",
def = "2.468555393226049", type = "NUMBER")
def = "2.468555393226049", type = {NUMBER})
@ValueDef(name = "noUset", info = "If 'true', then Uset = Uread")
@NodeDef(name = "debunch", target = "class::inr.numass.actions.DebunchAction", info = "If given, governs debunching")
public class ReadLegacyDataAction extends OneToOneAction<Binary, NMFile> {

View File

@ -24,6 +24,8 @@ import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import static hep.dataforge.values.ValueType.BOOLEAN;
/**
* Compact all-in-one model for sterile neutrino spectrum
*
@ -32,7 +34,7 @@ import java.io.InputStream;
@NodeDef(name = "resolution")
@NodeDef(name = "transmission")
@ValueDef(name = "fssFile", info = "The name for external FSS file. By default internal FSS file is used")
@ValueDef(name = "useFSS", type = "BOOLEAN")
@ValueDef(name = "useFSS", type = {BOOLEAN})
public class SterileNeutrinoSpectrum extends AbstractParametricFunction {
private static final String[] list = {"X", "trap", "E0", "mnu2", "msterile2", "U2"};