Total plot refactoring
This commit is contained in:
parent
37477e5f2c
commit
71928a8894
@ -166,7 +166,7 @@ public class PKT8MainViewController implements Initializable, DeviceListener, Me
|
|||||||
plotConfig = new MetaBuilder("plotFrame")
|
plotConfig = new MetaBuilder("plotFrame")
|
||||||
.setValue("xAxis.timeAxis", true);
|
.setValue("xAxis.timeAxis", true);
|
||||||
}
|
}
|
||||||
plotFrame = new JFreeChartFrame("plot", plotConfig, plotArea);
|
plotFrame = new JFreeChartFrame("plot", plotConfig).display(plotArea);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setupDevice(Meta deviceMeta) throws ControlException {
|
public void setupDevice(Meta deviceMeta) throws ControlException {
|
||||||
|
@ -191,7 +191,7 @@ public class MspViewController implements Initializable, MspListener {
|
|||||||
.setValue("axisUnits", "mbar")
|
.setValue("axisUnits", "mbar")
|
||||||
)
|
)
|
||||||
.setValue("xAxis.timeAxis", true);
|
.setValue("xAxis.timeAxis", true);
|
||||||
this.plotFrame = new JFreeChartFrame(mspName, plotConfig, plotPane);
|
this.plotFrame = new JFreeChartFrame(mspName, plotConfig).display(plotPane);
|
||||||
updatePlot();
|
updatePlot();
|
||||||
// this.plot = DynamicPlot.attachToFX(plotPane, new AnnotationBuilder("plot-config").putValue("logY", true).build());
|
// this.plot = DynamicPlot.attachToFX(plotPane, new AnnotationBuilder("plot-config").putValue("logY", true).build());
|
||||||
// plot.setAutoRange(30 * 60);
|
// plot.setAutoRange(30 * 60);
|
||||||
|
@ -433,7 +433,7 @@ public class VACFrame extends javax.swing.JFrame {
|
|||||||
.setValue("axisUnits", "mbar")
|
.setValue("axisUnits", "mbar")
|
||||||
)
|
)
|
||||||
.setValue("xAxis.timeAxis", true);
|
.setValue("xAxis.timeAxis", true);
|
||||||
this.plotFrame = new JFreeChartFrame("pressures", plotConfig, chartPannel);
|
this.plotFrame = new JFreeChartFrame("pressures", plotConfig).display(chartPannel);
|
||||||
XYPlot xyPlot = plotFrame.getChart().getXYPlot();
|
XYPlot xyPlot = plotFrame.getChart().getXYPlot();
|
||||||
|
|
||||||
LogarithmicAxis logAxis = new LogarithmicAxis("Pressure (mbar)");
|
LogarithmicAxis logAxis = new LogarithmicAxis("Pressure (mbar)");
|
||||||
|
@ -28,12 +28,10 @@ import hep.dataforge.description.ValueDef;
|
|||||||
import hep.dataforge.description.TypedActionDef;
|
import hep.dataforge.description.TypedActionDef;
|
||||||
import hep.dataforge.exceptions.ContentException;
|
import hep.dataforge.exceptions.ContentException;
|
||||||
import hep.dataforge.io.log.Logable;
|
import hep.dataforge.io.log.Logable;
|
||||||
import hep.dataforge.plots.PlotFrame;
|
|
||||||
import hep.dataforge.plots.PlotsPlugin;
|
import hep.dataforge.plots.PlotsPlugin;
|
||||||
import hep.dataforge.plots.XYPlotFrame;
|
import hep.dataforge.plots.XYPlotFrame;
|
||||||
import hep.dataforge.plots.data.PlottableData;
|
import hep.dataforge.plots.data.PlottableData;
|
||||||
import hep.dataforge.plots.data.PlottableFunction;
|
import hep.dataforge.plots.data.PlottableFunction;
|
||||||
import hep.dataforge.plots.jfreechart.JFreeChartFrame;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.apache.commons.math3.analysis.UnivariateFunction;
|
import org.apache.commons.math3.analysis.UnivariateFunction;
|
||||||
@ -52,58 +50,59 @@ public class PlotFitResultAction extends OneToOneAction<FitState, FitState> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected FitState execute(Logable log, Meta metaData, FitState input){
|
protected FitState execute(Logable log, Meta metaData, FitState input) {
|
||||||
|
|
||||||
DataSet data = input.getDataSet();
|
DataSet data = input.getDataSet();
|
||||||
if(!(input.getModel() instanceof XYModel)){
|
if (!(input.getModel() instanceof XYModel)) {
|
||||||
log.logError("The fit model should be instance of XYModel for this action. Action failed!");
|
log.logError("The fit model should be instance of XYModel for this action. Action failed!");
|
||||||
return input;
|
return input;
|
||||||
}
|
}
|
||||||
XYModel model = (XYModel)input.getModel();
|
XYModel model = (XYModel) input.getModel();
|
||||||
|
|
||||||
XYDataAdapter adapter;
|
XYDataAdapter adapter;
|
||||||
if (metaData.hasNode("adapter")){
|
if (metaData.hasNode("adapter")) {
|
||||||
adapter = new XYDataAdapter(metaData.getNode("adapter"));
|
adapter = new XYDataAdapter(metaData.getNode("adapter"));
|
||||||
} else if(input.getModel() instanceof XYModel){
|
} else if (input.getModel() instanceof XYModel) {
|
||||||
adapter = model.getAdapter();
|
adapter = model.getAdapter();
|
||||||
} else throw new ContentException("No adapter defined for data interpretation");
|
} else {
|
||||||
|
throw new ContentException("No adapter defined for data interpretation");
|
||||||
|
}
|
||||||
|
|
||||||
UnivariateFunction function = (double x) -> model.getSpectrum().value(x, input.getParameters());
|
UnivariateFunction function = (double x) -> model.getSpectrum().value(x, input.getParameters());
|
||||||
|
|
||||||
XYPlotFrame frame = (XYPlotFrame) PlotsPlugin.buildFrom(getContext()).buildPlotFrame(getName(), input.getName(), metaData);
|
XYPlotFrame frame = (XYPlotFrame) PlotsPlugin
|
||||||
//JFreeChartFrame.drawFrame(reader.getString("plotTitle", "Fit result plot for "+input.getName()), null);
|
.buildFrom(getContext()).buildPlotFrame(getName(), input.getName(),
|
||||||
|
metaData.getNode("plot", null));
|
||||||
|
//JFreeChartFrame.drawFrame(reader.getString("plotTitle", "Fit result plot for "+input.getName()), null);
|
||||||
|
|
||||||
double[] x = new double[data.size()];
|
double[] x = new double[data.size()];
|
||||||
|
|
||||||
// double[] y = new double[data.size()];
|
// double[] y = new double[data.size()];
|
||||||
|
|
||||||
|
|
||||||
double xMin = Double.POSITIVE_INFINITY;
|
double xMin = Double.POSITIVE_INFINITY;
|
||||||
|
|
||||||
double xMax = Double.NEGATIVE_INFINITY;
|
double xMax = Double.NEGATIVE_INFINITY;
|
||||||
|
|
||||||
List<DataPoint> points = new ArrayList<>();
|
List<DataPoint> points = new ArrayList<>();
|
||||||
|
|
||||||
for (int i = 0; i < data.size(); i++) {
|
for (int i = 0; i < data.size(); i++) {
|
||||||
x[i] = adapter.getX(data.get(i)).doubleValue();
|
x[i] = adapter.getX(data.get(i)).doubleValue();
|
||||||
// y[i] = adapter.getY(data.get(i));
|
// y[i] = adapter.getY(data.get(i));
|
||||||
|
|
||||||
points.add(adapter.mapToDefault(data.get(i)));
|
points.add(adapter.mapToDefault(data.get(i)));
|
||||||
if(x[i]<xMin){
|
if (x[i] < xMin) {
|
||||||
xMin = x[i];
|
xMin = x[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
if(x[i]>xMax){
|
if (x[i] > xMax) {
|
||||||
xMax = x[i];
|
xMax = x[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
frame.add(new PlottableFunction("fit", null, function, points, "x"));
|
frame.add(new PlottableFunction("fit", null, function, points, "x"));
|
||||||
|
|
||||||
frame.add(new PlottableData("data", null, points));
|
frame.add(new PlottableData("data", null, points));
|
||||||
|
|
||||||
|
|
||||||
return input;
|
return input;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -66,7 +66,7 @@ public class NumassPlugin extends BasicPlugin {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void apply(Context context) {
|
public void apply(Context context) {
|
||||||
FitManager fm = context.provide("hep.dataforge:fitting", FitPlugin.class).getFitManager();
|
FitManager fm = context.provide("fitting", FitPlugin.class).getFitManager();
|
||||||
ModelManager mm = fm.getModelManager();
|
ModelManager mm = fm.getModelManager();
|
||||||
loadModels(mm);
|
loadModels(mm);
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ public class MergeDataAction extends ManyToOneAction<DataSet, DataSet> {
|
|||||||
@Override
|
@Override
|
||||||
protected List<NamedGroup<DataSet>> buildGroups(Meta reader, List<DataSet> input) {
|
protected List<NamedGroup<DataSet>> buildGroups(Meta reader, List<DataSet> input) {
|
||||||
List<NamedGroup<DataSet>> groups;
|
List<NamedGroup<DataSet>> groups;
|
||||||
if (reader.hasNode("grouping")) {
|
if (reader.hasValue("grouping.byValue")) {
|
||||||
groups = super.buildGroups(reader, input);
|
groups = super.buildGroups(reader, input);
|
||||||
} else {
|
} else {
|
||||||
groups = GroupBuilder.byValue(MERGE_NAME, reader.getString(MERGE_NAME, "merge")).group(input);
|
groups = GroupBuilder.byValue(MERGE_NAME, reader.getString(MERGE_NAME, "merge")).group(input);
|
||||||
|
@ -19,6 +19,7 @@ import hep.dataforge.actions.OneToOneAction;
|
|||||||
import hep.dataforge.context.Context;
|
import hep.dataforge.context.Context;
|
||||||
import hep.dataforge.description.TypedActionDef;
|
import hep.dataforge.description.TypedActionDef;
|
||||||
import hep.dataforge.exceptions.ContentException;
|
import hep.dataforge.exceptions.ContentException;
|
||||||
|
import hep.dataforge.plots.fx.FXPlotUtils;
|
||||||
import hep.dataforge.io.ColumnedDataWriter;
|
import hep.dataforge.io.ColumnedDataWriter;
|
||||||
import hep.dataforge.io.log.Logable;
|
import hep.dataforge.io.log.Logable;
|
||||||
import hep.dataforge.meta.Meta;
|
import hep.dataforge.meta.Meta;
|
||||||
@ -154,7 +155,7 @@ public class ShowSpectrumAction extends OneToOneAction<NMFile, NMFile> {
|
|||||||
axisName += " per " + binning + " chanels";
|
axisName += " per " + binning + " chanels";
|
||||||
}
|
}
|
||||||
|
|
||||||
JFreeChartFrame frame = JFreeChartFrame.drawFrame(head, null);
|
JFreeChartFrame frame = FXPlotUtils.displayJFreeChart(head, null);
|
||||||
|
|
||||||
frame.getYAxisConfig().putValue("title", axisName);
|
frame.getYAxisConfig().putValue("title", axisName);
|
||||||
|
|
||||||
|
@ -26,7 +26,9 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public class RawNMPoint implements Cloneable {
|
public class RawNMPoint implements Cloneable {
|
||||||
|
|
||||||
|
public static final int MAX_EVENTS_PER_POINT = 260000;
|
||||||
public static int MAX_CHANEL = 4095;
|
public static int MAX_CHANEL = 4095;
|
||||||
|
|
||||||
private Instant startTime;
|
private Instant startTime;
|
||||||
private final List<NMEvent> events;
|
private final List<NMEvent> events;
|
||||||
private double length;
|
private double length;
|
||||||
@ -103,6 +105,9 @@ public class RawNMPoint implements Cloneable {
|
|||||||
if (Double.isNaN(length)) {
|
if (Double.isNaN(length)) {
|
||||||
throw new Error();
|
throw new Error();
|
||||||
}
|
}
|
||||||
|
if(events.size()>MAX_EVENTS_PER_POINT){
|
||||||
|
return events.get(events.size()-1).getTime()-events.get(0).getTime();
|
||||||
|
}
|
||||||
return length;
|
return length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,19 +15,12 @@
|
|||||||
*/
|
*/
|
||||||
package inr.numass.models;
|
package inr.numass.models;
|
||||||
|
|
||||||
import hep.dataforge.context.Context;
|
|
||||||
import hep.dataforge.context.GlobalContext;
|
|
||||||
import hep.dataforge.functions.FunctionCaching;
|
import hep.dataforge.functions.FunctionCaching;
|
||||||
import hep.dataforge.io.log.Logable;
|
|
||||||
import hep.dataforge.maths.NamedDoubleSet;
|
import hep.dataforge.maths.NamedDoubleSet;
|
||||||
import hep.dataforge.maths.integration.GaussRuleIntegrator;
|
import hep.dataforge.maths.integration.GaussRuleIntegrator;
|
||||||
import hep.dataforge.maths.integration.UnivariateIntegrator;
|
import hep.dataforge.maths.integration.UnivariateIntegrator;
|
||||||
import hep.dataforge.meta.MetaBuilder;
|
|
||||||
import hep.dataforge.plots.PlotFrame;
|
|
||||||
import hep.dataforge.plots.PlotsPlugin;
|
|
||||||
import hep.dataforge.plots.XYPlotFrame;
|
import hep.dataforge.plots.XYPlotFrame;
|
||||||
import hep.dataforge.plots.data.PlottableFunction;
|
import hep.dataforge.plots.data.PlottableFunction;
|
||||||
import hep.dataforge.plots.jfreechart.JFreeChartFrame;
|
|
||||||
import static java.lang.Math.exp;
|
import static java.lang.Math.exp;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
@ -5,26 +5,30 @@
|
|||||||
*/
|
*/
|
||||||
package inr.numass.workbench;
|
package inr.numass.workbench;
|
||||||
|
|
||||||
|
import hep.dataforge.plots.fx.PlotContainer;
|
||||||
import hep.dataforge.meta.Meta;
|
import hep.dataforge.meta.Meta;
|
||||||
import hep.dataforge.plots.jfreechart.JFreeChartFrame;
|
import hep.dataforge.plots.jfreechart.JFreeChartFrame;
|
||||||
import javafx.scene.layout.AnchorPane;
|
|
||||||
|
|
||||||
public class PlotOutputTab extends OutputTab {
|
public class PlotOutputTab extends OutputTab {
|
||||||
|
|
||||||
private JFreeChartFrame frame;
|
private final JFreeChartFrame frame;
|
||||||
|
|
||||||
public PlotOutputTab(String name, Meta meta) {
|
public PlotOutputTab(String name, Meta meta) {
|
||||||
super(name);
|
super(name);
|
||||||
AnchorPane pane = new AnchorPane();
|
PlotContainer container = new PlotContainer();
|
||||||
frame = new JFreeChartFrame(name, meta, pane);
|
frame = new JFreeChartFrame(name, meta);
|
||||||
setContent(pane);
|
container.setPlot(frame);
|
||||||
|
// AnchorPane pane = new AnchorPane();
|
||||||
|
// frame = new JFreeChartFrame(name, meta).display(pane);
|
||||||
|
setContent(container);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlotOutputTab(String name, String title, Meta meta) {
|
public PlotOutputTab(String name, String title, Meta meta) {
|
||||||
super(name, title);
|
super(name, title);
|
||||||
AnchorPane pane = new AnchorPane();
|
PlotContainer container = new PlotContainer();
|
||||||
frame = new JFreeChartFrame(name, meta, pane);
|
frame = new JFreeChartFrame(name, meta);
|
||||||
setContent(pane);
|
container.setPlot(frame);
|
||||||
|
setContent(container);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
package inr.numass.models;
|
package inr.numass.models;
|
||||||
|
|
||||||
import hep.dataforge.datafitter.ParamSet;
|
import hep.dataforge.datafitter.ParamSet;
|
||||||
import hep.dataforge.plots.jfreechart.JFreeChartFrame;
|
import hep.dataforge.plots.fx.FXPlotUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -36,6 +36,6 @@ public class PlotScatter {
|
|||||||
+ "'ionW' = 11.33 ± 0.43\n"
|
+ "'ionW' = 11.33 ± 0.43\n"
|
||||||
+ "'exIonRatio' = 4.83 ± 0.36"
|
+ "'exIonRatio' = 4.83 ± 0.36"
|
||||||
);
|
);
|
||||||
LossCalculator.plotScatter(JFreeChartFrame.drawFrame("Loss function", null),pars);
|
LossCalculator.plotScatter(FXPlotUtils.displayJFreeChart("Loss function", null),pars);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,56 +13,57 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package inr.numass.models;
|
package inr.numass.models;
|
||||||
|
|
||||||
import hep.dataforge.maths.integration.GaussRuleIntegrator;
|
import hep.dataforge.plots.fx.FXPlotUtils;
|
||||||
import hep.dataforge.plots.PlotFrame;
|
import hep.dataforge.maths.integration.GaussRuleIntegrator;
|
||||||
import hep.dataforge.plots.data.PlottableFunction;
|
import hep.dataforge.plots.PlotFrame;
|
||||||
import hep.dataforge.plots.jfreechart.JFreeChartFrame;
|
import hep.dataforge.plots.data.PlottableFunction;
|
||||||
import org.apache.commons.math3.analysis.UnivariateFunction;
|
import org.apache.commons.math3.analysis.UnivariateFunction;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Alexander Nozik
|
* @author Alexander Nozik
|
||||||
*/
|
*/
|
||||||
public class TestNeLossParametrisation {
|
public class TestNeLossParametrisation {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param args the command line arguments
|
* @param args the command line arguments
|
||||||
*/
|
*/
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
PlotFrame frame = JFreeChartFrame.drawFrame("Loss parametrisation test", null);
|
PlotFrame frame = FXPlotUtils.displayJFreeChart("Loss parametrisation test", null);
|
||||||
UnivariateFunction oldFunction = LossCalculator.getSingleScatterFunction();
|
//JFreeChartFrame.drawFrame("Loss parametrisation test", null);
|
||||||
UnivariateFunction newFunction = getSingleScatterFunction(12.86, 16.78, 1.65, 12.38, 4.79);
|
UnivariateFunction oldFunction = LossCalculator.getSingleScatterFunction();
|
||||||
|
UnivariateFunction newFunction = getSingleScatterFunction(12.86, 16.78, 1.65, 12.38, 4.79);
|
||||||
Double norm = new GaussRuleIntegrator(200).integrate(newFunction, 0d, 100d);
|
|
||||||
|
Double norm = new GaussRuleIntegrator(200).integrate(newFunction, 0d, 100d);
|
||||||
System.out.println(norm);
|
|
||||||
|
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", null, oldFunction, 0, 30, 300));
|
||||||
}
|
frame.add(new PlottableFunction("new", null, newFunction, 0, 30, 300));
|
||||||
|
}
|
||||||
public static UnivariateFunction getSingleScatterFunction(
|
|
||||||
final double exPos,
|
public static UnivariateFunction getSingleScatterFunction(
|
||||||
final double ionPos,
|
final double exPos,
|
||||||
final double exW,
|
final double ionPos,
|
||||||
final double ionW,
|
final double exW,
|
||||||
final double exIonRatio) {
|
final double ionW,
|
||||||
|
final double exIonRatio) {
|
||||||
return (double eps) -> {
|
|
||||||
if (eps <= 0) {
|
return (double eps) -> {
|
||||||
return 0;
|
if (eps <= 0) {
|
||||||
}
|
return 0;
|
||||||
double z = eps - exPos;
|
}
|
||||||
// Используется полная ширина, а не полуширина.
|
double z = eps - exPos;
|
||||||
double res = exIonRatio * Math.exp(-2 * z * z / exW / exW) * Math.sqrt(2 / Math.PI) / exW;
|
// Используется полная ширина, а не полуширина.
|
||||||
|
double res = exIonRatio * Math.exp(-2 * z * z / exW / exW) * Math.sqrt(2 / Math.PI) / exW;
|
||||||
if (eps >= ionPos) {
|
|
||||||
z = 4 * (eps - ionPos) * (eps - ionPos);
|
if (eps >= ionPos) {
|
||||||
res += 4d / (1 + z / ionW / ionW) / Math.PI / ionW;
|
z = 4 * (eps - ionPos) * (eps - ionPos);
|
||||||
}
|
res += 4d / (1 + z / ionW / ionW) / Math.PI / ionW;
|
||||||
return res / (1 + exIonRatio);
|
}
|
||||||
};
|
return res / (1 + exIonRatio);
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
@ -13,28 +13,29 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package inr.numass.models;
|
package inr.numass.models;
|
||||||
|
|
||||||
import hep.dataforge.context.GlobalContext;
|
import hep.dataforge.context.GlobalContext;
|
||||||
import hep.dataforge.plots.data.PlottableData;
|
import hep.dataforge.plots.fx.FXPlotUtils;
|
||||||
import hep.dataforge.plots.data.PlottableFunction;
|
import hep.dataforge.plots.data.PlottableData;
|
||||||
import hep.dataforge.plots.jfreechart.JFreeChartFrame;
|
import hep.dataforge.plots.data.PlottableFunction;
|
||||||
|
import hep.dataforge.plots.jfreechart.JFreeChartFrame;
|
||||||
/**
|
|
||||||
*
|
/**
|
||||||
* @author darksnake
|
*
|
||||||
*/
|
* @author darksnake
|
||||||
public class TransmissionInterpolatorTest {
|
*/
|
||||||
|
public class TransmissionInterpolatorTest {
|
||||||
public static void main(String[] args) {
|
|
||||||
JFreeChartFrame frame = JFreeChartFrame.drawFrame("TransmissionInterpolatorTest", null);
|
public static void main(String[] args) {
|
||||||
TransmissionInterpolator interpolator = TransmissionInterpolator.fromFile(GlobalContext.instance(),
|
JFreeChartFrame frame = FXPlotUtils.displayJFreeChart("TransmissionInterpolatorTest", null);
|
||||||
"d:\\sterile-new\\loss2014-11\\.dataforge\\merge\\empty_sum.out", "Uset", "CR", 15, 0.8, 19002d);
|
//JFreeChartFrame.drawFrame("TransmissionInterpolatorTest", null);
|
||||||
frame.add(new PlottableData("data", interpolator.getX(), interpolator.getY()));
|
TransmissionInterpolator interpolator = TransmissionInterpolator.fromFile(GlobalContext.instance(),
|
||||||
frame.add(new PlottableFunction("interpolated", null, interpolator, interpolator.getXmin(), interpolator.getXmax(), 2000));
|
"d:\\sterile-new\\loss2014-11\\.dataforge\\merge\\empty_sum.out", "Uset", "CR", 15, 0.8, 19002d);
|
||||||
|
frame.add(new PlottableData("data", interpolator.getX(), interpolator.getY()));
|
||||||
// PrintFunction.printFuntionSimple(new PrintWriter(System.out), interpolator, interpolator.getXmin(), interpolator.getXmax(), 500);
|
frame.add(new PlottableFunction("interpolated", null, interpolator, interpolator.getXmin(), interpolator.getXmax(), 2000));
|
||||||
|
|
||||||
}
|
// PrintFunction.printFuntionSimple(new PrintWriter(System.out), interpolator, interpolator.getXmin(), interpolator.getXmax(), 500);
|
||||||
|
}
|
||||||
}
|
|
||||||
|
}
|
||||||
|
@ -19,6 +19,7 @@ import hep.dataforge.meta.Meta;
|
|||||||
import hep.dataforge.meta.MetaBuilder;
|
import hep.dataforge.meta.MetaBuilder;
|
||||||
import hep.dataforge.context.GlobalContext;
|
import hep.dataforge.context.GlobalContext;
|
||||||
import hep.dataforge.data.FileData;
|
import hep.dataforge.data.FileData;
|
||||||
|
import hep.dataforge.plots.fx.FXPlotUtils;
|
||||||
import inr.numass.prop.ar.JNAEpisode;
|
import inr.numass.prop.ar.JNAEpisode;
|
||||||
import inr.numass.prop.ar.JNASpectrum;
|
import inr.numass.prop.ar.JNASpectrum;
|
||||||
import inr.numass.prop.ar.ReadJNADataAction;
|
import inr.numass.prop.ar.ReadJNADataAction;
|
||||||
@ -57,7 +58,7 @@ public class TestReader {
|
|||||||
System.out.printf("%g\t%d%n", entry.getKey(), entry.getValue());
|
System.out.printf("%g\t%d%n", entry.getKey(), entry.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
PlotFrame frame = JFreeChartFrame.drawFrame("JNA_Test", null);
|
PlotFrame frame = FXPlotUtils.displayJFreeChart("JNA test", null);
|
||||||
|
|
||||||
frame.add(new PlottableData(sp.asDataSet(), "chanel", "count"));
|
frame.add(new PlottableData(sp.asDataSet(), "chanel", "count"));
|
||||||
|
|
||||||
|
@ -162,12 +162,13 @@ public class NumassDataLoader extends AbstractLoader implements BinaryLoader<Env
|
|||||||
ByteBuffer buffer = envelope.getData();
|
ByteBuffer buffer = envelope.getData();
|
||||||
buffer.position(0);
|
buffer.position(0);
|
||||||
buffer.order(ByteOrder.LITTLE_ENDIAN);
|
buffer.order(ByteOrder.LITTLE_ENDIAN);
|
||||||
|
double timeCoef = envelope.meta().getDouble("time_coeff",50);
|
||||||
while (buffer.hasRemaining()) {
|
while (buffer.hasRemaining()) {
|
||||||
try {
|
try {
|
||||||
short channel = (short) Short.toUnsignedInt(buffer.getShort());
|
short channel = (short) Short.toUnsignedInt(buffer.getShort());
|
||||||
long time = Integer.toUnsignedLong(buffer.getInt());
|
long time = Integer.toUnsignedLong(buffer.getInt());
|
||||||
byte status = buffer.get();
|
byte status = buffer.get();
|
||||||
NMEvent event = new NMEvent(channel, time);
|
NMEvent event = new NMEvent(channel, (double)time*timeCoef*1e-9);
|
||||||
events.add(event);
|
events.add(event);
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
//LoggerFactory.getLogger(MainDataReader.class).error("Error in data format", ex);
|
//LoggerFactory.getLogger(MainDataReader.class).error("Error in data format", ex);
|
||||||
|
@ -5,7 +5,7 @@ if (!hasProperty('mainClass')) {
|
|||||||
}
|
}
|
||||||
mainClassName = mainClass
|
mainClassName = mainClass
|
||||||
|
|
||||||
version = "0.2.3"
|
version = "0.2.4"
|
||||||
|
|
||||||
description = "The viewer for numass data"
|
description = "The viewer for numass data"
|
||||||
|
|
||||||
|
@ -39,6 +39,7 @@ import javafx.scene.control.ButtonBar.ButtonData;
|
|||||||
import javafx.scene.control.ButtonType;
|
import javafx.scene.control.ButtonType;
|
||||||
import javafx.scene.control.Dialog;
|
import javafx.scene.control.Dialog;
|
||||||
import javafx.scene.control.Label;
|
import javafx.scene.control.Label;
|
||||||
|
import javafx.scene.control.ScrollPane;
|
||||||
import javafx.scene.control.SplitPane;
|
import javafx.scene.control.SplitPane;
|
||||||
import javafx.scene.control.Tab;
|
import javafx.scene.control.Tab;
|
||||||
import javafx.scene.control.TabPane;
|
import javafx.scene.control.TabPane;
|
||||||
@ -103,7 +104,7 @@ public class MainViewerController implements Initializable, FXTaskManager {
|
|||||||
@FXML
|
@FXML
|
||||||
private Label storagePathLabel;
|
private Label storagePathLabel;
|
||||||
@FXML
|
@FXML
|
||||||
private AnchorPane taskPane;
|
private ScrollPane taskPane;
|
||||||
|
|
||||||
private TaskProgressView progressView;
|
private TaskProgressView progressView;
|
||||||
|
|
||||||
@ -126,10 +127,10 @@ public class MainViewerController implements Initializable, FXTaskManager {
|
|||||||
|
|
||||||
consoleButton.setSelected(false);
|
consoleButton.setSelected(false);
|
||||||
loadRemoteButton.setDisable(true);
|
loadRemoteButton.setDisable(true);
|
||||||
mspController.setCallback(this);
|
|
||||||
|
|
||||||
progressView = new TaskProgressView();
|
progressView = new TaskProgressView();
|
||||||
taskPane.getChildren().add(progressView);
|
taskPane.setContent(progressView);
|
||||||
|
// taskPane.setPrefWidth(510);
|
||||||
}
|
}
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
|
@ -270,7 +270,7 @@ public class NumassLoaderViewComponent extends AnchorPane implements Initializab
|
|||||||
.setValue("yAxis.axisUnits", "Hz")
|
.setValue("yAxis.axisUnits", "Hz")
|
||||||
.setValue("legend.show", false);
|
.setValue("legend.show", false);
|
||||||
|
|
||||||
spectrumPlotFrame = new JFreeChartFrame("spectrum", plotMeta, spectrumPlotPane);
|
spectrumPlotFrame = new JFreeChartFrame("spectrum", plotMeta).display(spectrumPlotPane);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (spectrumData == null) {
|
if (spectrumData == null) {
|
||||||
@ -328,7 +328,7 @@ public class NumassLoaderViewComponent extends AnchorPane implements Initializab
|
|||||||
.build())
|
.build())
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
detectorPlotFrame = new JFreeChartFrame("detectorSignal", frameMeta, detectorPlotPane);
|
detectorPlotFrame = new JFreeChartFrame("detectorSignal", frameMeta).display(detectorPlotPane);
|
||||||
|
|
||||||
for (XYPlottable pl : detectorData) {
|
for (XYPlottable pl : detectorData) {
|
||||||
detectorPlotFrame.add(pl);
|
detectorPlotFrame.add(pl);
|
||||||
|
@ -72,16 +72,12 @@ limitations under the License.
|
|||||||
</Tab>
|
</Tab>
|
||||||
</tabs>
|
</tabs>
|
||||||
</TabPane>
|
</TabPane>
|
||||||
<SplitPane dividerPositions="0.0">
|
<AnchorPane prefHeight="200.0" prefWidth="200.0">
|
||||||
<items>
|
<children>
|
||||||
<ScrollPane minWidth="300.0" prefWidth="300.0">
|
<ScrollPane fx:id="taskPane" hbarPolicy="NEVER" minWidth="510.0" prefWidth="510.0" vmax="510.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="0.0" />
|
||||||
<content>
|
<TextArea fx:id="consoleArea" editable="false" minHeight="0.0" wrapText="true" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="510.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
|
||||||
<AnchorPane fx:id="taskPane" minWidth="300.0" prefWidth="300.0" />
|
</children>
|
||||||
</content>
|
</AnchorPane>
|
||||||
</ScrollPane>
|
|
||||||
<TextArea fx:id="consoleArea" editable="false" minHeight="0.0" wrapText="true" />
|
|
||||||
</items>
|
|
||||||
</SplitPane>
|
|
||||||
</items>
|
</items>
|
||||||
</SplitPane>
|
</SplitPane>
|
||||||
</center>
|
</center>
|
||||||
|
Loading…
Reference in New Issue
Block a user