Startup
This commit is contained in:
@@ -47,6 +47,7 @@ if dry_run:
|
||||
motor.config.maxValue = 1000.0
|
||||
else:
|
||||
motor = ch.psi.pshell.epics.Motor("DLAC motor", prefix + ":MOTOR_Y1")
|
||||
motor.config.resolution = 0.001 #In-position band
|
||||
motor.monitored = True
|
||||
motor.initialize()
|
||||
add_device(motor, True)
|
||||
@@ -97,16 +98,16 @@ scan_complete, cur_cycle = False, 0
|
||||
destination = None
|
||||
def check_end_scan(record, scan):
|
||||
global scan_complete, start, destination
|
||||
#if motor.ready:
|
||||
if motor.isInPosition(destination):
|
||||
if motor.ready:
|
||||
#if motor.isInPosition(destination):
|
||||
print "Data aquisition completed"
|
||||
scan_complete=True
|
||||
scan.abort()
|
||||
record.cancel() #So it won't be saved
|
||||
else:
|
||||
position = float( rec[0].timestamp - start )
|
||||
position = float( record[1].timestamp - start )
|
||||
for i in range (len(blms)):
|
||||
plt.getSeries(i).appendData(position, record[1 + i])
|
||||
plt.getSeries(i).appendData(position, record[2 + i])
|
||||
|
||||
|
||||
|
||||
@@ -153,7 +154,7 @@ try:
|
||||
#else:
|
||||
# motor.moveAsync(center_pos + scan_range[0])
|
||||
start = st.take().timestamp
|
||||
mscan (st, st.getReadables() , -1, -1, take_initial = True, after_read = check_end_scan)
|
||||
mscan ( st, [motor.readback,] + st.getReadables(), -1, -1, take_initial = True, after_read = check_end_scan)
|
||||
except:
|
||||
print "Quit scan"
|
||||
if not scan_complete:
|
||||
@@ -171,7 +172,8 @@ try:
|
||||
|
||||
finally:
|
||||
print "Closing stream"
|
||||
st.close()
|
||||
st.close()
|
||||
motor.setSpeed(TRAVEL_SPEED)
|
||||
|
||||
print msg
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ if do_elog:
|
||||
log_msg = "SINEG01-RSYS:SET-VSUM-PHASE-OFFSET-BASE \n"
|
||||
log_msg = log_msg + "Old: %0.1f" % phaseOffset_old + "deg \n"
|
||||
log_msg = log_msg + "New: %0.1f" % phaseOffset_new + "deg \n"
|
||||
log_msg = log_msg + "RF phase at charge on-set %0.1f" % -phaseOffset_new + "deg \n"
|
||||
log_msg = log_msg + "Charge on-set at %0.1f" % -phaseOffset_new + "deg RF phase (0.0 deg beam phase)\n"
|
||||
attachments = []
|
||||
if plt is not None:
|
||||
sleep(0.1) #Give some time to plot to be finished - it is not sync with acquisition
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import ch.psi.pshell.epics.Positioner as Positioner
|
||||
import ch.psi.pshell.epics.ChannelDouble as ChannelDouble
|
||||
|
||||
dry_run = False
|
||||
dry_run = True
|
||||
do_elog = True
|
||||
|
||||
if get_exec_pars().source == CommandSource.ui:
|
||||
@@ -111,9 +111,10 @@ caput(station + "-RSYS:SET-VOLT-POWER-SCALE-CALC", power_scale)
|
||||
if do_elog:
|
||||
title = "Phase scan" + station
|
||||
log_msg = "Data file: " + get_exec_pars().path + "\n"
|
||||
log_msg = log_msg + "Energy Gain: %0.3f" % fit_amplitude + "MeV\n"
|
||||
log_msg = log_msg + "Phase Offset: %0.2f" % phase_offset + "deg\n"
|
||||
log_msg = log_msg + "Amplitude Scale: %0.3f" % amplitude_scale + "MV\n"
|
||||
log_msg = log_msg + "Power Scale: %0.3f" % power_scale + "MW/MV^2"
|
||||
log_msg = log_msg + "On-crest VS phase: %0.2f" % ph_crest + " deg \n"
|
||||
log_msg = log_msg + "Energy Gain: %0.3f" % fit_amplitude + " MeV \n"
|
||||
log_msg = log_msg + "VS -phase Offset: %0.2f" % phase_offset + " deg \n"
|
||||
log_msg = log_msg + "Amplitude Scale: %0.3f" % amplitude_scale + " MV \n"
|
||||
log_msg = log_msg + "Power Scale: %0.3f" % power_scale + " MW/MV^2"
|
||||
attachments = get_plot_snapshots()
|
||||
elog(title, log_msg, attachments)
|
||||
|
||||
Reference in New Issue
Block a user