Plots and Numass update
This commit is contained in:
parent
af3dcfe986
commit
1ec62e795d
@ -41,7 +41,7 @@ public class SpectrumDataAdapter extends XYAdapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public SpectrumDataAdapter(String xName, String yName, String yErrName, String measurementTime) {
|
public SpectrumDataAdapter(String xName, String yName, String yErrName, String measurementTime) {
|
||||||
super(new MetaBuilder(ValuesAdapter.DATA_ADAPTER_KEY)
|
super(new MetaBuilder(ValuesAdapter.ADAPTER_KEY)
|
||||||
.setValue(X_VALUE_KEY, xName)
|
.setValue(X_VALUE_KEY, xName)
|
||||||
.setValue(Y_VALUE_KEY, yName)
|
.setValue(Y_VALUE_KEY, yName)
|
||||||
.setValue(Y_ERROR_KEY, yErrName)
|
.setValue(Y_ERROR_KEY, yErrName)
|
||||||
@ -51,7 +51,7 @@ public class SpectrumDataAdapter extends XYAdapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public SpectrumDataAdapter(String xName, String yName, String measurementTime) {
|
public SpectrumDataAdapter(String xName, String yName, String measurementTime) {
|
||||||
super(new MetaBuilder(ValuesAdapter.DATA_ADAPTER_KEY)
|
super(new MetaBuilder(ValuesAdapter.ADAPTER_KEY)
|
||||||
.setValue(X_VALUE_KEY, xName)
|
.setValue(X_VALUE_KEY, xName)
|
||||||
.setValue(Y_VALUE_KEY, yName)
|
.setValue(Y_VALUE_KEY, yName)
|
||||||
.setValue(POINT_LENGTH_NAME, measurementTime)
|
.setValue(POINT_LENGTH_NAME, measurementTime)
|
||||||
|
@ -67,6 +67,7 @@ public abstract class AbstractAnalyzer implements NumassAnalyzer {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get table format for summary table
|
* Get table format for summary table
|
||||||
|
*
|
||||||
* @param config
|
* @param config
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -84,11 +85,11 @@ public abstract class AbstractAnalyzer implements NumassAnalyzer {
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Table analyze(NumassSet set, Meta config) {
|
public Table analyzeSet(NumassSet set, Meta config) {
|
||||||
TableFormat format = getTableFormat(config);
|
TableFormat format = getTableFormat(config);
|
||||||
|
|
||||||
return new ListTable.Builder(format)
|
return new ListTable.Builder(format)
|
||||||
.rows(set.getPoints().map(point -> analyze(point, config)))
|
.rows(set.getPoints().map(point -> analyzePoint(point, config)))
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,6 @@ import hep.dataforge.meta.Meta;
|
|||||||
import hep.dataforge.tables.ValueMap;
|
import hep.dataforge.tables.ValueMap;
|
||||||
import hep.dataforge.values.Values;
|
import hep.dataforge.values.Values;
|
||||||
import inr.numass.data.api.NumassBlock;
|
import inr.numass.data.api.NumassBlock;
|
||||||
import inr.numass.data.api.NumassPoint;
|
|
||||||
import inr.numass.data.api.SignalProcessor;
|
import inr.numass.data.api.SignalProcessor;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
@ -31,16 +30,6 @@ public class SimpleAnalyzer extends AbstractAnalyzer {
|
|||||||
double countRate = (double) count / length;
|
double countRate = (double) count / length;
|
||||||
double countRateError = Math.sqrt((double) count) / length;
|
double countRateError = Math.sqrt((double) count) / length;
|
||||||
|
|
||||||
if (block instanceof NumassPoint) {
|
|
||||||
return ValueMap.of(NAME_LIST_WITH_HV,
|
|
||||||
((NumassPoint) block).getVoltage(),
|
|
||||||
length,
|
|
||||||
count,
|
|
||||||
countRate,
|
|
||||||
countRateError,
|
|
||||||
new Integer[]{loChannel, upChannel},
|
|
||||||
block.getStartTime());
|
|
||||||
} else {
|
|
||||||
return ValueMap.of(NAME_LIST,
|
return ValueMap.of(NAME_LIST,
|
||||||
length,
|
length,
|
||||||
count,
|
count,
|
||||||
@ -49,7 +38,6 @@ public class SimpleAnalyzer extends AbstractAnalyzer {
|
|||||||
new Integer[]{loChannel, upChannel},
|
new Integer[]{loChannel, upChannel},
|
||||||
block.getStartTime());
|
block.getStartTime());
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import hep.dataforge.meta.Meta;
|
|||||||
import hep.dataforge.tables.TableFormat;
|
import hep.dataforge.tables.TableFormat;
|
||||||
import hep.dataforge.tables.TableFormatBuilder;
|
import hep.dataforge.tables.TableFormatBuilder;
|
||||||
import hep.dataforge.tables.ValueMap;
|
import hep.dataforge.tables.ValueMap;
|
||||||
|
import hep.dataforge.values.Value;
|
||||||
import hep.dataforge.values.Values;
|
import hep.dataforge.values.Values;
|
||||||
import inr.numass.data.api.NumassBlock;
|
import inr.numass.data.api.NumassBlock;
|
||||||
import inr.numass.data.api.NumassEvent;
|
import inr.numass.data.api.NumassEvent;
|
||||||
@ -12,6 +13,8 @@ import inr.numass.data.api.SignalProcessor;
|
|||||||
import javafx.util.Pair;
|
import javafx.util.Pair;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.concurrent.atomic.AtomicLong;
|
import java.util.concurrent.atomic.AtomicLong;
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
@ -27,7 +30,7 @@ public class TimeAnalyzer extends AbstractAnalyzer {
|
|||||||
public static String T0_KEY = "t0";
|
public static String T0_KEY = "t0";
|
||||||
|
|
||||||
public static String[] NAME_LIST = {LENGTH_KEY, COUNT_KEY, COUNT_RATE_KEY, COUNT_RATE_ERROR_KEY, WINDOW_KEY, TIME_KEY, T0_KEY};
|
public static String[] NAME_LIST = {LENGTH_KEY, COUNT_KEY, COUNT_RATE_KEY, COUNT_RATE_ERROR_KEY, WINDOW_KEY, TIME_KEY, T0_KEY};
|
||||||
public static String[] NAME_LIST_WITH_HV = {HV_KEY, LENGTH_KEY, COUNT_KEY, COUNT_RATE_KEY, COUNT_RATE_ERROR_KEY, WINDOW_KEY, TIME_KEY, T0_KEY};
|
// public static String[] NAME_LIST_WITH_HV = {HV_KEY, LENGTH_KEY, COUNT_KEY, COUNT_RATE_KEY, COUNT_RATE_ERROR_KEY, WINDOW_KEY, TIME_KEY, T0_KEY};
|
||||||
|
|
||||||
public TimeAnalyzer(@Nullable SignalProcessor processor) {
|
public TimeAnalyzer(@Nullable SignalProcessor processor) {
|
||||||
super(processor);
|
super(processor);
|
||||||
@ -38,6 +41,12 @@ public class TimeAnalyzer extends AbstractAnalyzer {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Values analyze(NumassBlock block, Meta config) {
|
public Values analyze(NumassBlock block, Meta config) {
|
||||||
|
//In case points inside points
|
||||||
|
if (block instanceof NumassPoint) {
|
||||||
|
return analyzePoint((NumassPoint) block, config);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int loChannel = config.getInt("window.lo", 0);
|
int loChannel = config.getInt("window.lo", 0);
|
||||||
int upChannel = config.getInt("window.up", Integer.MAX_VALUE);
|
int upChannel = config.getInt("window.up", Integer.MAX_VALUE);
|
||||||
long t0 = getT0(block, config);
|
long t0 = getT0(block, config);
|
||||||
@ -58,19 +67,6 @@ public class TimeAnalyzer extends AbstractAnalyzer {
|
|||||||
double length = totalT.get() / 1e9;
|
double length = totalT.get() / 1e9;
|
||||||
long count = (long) (length * countRate);
|
long count = (long) (length * countRate);
|
||||||
|
|
||||||
|
|
||||||
if (block instanceof NumassPoint) {
|
|
||||||
return ValueMap.of(NAME_LIST_WITH_HV,
|
|
||||||
((NumassPoint) block).getVoltage(),
|
|
||||||
length,
|
|
||||||
count,
|
|
||||||
countRate,
|
|
||||||
countRateError,
|
|
||||||
new Integer[]{loChannel, upChannel},
|
|
||||||
block.getStartTime(),
|
|
||||||
(double)t0 / 1000d
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
return ValueMap.of(NAME_LIST,
|
return ValueMap.of(NAME_LIST,
|
||||||
length,
|
length,
|
||||||
count,
|
count,
|
||||||
@ -81,6 +77,51 @@ public class TimeAnalyzer extends AbstractAnalyzer {
|
|||||||
(double) t0 / 1000d
|
(double) t0 / 1000d
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Values analyzePoint(NumassPoint point, Meta config) {
|
||||||
|
//Average count rates, do not sum events
|
||||||
|
Values res = point.getBlocks().map(it -> analyze(it, config)).reduce(null, this::combineBlockResults);
|
||||||
|
|
||||||
|
Map<String, Value> map = new HashMap<>(res.asMap());
|
||||||
|
map.put(HV_KEY, Value.of(point.getVoltage()));
|
||||||
|
return new ValueMap(map);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Combine two blocks from the same point into one
|
||||||
|
*
|
||||||
|
* @param v1
|
||||||
|
* @param v2
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private Values combineBlockResults(Values v1, Values v2) {
|
||||||
|
if (v1 == null) {
|
||||||
|
return v2;
|
||||||
|
}
|
||||||
|
if (v2 == null) {
|
||||||
|
return v1;
|
||||||
|
}
|
||||||
|
|
||||||
|
double cr1 = v1.getDouble(COUNT_RATE_KEY);
|
||||||
|
double cr2 = v2.getDouble(COUNT_RATE_KEY);
|
||||||
|
double w1 = Math.pow(v1.getDouble(COUNT_RATE_ERROR_KEY), -2);
|
||||||
|
double w2 = Math.pow(v2.getDouble(COUNT_RATE_ERROR_KEY), -2);
|
||||||
|
|
||||||
|
double countRate = (cr1 * w1 + cr2 * w2) / (1d * w1 + 1d * w2);
|
||||||
|
|
||||||
|
double countRateErr = Math.sqrt(1d / (w1 + w2));
|
||||||
|
|
||||||
|
|
||||||
|
return ValueMap.of(NAME_LIST,
|
||||||
|
v1.getDouble(LENGTH_KEY) + v2.getDouble(LENGTH_KEY),
|
||||||
|
v1.getInt(COUNT_KEY) + v2.getInt(COUNT_KEY),
|
||||||
|
countRate,
|
||||||
|
countRateErr,
|
||||||
|
v1.getValue(WINDOW_KEY),
|
||||||
|
v1.getValue(TIME_KEY),
|
||||||
|
v1.getDouble(T0_KEY)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private long getT0(NumassBlock block, Meta config) {
|
private long getT0(NumassBlock block, Meta config) {
|
||||||
|
@ -2,13 +2,17 @@ package inr.numass.data.api;
|
|||||||
|
|
||||||
import hep.dataforge.meta.Meta;
|
import hep.dataforge.meta.Meta;
|
||||||
import hep.dataforge.tables.*;
|
import hep.dataforge.tables.*;
|
||||||
|
import hep.dataforge.values.Value;
|
||||||
import hep.dataforge.values.Values;
|
import hep.dataforge.values.Values;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.concurrent.atomic.AtomicLong;
|
import java.util.concurrent.atomic.AtomicLong;
|
||||||
import java.util.stream.IntStream;
|
import java.util.stream.IntStream;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
import static hep.dataforge.tables.XYAdapter.*;
|
import static hep.dataforge.tables.XYAdapter.*;
|
||||||
|
import static inr.numass.data.api.NumassPoint.HV_KEY;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A general raw data analysis utility. Could have different implementations
|
* A general raw data analysis utility. Could have different implementations
|
||||||
@ -33,7 +37,6 @@ public interface NumassAnalyzer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
String CHANNEL_KEY = "channel";
|
String CHANNEL_KEY = "channel";
|
||||||
String COUNT_KEY = "count";
|
String COUNT_KEY = "count";
|
||||||
String LENGTH_KEY = "length";
|
String LENGTH_KEY = "length";
|
||||||
@ -49,6 +52,18 @@ public interface NumassAnalyzer {
|
|||||||
*/
|
*/
|
||||||
Values analyze(NumassBlock block, Meta config);
|
Values analyze(NumassBlock block, Meta config);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Analysis result for point including hv information
|
||||||
|
* @param point
|
||||||
|
* @param config
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
default Values analyzePoint(NumassPoint point, Meta config) {
|
||||||
|
Map<String, Value> map = new HashMap<>(analyze(point, config).asMap());
|
||||||
|
map.put(HV_KEY, Value.of(point.getVoltage()));
|
||||||
|
return new ValueMap(map);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return unsorted stream of events including events from frames
|
* Return unsorted stream of events including events from frames
|
||||||
*
|
*
|
||||||
@ -64,7 +79,7 @@ public interface NumassAnalyzer {
|
|||||||
* @param config
|
* @param config
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Table analyze(NumassSet set, Meta config);
|
Table analyzeSet(NumassSet set, Meta config);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calculate the energy spectrum for a given block. The s
|
* Calculate the energy spectrum for a given block. The s
|
||||||
|
@ -5,6 +5,7 @@ import hep.dataforge.context.Global
|
|||||||
import hep.dataforge.data.DataSet
|
import hep.dataforge.data.DataSet
|
||||||
import hep.dataforge.grind.Grind
|
import hep.dataforge.grind.Grind
|
||||||
import hep.dataforge.grind.GrindShell
|
import hep.dataforge.grind.GrindShell
|
||||||
|
import hep.dataforge.kodex.fx.plots.PlotManager
|
||||||
import hep.dataforge.meta.Meta
|
import hep.dataforge.meta.Meta
|
||||||
import inr.numass.NumassPlugin
|
import inr.numass.NumassPlugin
|
||||||
import inr.numass.actions.TimeAnalyzedAction
|
import inr.numass.actions.TimeAnalyzedAction
|
||||||
@ -21,7 +22,7 @@ import inr.numass.data.storage.NumassStorageFactory
|
|||||||
|
|
||||||
|
|
||||||
Context ctx = Global.instance()
|
Context ctx = Global.instance()
|
||||||
ctx.pluginManager().load(FXPlotManager)
|
ctx.pluginManager().load(PlotManager)
|
||||||
ctx.pluginManager().load(NumassPlugin.class)
|
ctx.pluginManager().load(NumassPlugin.class)
|
||||||
|
|
||||||
new GrindShell(ctx).eval {
|
new GrindShell(ctx).eval {
|
||||||
@ -29,12 +30,15 @@ new GrindShell(ctx).eval {
|
|||||||
|
|
||||||
NumassStorage storage = NumassStorageFactory.buildLocal(rootDir);
|
NumassStorage storage = NumassStorageFactory.buildLocal(rootDir);
|
||||||
|
|
||||||
Meta meta = Grind.buildMeta(binNum: 200) {
|
Meta meta = Grind.buildMeta(binNum: 200, plotHist: false) {
|
||||||
window(lo: 500, up: 1800)
|
window(lo: 500, up: 1800)
|
||||||
plot(showErrors: false)
|
plot(showErrors: false)
|
||||||
}
|
}
|
||||||
|
|
||||||
def sets = (20..31).collect { "set_$it" }
|
def sets = ((2..14) + (22..31)).collect { "set_$it" }
|
||||||
|
//def sets = (2..14).collect { "set_$it" }
|
||||||
|
//def sets = (16..31).collect { "set_$it" }
|
||||||
|
//def sets = (20..28).collect { "set_$it" }
|
||||||
|
|
||||||
def loaders = sets.collect { set ->
|
def loaders = sets.collect { set ->
|
||||||
storage.provide("loader::$set", NumassSet.class).orElse(null)
|
storage.provide("loader::$set", NumassSet.class).orElse(null)
|
@ -294,8 +294,8 @@ public class NumassPlugin extends BasicPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private XYAdapter getAdapter(Meta an) {
|
private XYAdapter getAdapter(Meta an) {
|
||||||
if (an.hasMeta(ValuesAdapter.DATA_ADAPTER_KEY)) {
|
if (an.hasMeta(ValuesAdapter.ADAPTER_KEY)) {
|
||||||
return new XYAdapter(an.getMeta(ValuesAdapter.DATA_ADAPTER_KEY));
|
return new XYAdapter(an.getMeta(ValuesAdapter.ADAPTER_KEY));
|
||||||
} else {
|
} else {
|
||||||
return new XYAdapter(NumassPoint.HV_KEY, NumassAnalyzer.COUNT_RATE_KEY, NumassAnalyzer.COUNT_RATE_ERROR_KEY);
|
return new XYAdapter(NumassPoint.HV_KEY, NumassAnalyzer.COUNT_RATE_KEY, NumassAnalyzer.COUNT_RATE_ERROR_KEY);
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ public class AnalyzeDataAction extends OneToOneAction<NumassSet, Table> {
|
|||||||
protected Table execute(Context context, String name, NumassSet input, Laminate inputMeta) {
|
protected Table execute(Context context, String name, NumassSet input, Laminate inputMeta) {
|
||||||
//TODO add processor here
|
//TODO add processor here
|
||||||
NumassAnalyzer analyzer = new SmartAnalyzer();
|
NumassAnalyzer analyzer = new SmartAnalyzer();
|
||||||
Table res = analyzer.analyze(input, inputMeta);
|
Table res = analyzer.analyzeSet(input, inputMeta);
|
||||||
output(context, name, stream -> NumassUtils.writeSomething(stream, inputMeta, res));
|
output(context, name, stream -> NumassUtils.writeSomething(stream, inputMeta, res));
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
@ -42,8 +42,8 @@ public class TransformDataAction extends OneToOneAction<Table, Table> {
|
|||||||
|
|
||||||
List<Correction> corrections = new ArrayList<>();
|
List<Correction> corrections = new ArrayList<>();
|
||||||
|
|
||||||
meta.optMeta("corrections").ifPresent(corrs ->
|
meta.optMeta("corrections").ifPresent(cors ->
|
||||||
MetaUtils.nodeStream(corrs)
|
MetaUtils.nodeStream(cors)
|
||||||
.map(Pair::getValue)
|
.map(Pair::getValue)
|
||||||
.map(this::makeCorrection)
|
.map(this::makeCorrection)
|
||||||
.forEach(corrections::add)
|
.forEach(corrections::add)
|
||||||
|
@ -10,7 +10,7 @@ import hep.dataforge.meta.Laminate
|
|||||||
import hep.dataforge.plots.PlotPlugin
|
import hep.dataforge.plots.PlotPlugin
|
||||||
import hep.dataforge.plots.data.DataPlot
|
import hep.dataforge.plots.data.DataPlot
|
||||||
import hep.dataforge.tables.Table
|
import hep.dataforge.tables.Table
|
||||||
import hep.dataforge.tables.ValueMap
|
import hep.dataforge.tables.XYAdapter
|
||||||
import hep.dataforge.values.ValueType
|
import hep.dataforge.values.ValueType
|
||||||
import inr.numass.data.analyzers.TimeAnalyzer
|
import inr.numass.data.analyzers.TimeAnalyzer
|
||||||
import inr.numass.data.api.NumassAnalyzer
|
import inr.numass.data.api.NumassAnalyzer
|
||||||
@ -51,6 +51,9 @@ class TimeAnalyzedAction : OneToOneAction<NumassPoint, Table>() {
|
|||||||
"window.up" to upChannel
|
"window.up" to upChannel
|
||||||
}).getDouble("cr")
|
}).getDouble("cr")
|
||||||
|
|
||||||
|
log.report("The expected count rate for 30 us delay is $trueCR")
|
||||||
|
|
||||||
|
|
||||||
val binNum = inputMeta.getInt("binNum", 1000);
|
val binNum = inputMeta.getInt("binNum", 1000);
|
||||||
val binSize = inputMeta.getDouble("binSize", 1.0 / trueCR * 10 / binNum * 1e6)
|
val binSize = inputMeta.getDouble("binSize", 1.0 / trueCR * 10 / binNum * 1e6)
|
||||||
|
|
||||||
@ -63,6 +66,8 @@ class TimeAnalyzedAction : OneToOneAction<NumassPoint, Table>() {
|
|||||||
//.histogram(input, loChannel, upChannel, binSize, binNum).asTable();
|
//.histogram(input, loChannel, upChannel, binSize, binNum).asTable();
|
||||||
log.report("Finished histogram calculation...");
|
log.report("Finished histogram calculation...");
|
||||||
|
|
||||||
|
if (inputMeta.getBoolean("plotHist", true)) {
|
||||||
|
|
||||||
val histPlot = pm.getPlotFrame(getName(), "histogram");
|
val histPlot = pm.getPlotFrame(getName(), "histogram");
|
||||||
|
|
||||||
histPlot.configure {
|
histPlot.configure {
|
||||||
@ -75,22 +80,22 @@ class TimeAnalyzedAction : OneToOneAction<NumassPoint, Table>() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
histPlot.add(DataPlot(name)
|
val histogramPlot = DataPlot(name)
|
||||||
.configure {
|
.configure {
|
||||||
"showLine" to true
|
"showLine" to true
|
||||||
"showSymbol" to false
|
"showSymbol" to false
|
||||||
"showErrors" to false
|
"showErrors" to false
|
||||||
"connectionType" to "step"
|
"connectionType" to "step"
|
||||||
node("adapter") {
|
node("@adapter") {
|
||||||
"y.value" to "count"
|
"y.value" to "count"
|
||||||
}
|
}
|
||||||
}.apply {
|
}.apply { configure(inputMeta.getMetaOrEmpty("histogram")) }
|
||||||
configure(inputMeta.getMetaOrEmpty("histogram"))
|
|
||||||
}
|
|
||||||
.fillData(histogram)
|
.fillData(histogram)
|
||||||
)
|
|
||||||
|
|
||||||
log.report("The expected count rate for 30 us delay is $trueCR")
|
histPlot.add(histogramPlot)
|
||||||
|
}
|
||||||
|
|
||||||
|
if(inputMeta.getBoolean("plotStat",true)) {
|
||||||
|
|
||||||
val statPlotPoints = (1..150).map { 1000 * it }.map { t ->
|
val statPlotPoints = (1..150).map { 1000 * it }.map { t ->
|
||||||
val result = analyzer.analyze(input, buildMeta {
|
val result = analyzer.analyze(input, buildMeta {
|
||||||
@ -106,24 +111,24 @@ class TimeAnalyzedAction : OneToOneAction<NumassPoint, Table>() {
|
|||||||
1.0
|
1.0
|
||||||
}
|
}
|
||||||
|
|
||||||
ValueMap.ofMap(
|
XYAdapter.DEFAULT_ADAPTER.buildXYDataPoint(
|
||||||
mapOf(
|
t / 1000.0,
|
||||||
"x" to t / 1000,
|
result.getDouble("cr") / norm,
|
||||||
"y" to result.getDouble("cr") / norm,
|
result.getDouble(NumassAnalyzer.COUNT_RATE_ERROR_KEY) / norm
|
||||||
"y.err" to result.getDouble(NumassAnalyzer.COUNT_RATE_ERROR_KEY) / norm
|
|
||||||
)
|
)
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pm.getPlotFrame(getName(), "stat-method").add(
|
val statPlot = DataPlot(name).configure {
|
||||||
DataPlot(name).configure {
|
|
||||||
"showLine" to true
|
"showLine" to true
|
||||||
"thickness" to 4
|
"thickness" to 4
|
||||||
"title" to "${name}_${input.voltage}"
|
"title" to "${name}_${input.voltage}"
|
||||||
}.apply {
|
}.apply {
|
||||||
configure(inputMeta.getMetaOrEmpty("plot"))
|
configure(inputMeta.getMetaOrEmpty("plot"))
|
||||||
}.fillData(statPlotPoints)
|
}.fillData(statPlotPoints)
|
||||||
)
|
|
||||||
|
pm.getPlotFrame(getName(), "stat-method").add(statPlot)
|
||||||
|
}
|
||||||
|
|
||||||
return histogram;
|
return histogram;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -372,7 +372,7 @@ class NumassLoaderView : View() {
|
|||||||
// point.startTime
|
// point.startTime
|
||||||
// )
|
// )
|
||||||
// }
|
// }
|
||||||
val spectrumDataSet = analyzer.analyze(data, buildMeta {
|
val spectrumDataSet = analyzer.analyzeSet(data, buildMeta {
|
||||||
"window.lo" to loChannel
|
"window.lo" to loChannel
|
||||||
"window.up" to upChannel
|
"window.up" to upChannel
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user