Startup
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
* Copyright (c) 2014 Paul Scherrer Institute. All rights reserved.
|
||||
*/
|
||||
|
||||
import ch.psi.pshell.plot.LinePlotErrorSeries;
|
||||
import ch.psi.pshell.plot.LinePlotJFree;
|
||||
import ch.psi.pshell.plot.LinePlotSeries;
|
||||
import ch.psi.pshell.plot.Plot;
|
||||
import ch.psi.pshell.scan.Scan;
|
||||
@@ -27,6 +29,7 @@ public class GunSolenoidAlignment extends Panel {
|
||||
|
||||
public GunSolenoidAlignment() {
|
||||
initComponents();
|
||||
centroidPlot.setStyle(LinePlotJFree.Style.ErrorXY);
|
||||
}
|
||||
boolean running;
|
||||
|
||||
@@ -34,7 +37,9 @@ public class GunSolenoidAlignment extends Panel {
|
||||
public void onNewRecord(Scan scan, ScanRecord record) {
|
||||
try {
|
||||
if (running) {
|
||||
scanSeries.appendData((Double) record.getValues()[0], (Double) record.getValues()[1]);
|
||||
double error_x = 0.2;
|
||||
double error_y = 0.4;
|
||||
scanSeries.appendData((Double) record.getValues()[0], (Double) record.getValues()[1], error_x, error_y);
|
||||
progressBar.setValue((int) (1000.0 * record.getIndex() / scan.getNumberOfRecords()));
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
@@ -70,7 +75,7 @@ public class GunSolenoidAlignment extends Panel {
|
||||
protected void doUpdate() {
|
||||
}
|
||||
|
||||
LinePlotSeries scanSeries;
|
||||
LinePlotErrorSeries scanSeries;
|
||||
|
||||
int index = 1;
|
||||
|
||||
@@ -80,9 +85,13 @@ public class GunSolenoidAlignment extends Panel {
|
||||
//double[] y =(double[]) Convert.toDouble(sr.getReadable(1));
|
||||
double[] x = (double[]) Convert.toDouble(hx);
|
||||
double[] y = (double[]) Convert.toDouble(hy);
|
||||
LinePlotSeries hull = new LinePlotSeries(scanSeries.getName() + "H", scanSeries.getColor());
|
||||
LinePlotErrorSeries hull = new LinePlotErrorSeries(scanSeries.getName() + "H", scanSeries.getColor());
|
||||
centroidPlot.addSeries(hull);
|
||||
hull.setData((double[]) Convert.toDouble(x), (double[]) Convert.toDouble(y));
|
||||
//hull.setData((double[]) Convert.toDouble(x), (double[]) Convert.toDouble(y));
|
||||
for (int i=0; i<x.length; i++){
|
||||
hull.appendData(x[i], y[i], Double.NaN, Double.NaN);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@@ -346,7 +355,7 @@ public class GunSolenoidAlignment extends Panel {
|
||||
private void buttonRunActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonRunActionPerformed
|
||||
try {
|
||||
progressBar.setValue(0);
|
||||
scanSeries = new LinePlotSeries(String.valueOf(index++));
|
||||
scanSeries = new LinePlotErrorSeries(String.valueOf(index++));
|
||||
centroidPlot.addSeries(scanSeries);
|
||||
scanSeries.setLinesVisible(false);
|
||||
scanSeries.setPointSize(4);
|
||||
|
||||
Reference in New Issue
Block a user