Closedown

This commit is contained in:
gobbo_a
2017-06-13 15:36:03 +02:00
parent 32cf859f02
commit b9c8be1435
5 changed files with 37 additions and 56 deletions

View File

@@ -25,16 +25,11 @@ import javax.swing.JSpinner;
*/
public class SchottkyScan extends Panel {
LinePlotErrorSeries series = new LinePlotErrorSeries("Values");
Double rfPhase;
Double beamPhase;
public SchottkyScan() {
initComponents();
plot.setStyle(LinePlotJFree.Style.ErrorY);
plot.addSeries(series);
plot.getAxis(Plot.AxisId.X).setLabel("RF Gun Phase");
plot.getAxis(Plot.AxisId.Y).setLabel("SINEG01-DICT215:B1_CHARGE");
setPersistedComponents(SwingUtils.getComponentsByType(panelPars, JSpinner.class));
}
@@ -65,39 +60,6 @@ public class SchottkyScan extends Panel {
protected void doUpdate() {
}
@Override
public void onStart() {
super.onStart();
getContext().addScanListener(scanListener);
}
@Override
public void onStop() {
getContext().removeScanListener(scanListener);
super.onStop();
}
ScanListener scanListener = new ScanListener() {
@Override
public void onScanStarted(Scan scan, String plotTitle) {
if ("SchottkyScan".equals(getContext().getExecutionPars().getName())) {
series.clear();
}
}
@Override
public void onNewRecord(Scan scan, ScanRecord record) {
if ("SchottkyScan".equals(getContext().getExecutionPars().getName())) {
series.appendData((Double) record.getPositions()[0], ((DescStatsDouble) record.getValues()[0]).getMean(),
((DescStatsDouble) record.getValues()[0]).getStdev());
}
}
@Override
public void onScanEnded(Scan scan, Exception ex) {
}
};
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
@@ -329,7 +291,9 @@ public class SchottkyScan extends Panel {
if (ex != null) {
getLogger().info("Exception executing scan: " + ex);
} else {
spinnerPhaseRef.setValue(Convert.roundDouble((Double) ret, 1));
Double bph_ref = (Double) ((List)ret).get(0);
Double rph_ref = (Double) ((List)ret).get(1);
spinnerPhaseRef.setValue(Convert.roundDouble(bph_ref, 1));
}
return ret;
});
@@ -358,15 +322,14 @@ public class SchottkyScan extends Panel {
}//GEN-LAST:event_spinnerPhaseRefStateChanged
private void buttonSetActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonSetActionPerformed
ArrayList parameters = new ArrayList();
parameters.add((Double) spinnerPhaseRef.getValue());
parameters.add(plot);
try {
double phaseOffset = -((Double) spinnerPhaseRef.getValue());
String cmd = "caput('SINEG01-RSYS:SET-VSUM-PHASE-OFFSET-BASE', " + phaseOffset + ");";
cmd += "caput('SINEG01-RSYS:CMD-LOAD-CALIB-BEAM', 1)";
evalAsync(cmd).handle((ret, ex) -> {
//How to get a callback on the end of execution
runAsync("RFscan/SchottkyScanSet", parameters).handle((ret, ex) -> {
if (ex != null) {
showException((Exception) ex);
} else {
SwingUtils.showMessage(this, "Success", "Success setting ref phase");
getLogger().info("Exception executing scan: " + ex);
}
return ret;
});