Working on task dependency system

This commit is contained in:
Alexander Nozik 2016-02-28 20:08:59 +03:00
parent 7c0a61bffb
commit 98fc2a1c0b
21 changed files with 59 additions and 50 deletions

View File

@ -25,7 +25,7 @@ import hep.dataforge.control.ports.TcpPortHandler;
import hep.dataforge.data.Format;
import hep.dataforge.data.FormatBuilder;
import hep.dataforge.data.DataPoint;
import hep.dataforge.data.MapDataPoint;
import hep.dataforge.data.MapPoint;
import hep.dataforge.exceptions.ControlException;
import hep.dataforge.exceptions.MeasurementException;
import hep.dataforge.exceptions.PortException;
@ -476,7 +476,7 @@ public class MspDevice extends SingleMeasurementDevice implements PortHandler.Po
Instant time = Instant.now();
MapDataPoint point = new MapDataPoint();
MapPoint point = new MapPoint();
point.putValue("timestamp", time);
measurement.entrySet().stream().forEach((entry) -> {

View File

@ -17,7 +17,7 @@ package inr.numass.control.msp.fx;
import hep.dataforge.context.Context;
import hep.dataforge.context.GlobalContext;
import hep.dataforge.data.MapDataPoint;
import hep.dataforge.data.MapPoint;
import hep.dataforge.exceptions.ControlException;
import hep.dataforge.exceptions.PortException;
import hep.dataforge.io.MetaFileReader;
@ -229,7 +229,7 @@ public class MspViewController implements Initializable, MspListener {
@Override
public void acceptScan(Map<Integer, Double> measurement) {
MapDataPoint point = new MapDataPoint();
MapPoint point = new MapPoint();
for (Map.Entry<Integer, Double> entry : measurement.entrySet()) {
Double val = entry.getValue();
if (val <= 0) {

View File

@ -16,7 +16,7 @@
package inr.numass.readvac;
import hep.dataforge.data.DataPoint;
import hep.dataforge.data.MapDataPoint;
import hep.dataforge.data.MapPoint;
import hep.dataforge.meta.Meta;
import hep.dataforge.values.Value;
import java.math.BigDecimal;
@ -392,7 +392,7 @@ public class VACDeviceReader implements Iterator<DataPoint>, AutoCloseable {
Value p3 = readP3();
Value px = readPx();
Value time = Value.of(Instant.now().truncatedTo(ChronoUnit.SECONDS));
return new MapDataPoint(VACManager.names, time, p1, p2, p3, px);
return new MapPoint(VACManager.names, time, p1, p2, p3, px);
}
}

View File

@ -16,7 +16,7 @@
package inr.numass.readvac;
import hep.dataforge.data.DataPoint;
import hep.dataforge.data.MapDataPoint;
import hep.dataforge.data.MapPoint;
import hep.dataforge.io.LineIterator;
import java.io.File;
import java.io.FileNotFoundException;
@ -134,7 +134,7 @@ public class VACFileReader implements Iterator<DataPoint> {
String px = matcher.group(5);
return new MapDataPoint(VACManager.names, new Object[]{time, p1, p2, p3, px});
return new MapPoint(VACManager.names, new Object[]{time, p1, p2, p3, px});
}
}

View File

@ -9,7 +9,7 @@ import hep.dataforge.actions.OneToOneAction;
import hep.dataforge.context.Context;
import hep.dataforge.data.DataPoint;
import hep.dataforge.data.ListPointSet;
import hep.dataforge.data.MapDataPoint;
import hep.dataforge.data.MapPoint;
import hep.dataforge.description.TypedActionDef;
import hep.dataforge.io.log.Logable;
import hep.dataforge.meta.Meta;
@ -67,7 +67,7 @@ public class AdjustErrorsAction extends OneToOneAction<PointSet, PointSet> {
}
private DataPoint adjust(DataPoint dp, Meta config) {
MapDataPoint res = new MapDataPoint(dp);
MapPoint res = new MapPoint(dp);
if (res.hasValue("CRerr")) {
double instability = 0;
if (dp.hasValue("CR")) {

View File

@ -16,7 +16,7 @@
package inr.numass.actions;
import hep.dataforge.data.ListPointSet;
import hep.dataforge.data.MapDataPoint;
import hep.dataforge.data.MapPoint;
import hep.dataforge.values.Value;
import inr.numass.data.NMFile;
import inr.numass.data.NMPoint;
@ -79,7 +79,7 @@ public class BorderData extends ListPointSet {
}
}
}
this.add(new MapDataPoint(map));
this.add(new MapPoint(map));
}
}

View File

@ -16,12 +16,12 @@
package inr.numass.actions;
import hep.dataforge.actions.ManyToOneAction;
import hep.dataforge.content.GroupBuilder;
import hep.dataforge.actions.GroupBuilder;
import hep.dataforge.content.NamedGroup;
import hep.dataforge.context.Context;
import hep.dataforge.data.DataPoint;
import hep.dataforge.data.ListPointSet;
import hep.dataforge.data.MapDataPoint;
import hep.dataforge.data.MapPoint;
import hep.dataforge.description.NodeDef;
import hep.dataforge.description.TypedActionDef;
import hep.dataforge.io.ColumnedDataWriter;
@ -156,7 +156,7 @@ public class MergeDataAction extends ManyToOneAction<PointSet, PointSet> {
// абсолютные ошибки складываются квадратично
double crErr = Math.sqrt(err1 * err1 * t1 * t1 + err2 * err2 * t2 * t2) / time;
MapDataPoint map = new MapDataPoint(parnames, Uset, Uread, time, total, wind, corr, cr, crErr);
MapPoint map = new MapPoint(parnames, Uset, Uread, time, total, wind, corr, cr, crErr);
if (dp1.names().contains("relCR") && dp2.names().contains("relCR")) {
double relCR = (dp1.getDouble("relCR") + dp2.getDouble("relCR")) / 2;

View File

@ -20,7 +20,7 @@ import hep.dataforge.actions.OneToOneAction;
import hep.dataforge.context.Context;
import hep.dataforge.data.DataPoint;
import hep.dataforge.data.ListPointSet;
import hep.dataforge.data.MapDataPoint;
import hep.dataforge.data.MapPoint;
import hep.dataforge.description.TypedActionDef;
import hep.dataforge.description.ValueDef;
import hep.dataforge.exceptions.ContentException;
@ -82,7 +82,7 @@ public class MonitorCorrectAction extends OneToOneAction<PointSet, PointSet> {
List<DataPoint> dataList = new ArrayList<>();
for (DataPoint dp : sourceData) {
MapDataPoint point = new MapDataPoint(dp);
MapPoint point = new MapPoint(dp);
point.putValue("Monitor", 1.0);
if (!isMonitorPoint(monitor, dp) || index.isEmpty()) {
LocalDateTime time = getTime(dp);

View File

@ -20,7 +20,7 @@ import hep.dataforge.context.Context;
import hep.dataforge.data.Format;
import hep.dataforge.data.DataPoint;
import hep.dataforge.data.ListPointSet;
import hep.dataforge.data.MapDataPoint;
import hep.dataforge.data.MapPoint;
import hep.dataforge.description.TypedActionDef;
import hep.dataforge.description.ValueDef;
import hep.dataforge.exceptions.ContentException;
@ -90,7 +90,7 @@ public class PrepareDataAction extends OneToOneAction<NMFile, PointSet> {
Instant timestamp = point.getStartTime();
dataList.add(new MapDataPoint(parnames, new Object[]{Uset, Uread, time, total, wind, corr, cr, crErr, timestamp}));
dataList.add(new MapPoint(parnames, new Object[]{Uset, Uread, time, total, wind, corr, cr, crErr, timestamp}));
}
Format format;

View File

@ -18,7 +18,7 @@ package inr.numass.actions;
import hep.dataforge.actions.OneToOneAction;
import hep.dataforge.context.Context;
import hep.dataforge.data.ListPointSet;
import hep.dataforge.data.MapDataPoint;
import hep.dataforge.data.MapPoint;
import hep.dataforge.data.XYAdapter;
import hep.dataforge.datafitter.FitState;
import hep.dataforge.datafitter.FitTaskResult;
@ -274,7 +274,7 @@ public class ShowLossSpectrumAction extends OneToOneAction<FitState, FitState> {
String[] pointNames = {"e", "central", "lower", "upper", "dispersion"};
ListPointSet res = new ListPointSet("spread", pointNames);
for (int i = 0; i < gridPoints; i++) {
res.add(new MapDataPoint(pointNames, grid[i], central[i], lower[i], upper[i], dispersion[i]));
res.add(new MapPoint(pointNames, grid[i], central[i], lower[i], upper[i], dispersion[i]));
}
return res;

View File

@ -17,7 +17,7 @@ package inr.numass.actions;
import hep.dataforge.data.Format;
import hep.dataforge.data.ListPointSet;
import hep.dataforge.data.MapDataPoint;
import hep.dataforge.data.MapPoint;
import hep.dataforge.values.Value;
import inr.numass.data.NMFile;
import inr.numass.data.NMPoint;
@ -83,7 +83,7 @@ public class SlicedData extends ListPointSet {
map.put(name, Value.of(count));
}
}
this.add(new MapDataPoint(map));
this.add(new MapPoint(map));
}
}

View File

@ -16,13 +16,13 @@
package inr.numass.actions;
import hep.dataforge.actions.ManyToOneAction;
import hep.dataforge.content.GroupBuilder;
import hep.dataforge.actions.GroupBuilder;
import hep.dataforge.content.NamedGroup;
import hep.dataforge.context.Context;
import hep.dataforge.data.Format;
import hep.dataforge.data.DataPoint;
import hep.dataforge.data.ListPointSet;
import hep.dataforge.data.MapDataPoint;
import hep.dataforge.data.MapPoint;
import hep.dataforge.datafitter.FitState;
import hep.dataforge.description.TypedActionDef;
import hep.dataforge.io.ColumnedDataWriter;
@ -92,7 +92,7 @@ public class SummaryAction extends ManyToOneAction<FitState, PointSet> {
weights[i] += weight;
}
values[values.length - 1] = Value.of(state.getChi2());
DataPoint point = new MapDataPoint(names, values);
DataPoint point = new MapPoint(names, values);
res.add(point);
}
@ -105,7 +105,7 @@ public class SummaryAction extends ManyToOneAction<FitState, PointSet> {
averageValues[2 * i + 2] = Value.of(1 / Math.sqrt(weights[i]));
}
res.add(new MapDataPoint(names, averageValues));
res.add(new MapPoint(names, averageValues));
OutputStream stream = buildActionOutput(res);

View File

@ -17,7 +17,7 @@ package inr.numass.data;
import hep.dataforge.data.Format;
import hep.dataforge.data.ListPointSet;
import hep.dataforge.data.MapDataPoint;
import hep.dataforge.data.MapPoint;
import hep.dataforge.io.ColumnedDataWriter;
import hep.dataforge.values.Value;
import hep.dataforge.values.ValueFormat;
@ -33,6 +33,10 @@ import java.util.Map;
import static java.lang.String.format;
import static java.lang.String.format;
import static java.lang.String.format;
import static java.lang.String.format;
import static java.lang.String.format;
import static java.lang.String.format;
import static java.lang.String.format;
/**
*
@ -78,7 +82,7 @@ public class ESpectrum extends ListPointSet {
for (int j = 0; j < points.size(); j++) {
res.put(format("%.3f", points.get(j).getUread()), Value.of(spectra.get(j).get(x)));
}
this.add(new MapDataPoint(res));
this.add(new MapPoint(res));
}
}

View File

@ -16,7 +16,7 @@
package inr.numass.data;
import hep.dataforge.data.DataPoint;
import hep.dataforge.data.MapDataPoint;
import hep.dataforge.data.MapPoint;
import java.time.Instant;
import java.util.ArrayList;
import java.util.Arrays;
@ -24,6 +24,7 @@ import static java.util.Arrays.sort;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import static java.util.Arrays.sort;
/**
*
@ -100,7 +101,7 @@ public class NMPoint {
names[borders.length + 2] = "TOTAL";
//FIXME fix it!
return new MapDataPoint(names, slices);
return new MapPoint(names, slices);
}
/**
@ -149,7 +150,7 @@ public class NMPoint {
public List<DataPoint> getData() {
List<DataPoint> data = new ArrayList<>();
for (int i = 0; i < RawNMPoint.MAX_CHANEL; i++) {
data.add(new MapDataPoint(dataNames, i, spectrum[i]));
data.add(new MapPoint(dataNames, i, spectrum[i]));
}
return data;
@ -183,7 +184,7 @@ public class NMPoint {
sum += spectrum[i] / norm;
i++;
}
data.add(new MapDataPoint(dataNames, start + binning / 2d, sum));
data.add(new MapPoint(dataNames, start + binning / 2d, sum));
i++;
}
return data;

View File

@ -16,7 +16,7 @@
package inr.numass.data;
import hep.dataforge.data.DataPoint;
import hep.dataforge.data.MapDataPoint;
import hep.dataforge.data.MapPoint;
import hep.dataforge.data.XYAdapter;
import hep.dataforge.exceptions.DataFormatException;
import hep.dataforge.exceptions.NameNotFoundException;
@ -64,13 +64,13 @@ public class SpectrumDataAdapter extends XYAdapter {
}
public DataPoint buildSpectrumDataPoint(double x, long count, double t) {
return new MapDataPoint(new String[]{getValueName(X_NAME), getValueName(Y_NAME),
return new MapPoint(new String[]{getValueName(X_NAME), getValueName(Y_NAME),
getValueName(POINT_LENGTH_NAME)},
x, count, t);
}
public DataPoint buildSpectrumDataPoint(double x, long count, double countErr, double t) {
return new MapDataPoint(new String[]{getValueName(X_NAME), getValueName(Y_NAME),
return new MapPoint(new String[]{getValueName(X_NAME), getValueName(Y_NAME),
getValueName(Y_ERR_NAME), getValueName(POINT_LENGTH_NAME)},
x, count, countErr, t);
}

View File

@ -17,7 +17,7 @@ package inr.numass.utils;
import hep.dataforge.data.DataPoint;
import hep.dataforge.data.ListPointSet;
import hep.dataforge.data.MapDataPoint;
import hep.dataforge.data.MapPoint;
/**
@ -34,7 +34,7 @@ public class DataModelUtils {
for (int i = 0; i < numpoints; i++) {
// формула работает даже в том случае когда порядок точек обратный
double x = from + (to - from) / (numpoints - 1) * i;
DataPoint point = new MapDataPoint(list, x,time);
DataPoint point = new MapPoint(list, x,time);
res.add(point);
}

View File

@ -18,7 +18,7 @@ package inr.numass.utils;
import hep.dataforge.context.GlobalContext;
import hep.dataforge.data.DataPoint;
import hep.dataforge.data.ListPointSet;
import hep.dataforge.data.MapDataPoint;
import hep.dataforge.data.MapPoint;
import inr.numass.data.SpectrumDataAdapter;
import java.io.File;
import java.io.FileNotFoundException;
@ -28,6 +28,10 @@ import java.util.Scanner;
import static java.util.Locale.setDefault;
import static java.util.Locale.setDefault;
import static java.util.Locale.setDefault;
import static java.util.Locale.setDefault;
import static java.util.Locale.setDefault;
import static java.util.Locale.setDefault;
import static java.util.Locale.setDefault;
/**
*
@ -51,7 +55,7 @@ public class OldDataReader {
if(lineScan.hasNextDouble()){
ushift = lineScan.nextDouble();
}
DataPoint point = new MapDataPoint(list, u,time,ushift);
DataPoint point = new MapPoint(list, u,time,ushift);
res.add(point);
}
return res;

View File

@ -19,7 +19,7 @@ import hep.dataforge.actions.OneToOneAction;
import hep.dataforge.context.Context;
import hep.dataforge.data.DataPoint;
import hep.dataforge.data.ListPointSet;
import hep.dataforge.data.MapDataPoint;
import hep.dataforge.data.MapPoint;
import hep.dataforge.datafitter.FitManager;
import hep.dataforge.datafitter.FitPlugin;
import hep.dataforge.datafitter.FitState;
@ -87,7 +87,7 @@ public class FitJNAData extends OneToOneAction<JNAEpisode, PointSet> {
double chi2 = state.getChi2() / (state.getDataSize() - 4);
MapDataPoint point = new MapDataPoint(
MapPoint point = new MapPoint(
new String[]{"name", "time", "pos", "posErr", "amp", "ampErr", "sigma", "sigmaErr", "dsigma", "dsigmaErr", "chi2"},
new Object[]{spectrum.getName(), spectrum.startTime(), pos, posErr, amp, ampErr, sigma, sigmaErr, dsigma, dsigmaErr, chi2});
if (spectrum.hasTemperature()) {

View File

@ -18,7 +18,7 @@ package inr.numass.prop.ar;
import hep.dataforge.content.NamedMetaHolder;
import hep.dataforge.data.DataPoint;
import hep.dataforge.data.ListPointSet;
import hep.dataforge.data.MapDataPoint;
import hep.dataforge.data.MapPoint;
import hep.dataforge.description.NodeDef;
import hep.dataforge.description.ValueDef;
import hep.dataforge.meta.Meta;
@ -64,7 +64,7 @@ public class JNASpectrum extends NamedMetaHolder {
public PointSet asDataSet() {
List<DataPoint> points = new ArrayList<>();
for (Map.Entry<Double, Long> point : spectrum.entrySet()) {
points.add(new MapDataPoint(names, point.getKey(), point.getValue()));
points.add(new MapPoint(names, point.getKey(), point.getValue()));
}
return new ListPointSet(getName(), meta(), points);
}
@ -99,7 +99,7 @@ public class JNASpectrum extends NamedMetaHolder {
// double T4 = getDouble("temperature.T4",0);
// double T5 = getDouble("temperature.T5",0);
// double T6 = getDouble("temperature.T6",0);
MapDataPoint res = new MapDataPoint();
MapPoint res = new MapPoint();
Meta temps = meta().getNode("temperature");
for (String name : temps.getValueNames()) {
res.putValue(name, temps.getValue(name));

View File

@ -21,7 +21,7 @@ package inr.numass.viewer;
* and open the template in the editor.
*/
import hep.dataforge.data.DataPoint;
import hep.dataforge.data.MapDataPoint;
import hep.dataforge.data.MapPoint;
import hep.dataforge.plots.PlotUtils;
import hep.dataforge.plots.data.DynamicPlottable;
import hep.dataforge.plots.data.DynamicPlottableSet;
@ -179,7 +179,7 @@ public class MspViewController {
* @return
*/
private DataPoint terminatorPoint(DataPoint last) {
MapDataPoint p = new MapDataPoint();
MapPoint p = new MapPoint();
p.putValue("timestamp", last.getValue("timestamp").timeValue().plusMillis(10));
for (String name : last.namesAsArray()) {
if (!name.equals("timestamp")) {

View File

@ -22,7 +22,7 @@ package inr.numass.viewer;
*/
import hep.dataforge.data.DataPoint;
import hep.dataforge.data.ListPointSet;
import hep.dataforge.data.MapDataPoint;
import hep.dataforge.data.MapPoint;
import hep.dataforge.data.XYAdapter;
import hep.dataforge.io.ColumnedDataWriter;
import hep.dataforge.meta.Meta;
@ -299,7 +299,7 @@ public class NumassLoaderViewComponent extends AnchorPane implements Initializab
private DataPoint getSpectrumPoint(NMPoint point, int lowChannel, int upChannel, double dTime) {
double u = point.getUread();
return new MapDataPoint(new String[]{"x", "y", "yErr"}, u,
return new MapPoint(new String[]{"x", "y", "yErr"}, u,
point.getCountRate(lowChannel, upChannel, dTime),
point.getCountRateErr(lowChannel, upChannel, dTime));
}
@ -405,7 +405,7 @@ public class NumassLoaderViewComponent extends AnchorPane implements Initializab
ListPointSet spectrumDataSet = new ListPointSet(names);
for (NMPoint point : points) {
spectrumDataSet.add(new MapDataPoint(names, new Object[]{
spectrumDataSet.add(new MapPoint(names, new Object[]{
point.getUset(),
point.getUread(),
point.getLength(),