Closedown
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
#Wed May 31 15:42:57 CEST 2017
|
||||
#Tue Jun 13 14:49:25 CEST 2017
|
||||
maxValue=360.0
|
||||
minValue=-180.0
|
||||
offset=0.0
|
||||
precision=3
|
||||
resolution=1.0
|
||||
rotation=true
|
||||
scale=1.0
|
||||
unit=deg
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#Tue Jun 13 14:39:50 CEST 2017
|
||||
#Tue Jun 13 15:03:41 CEST 2017
|
||||
colormap=Flame
|
||||
colormapAutomatic=true
|
||||
colormapMax=0.0
|
||||
colormapMax=500.0
|
||||
colormapMin=0.0
|
||||
flipHorizontally=false
|
||||
flipVertically=false
|
||||
flipVertically=true
|
||||
grayscale=false
|
||||
imageHeight=1680
|
||||
imageWidth=1744
|
||||
@@ -21,9 +21,9 @@ rotation=0.0
|
||||
rotationCrop=false
|
||||
scale=1.0
|
||||
serverURL=localhost\:10000
|
||||
spatialCalOffsetX=-282.53713765286636
|
||||
spatialCalOffsetY=-271.47711191409877
|
||||
spatialCalScaleX=-26.857654389880953
|
||||
spatialCalScaleY=-27.12477305237676
|
||||
spatialCalOffsetX=-861.0
|
||||
spatialCalOffsetY=-820.0
|
||||
spatialCalScaleX=-18.90359168241966
|
||||
spatialCalScaleY=-19.37984496124031
|
||||
spatialCalUnits=mm
|
||||
transpose=false
|
||||
|
||||
@@ -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;
|
||||
});
|
||||
|
||||
@@ -2,6 +2,7 @@ import ch.psi.pshell.epics.Positioner as Positioner
|
||||
import ch.psi.pshell.epics.ChannelDouble as ChannelDouble
|
||||
|
||||
dry_run = True
|
||||
do_elog = False
|
||||
if get_exec_pars().source == CommandSource.ui:
|
||||
start = -30.0
|
||||
stop = 30.0
|
||||
@@ -54,7 +55,7 @@ rph0 = rph.read()
|
||||
#Record callback: uptate of output plot
|
||||
def after_sample(record, scan):
|
||||
if plt is not None:
|
||||
plt.getSeries(0).appendData(record.positions[0], record.values[0].mean, record.values[0].stdev)
|
||||
plt.getSeries(0).appendData(record.positions[0], record.values[1].mean, record.values[1].stdev)
|
||||
|
||||
try:
|
||||
rph_averager = create_averager(rph, nb, 0.1) # Set polling time to -1 for BS data to get all messages
|
||||
@@ -80,6 +81,19 @@ rph_ref = rfphase[index_max] - 80
|
||||
print "Beam phase reference = ", bph_ref
|
||||
print "RF phase reference = ", rph_ref
|
||||
|
||||
if do_elog:
|
||||
if get_option("Generated data file:\n" + get_exec_pars().path +"\n\n" + "Save to ELOG?", "YesNo") == "Yes":
|
||||
log_msg = "Data file: " + get_exec_pars().path + "\n"
|
||||
log_msg = log_msg + "Beam phase reference: %0.1f" % bph_ref + "\n"
|
||||
log_msg = log_msg + "RF phase reference: %0.1f" % rph_ref + "\n"
|
||||
attachments = []
|
||||
if plt is not None:
|
||||
sleep(0.1) #Give some time to plot to be finished - it is not sync with acquisition
|
||||
file_name = os.path.abspath(get_context().setup.getContextPath() + "/SchottkyScanPlot.png")
|
||||
plt.saveSnapshot(file_name , "png")
|
||||
attachments = [file_name,]
|
||||
elog("Gun scan", log_msg, attachments)
|
||||
|
||||
set_return([bph_ref, rph_ref])
|
||||
|
||||
|
||||
|
||||
@@ -2,12 +2,15 @@ dry_run = True
|
||||
do_elog = True
|
||||
|
||||
if get_exec_pars().source == CommandSource.ui:
|
||||
phaseOffset = args[0]
|
||||
phaseOffset = rph_ref
|
||||
plt = None
|
||||
do_elog = False
|
||||
else:
|
||||
phaseOffset = args[0]
|
||||
plt = args[1]
|
||||
|
||||
print "Setting phase offset: ", phaseOffset
|
||||
|
||||
phaseOffset = -phaseOffset
|
||||
|
||||
if not dry_run:
|
||||
|
||||
Reference in New Issue
Block a user