[no commit message]

This commit is contained in:
darksnake 2016-02-15 17:00:27 +03:00
parent c1ed9a9f37
commit 62193839de
11 changed files with 27 additions and 28 deletions

View File

@ -210,7 +210,8 @@ public class MspViewController implements Initializable, MspListener {
String mass = an.getString("mass");
if (!this.plottables.hasPlottable(mass)) {
DynamicPlottable newPlottable = new DynamicPlottable(mass, an, mass);
DynamicPlottable newPlottable = new DynamicPlottable(mass, mass);
newPlottable.configure(an);
this.plottables.addPlottable(newPlottable);
plotFrame.add(newPlottable);
} else {

View File

@ -131,10 +131,10 @@ public class VACFrame extends javax.swing.JFrame {
}
private DynamicPlottableSet setupPlot() {
DynamicPlottable p1 = DynamicPlottable.build("P1", "timestamp", "pressure", "RED", 2.5);
DynamicPlottable p2 = DynamicPlottable.build("P2", "timestamp", "pressure", "BLUE", 2.5);
DynamicPlottable p3 = DynamicPlottable.build("P3", "timestamp", "pressure", "GREEN", 2.5);
DynamicPlottable px = DynamicPlottable.build("Px", "timestamp", "pressure", "MAGENTA", 2.5);
DynamicPlottable p1 = DynamicPlottable.build("P1", "pressure", "RED", 2.5);
DynamicPlottable p2 = DynamicPlottable.build("P2", "pressure", "BLUE", 2.5);
DynamicPlottable p3 = DynamicPlottable.build("P3", "pressure", "GREEN", 2.5);
DynamicPlottable px = DynamicPlottable.build("Px", "pressure", "MAGENTA", 2.5);
return new DynamicPlottableSet(p1, p2, p3, px);
}

View File

@ -17,12 +17,11 @@ import hep.dataforge.exceptions.MeasurementException;
import hep.dataforge.meta.Meta;
import hep.dataforge.values.Value;
import java.util.Collection;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;
/**
@ -43,7 +42,7 @@ public class VacCollectorDevice extends Sensor<DataPoint> {
*/
public VacCollectorDevice(String name, Context context, Meta meta, Sensor... sensors) {
super(name, context, meta);
sensorMap = new HashMap<>(sensors.length);
sensorMap = new LinkedHashMap<>(sensors.length);
for (Sensor sensor : sensors) {
sensorMap.put(sensor.getName(), sensor);
}

View File

@ -13,7 +13,6 @@ import hep.dataforge.control.measurements.MeasurementListener;
import hep.dataforge.control.measurements.Sensor;
import hep.dataforge.data.DataPoint;
import hep.dataforge.exceptions.ControlException;
import hep.dataforge.exceptions.MeasurementException;
import hep.dataforge.meta.Meta;
import hep.dataforge.meta.MetaBuilder;
import hep.dataforge.plots.PlotFrame;
@ -22,7 +21,6 @@ import hep.dataforge.plots.data.DynamicPlottableSet;
import hep.dataforge.plots.fx.PlotContainer;
import hep.dataforge.plots.jfreechart.JFreeChartFrame;
import hep.dataforge.values.Value;
import inr.numass.readvac.devices.MKSVacDevice;
import inr.numass.readvac.devices.VacCollectorDevice;
import java.net.URL;
import java.time.Instant;
@ -97,8 +95,10 @@ public class VacCollectorController implements Initializable, DeviceListener, Me
plottables = new DynamicPlottableSet();
views.stream().forEach((controller) -> {
vacBoxHolder.getChildren().add(controller.getComponent());
plottables.addPlottable(new DynamicPlottable(controller.getTitle(),
controller.meta(), controller.getName()));
DynamicPlottable plot = new DynamicPlottable(controller.getTitle(),
controller.getName());
plot.configure(controller.meta());
plottables.addPlottable(plot);
});
plotContainer.setPlot(setupPlot(plottables));
}

View File

@ -95,7 +95,7 @@ public class PlotFitResultAction extends OneToOneAction<FitState, FitState> {
// }
// }
frame.add(new PlottableFunction("fit", null, function, data, adapter));//FIXME replace by helper
frame.add(new PlottableFunction("fit", function, data, adapter));//FIXME replace by helper
frame.add(PlottableData.plot("data", adapter, data));

View File

@ -16,7 +16,6 @@
package inr.numass.actions;
import hep.dataforge.actions.OneToOneAction;
import hep.dataforge.meta.Meta;
import hep.dataforge.context.Context;
import hep.dataforge.data.DataSet;
import hep.dataforge.data.ListDataSet;
@ -29,14 +28,14 @@ import hep.dataforge.datafitter.ParamSet;
import hep.dataforge.datafitter.models.Histogram;
import hep.dataforge.description.TypedActionDef;
import hep.dataforge.io.ColumnedDataWriter;
import hep.dataforge.io.log.Logable;
import hep.dataforge.io.PrintFunction;
import hep.dataforge.io.log.Logable;
import hep.dataforge.maths.GridCalculator;
import hep.dataforge.maths.NamedDoubleSet;
import hep.dataforge.maths.NamedMatrix;
import hep.dataforge.maths.integration.UnivariateIntegrator;
import hep.dataforge.meta.Meta;
import hep.dataforge.meta.MetaBuilder;
import hep.dataforge.plots.PlotFrame;
import hep.dataforge.plots.PlotsPlugin;
import hep.dataforge.plots.XYPlotFrame;
import hep.dataforge.plots.data.PlottableData;
@ -95,7 +94,7 @@ public class ShowLossSpectrumAction extends OneToOneAction<FitState, FitState> {
case "scatter-empiric-experimental":
scatterFunction = new ExperimentalVariableLossSpectrum.Loss(0.3).total(pars);
frame.add(new PlottableFunction("Cross-section", null, scatterFunction, 0, 100, 1000));
frame.add(new PlottableFunction("Cross-section", scatterFunction, 0, 100, 1000));
break;
default:
throw new RuntimeException("Can work only with variable loss spectra");

View File

@ -168,12 +168,12 @@ public class LossCalculator {
final LossCalculator loss = LossCalculator.instance;
final List<Double> probs = loss.getGunLossProbabilities(set.getValue("X"));
UnivariateFunction single = (double e) -> probs.get(1) * scatterFunction.value(e);
frame.add(new PlottableFunction("Single scattering", null, single, 0, 100, 1000));
frame.add(new PlottableFunction("Single scattering", single, 0, 100, 1000));
for (int i = 2; i < probs.size(); i++) {
final int j = i;
UnivariateFunction scatter = (double e) -> probs.get(j) * loss.getLossValue(j, e, 0d);
frame.add(new PlottableFunction(j + " scattering", null, scatter, 0, 100, 1000));
frame.add(new PlottableFunction(j + " scattering", scatter, 0, 100, 1000));
}
UnivariateFunction total = (eps) -> {
@ -187,11 +187,11 @@ public class LossCalculator {
return sum;
};
frame.add(new PlottableFunction("Total loss", null, total, 0, 100, 1000));
frame.add(new PlottableFunction("Total loss", total, 0, 100, 1000));
} else {
frame.add(new PlottableFunction("Differential crosssection", null, scatterFunction, 0, 100, 2000));
frame.add(new PlottableFunction("Differential crosssection", scatterFunction, 0, 100, 2000));
}
}

View File

@ -15,10 +15,10 @@
*/
package inr.numass.models;
import hep.dataforge.plots.fx.FXPlotUtils;
import hep.dataforge.maths.integration.GaussRuleIntegrator;
import hep.dataforge.plots.PlotFrame;
import hep.dataforge.plots.data.PlottableFunction;
import hep.dataforge.plots.fx.FXPlotUtils;
import org.apache.commons.math3.analysis.UnivariateFunction;
/**
@ -40,8 +40,8 @@ public class TestNeLossParametrisation {
System.out.println(norm);
frame.add(new PlottableFunction("old", null, oldFunction, 0, 30, 300));
frame.add(new PlottableFunction("new", null, newFunction, 0, 30, 300));
frame.add(new PlottableFunction("old", oldFunction, 0, 30, 300));
frame.add(new PlottableFunction("new", newFunction, 0, 30, 300));
}
public static UnivariateFunction getSingleScatterFunction(

View File

@ -16,9 +16,9 @@
package inr.numass.models;
import hep.dataforge.context.GlobalContext;
import hep.dataforge.plots.fx.FXPlotUtils;
import hep.dataforge.plots.data.PlottableData;
import hep.dataforge.plots.data.PlottableFunction;
import hep.dataforge.plots.fx.FXPlotUtils;
import hep.dataforge.plots.jfreechart.JFreeChartFrame;
/**
@ -33,7 +33,7 @@ public class TransmissionInterpolatorTest {
TransmissionInterpolator interpolator = TransmissionInterpolator.fromFile(GlobalContext.instance(),
"d:\\sterile-new\\loss2014-11\\.dataforge\\merge\\empty_sum.out", "Uset", "CR", 15, 0.8, 19002d);
frame.add(PlottableData.plot("data", interpolator.getX(), interpolator.getY()));
frame.add(new PlottableFunction("interpolated", null, interpolator, interpolator.getXmin(), interpolator.getXmax(), 2000));
frame.add(new PlottableFunction("interpolated", interpolator, interpolator.getXmin(), interpolator.getXmax(), 2000));
// PrintFunction.printFuntionSimple(new PrintWriter(System.out), interpolator, interpolator.getXmin(), interpolator.getXmax(), 500);
}

View File

@ -116,7 +116,7 @@ public class MspViewController {
for (String name : point.names()) {
if (!name.equals("timestamp")) {
if (!plottables.hasPlottable(name)) {
plottables.addPlottable(new DynamicPlottable(name, null, name));
plottables.addPlottable(new DynamicPlottable(name, name));
}
}
}

View File

@ -274,7 +274,7 @@ public class NumassLoaderViewComponent extends AnchorPane implements Initializab
}
if (spectrumData == null) {
spectrumData = new ChangeablePlottableData("spectrum", null);
spectrumData = new ChangeablePlottableData("spectrum");
spectrumPlotFrame.add(spectrumData);
}