Startup
This commit is contained in:
@@ -7,11 +7,6 @@ import ch.psi.pshell.device.DeviceAdapter;
|
||||
import ch.psi.pshell.epics.ChannelDouble;
|
||||
import ch.psi.pshell.epics.ChannelInteger;
|
||||
import ch.psi.pshell.epics.Epics;
|
||||
import ch.psi.pshell.plot.LinePlotSeries;
|
||||
import ch.psi.pshell.plot.Plot;
|
||||
import ch.psi.pshell.scan.Scan;
|
||||
import ch.psi.pshell.scan.ScanListener;
|
||||
import ch.psi.pshell.scan.ScanRecord;
|
||||
import ch.psi.pshell.ui.App;
|
||||
import ch.psi.pshell.ui.Panel;
|
||||
import ch.psi.pshell.ui.Plugin;
|
||||
@@ -35,25 +30,14 @@ import javax.swing.JTextField;
|
||||
*
|
||||
*/
|
||||
public class WireScan extends Panel {
|
||||
final String[] seriesNames = new String[]{"bpm1_x", "bpm1_y", "bpm1_q", "bpm2_x", "bpm2_y", "bpm2_q"};
|
||||
final JComboBox[] bpmCombos;
|
||||
final JComboBox[] blmCombos;
|
||||
final int[] seriesYAxis = new int[]{1, 1, 2, 1, 1, 2};
|
||||
LinePlotSeries[] series = new LinePlotSeries[seriesNames.length];
|
||||
boolean homed;
|
||||
boolean parked;
|
||||
String currentScannner;
|
||||
|
||||
public WireScan() {
|
||||
initComponents();
|
||||
for (int i=0; i< seriesNames.length; i++){
|
||||
series[i] = new LinePlotSeries(seriesNames[i], null, seriesYAxis[i]);
|
||||
plot.addSeries(series[i]);
|
||||
}
|
||||
plot.getAxis(Plot.AxisId.X).setLabel("Position");
|
||||
plot.getAxis(Plot.AxisId.Y).setLabel("mm");
|
||||
plot.getAxis(Plot.AxisId.Y2).setLabel("pc");
|
||||
plot.setLegendVisible(true);
|
||||
bpmCombos = new JComboBox[]{comboBpm1, comboBpm2, comboBpm3};
|
||||
blmCombos = new JComboBox[]{comboBlm1, comboBlm2, comboBlm3};
|
||||
}
|
||||
@@ -193,41 +177,6 @@ public class WireScan extends Panel {
|
||||
protected void doUpdate() {
|
||||
}
|
||||
|
||||
|
||||
//Plot management
|
||||
ScanListener scanListener = new ScanListener() {
|
||||
@Override
|
||||
public void onScanStarted(Scan scan, String plotTitle) {
|
||||
if ("WireScan".equals(getContext().getExecutionPars().getName())) {
|
||||
for (LinePlotSeries s : series){
|
||||
s.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNewRecord(Scan scan, ScanRecord record) {
|
||||
try{
|
||||
if ("WireScan".equals(getContext().getExecutionPars().getName())) {
|
||||
double position = (Double) record.getValues()[0];
|
||||
for (int i=0; i< series.length; i++){
|
||||
Double val = (Double) record.getValues()[5 + i];
|
||||
if (val != null){
|
||||
series[i].appendData(position, val);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch(Exception ex){
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onScanEnded(Scan scan, Exception ex) {
|
||||
getContext().removeScanListener(this);
|
||||
}
|
||||
};
|
||||
|
||||
boolean isValidScanner(){
|
||||
return (currentScannner!=null) && (!currentScannner.isEmpty());
|
||||
}
|
||||
@@ -798,8 +747,8 @@ public class WireScan extends Panel {
|
||||
}
|
||||
}
|
||||
parameters.add(blms);
|
||||
parameters.add(plot);
|
||||
|
||||
getContext().addScanListener(scanListener);
|
||||
try {
|
||||
runAsync("Diagnostics/WireScan", parameters).handle((ret, ex) -> {
|
||||
if (ex != null) {
|
||||
|
||||
Reference in New Issue
Block a user