This commit is contained in:
voulot_d
2017-07-14 14:34:28 +02:00
parent 54c3592384
commit c69cf02dc8
6 changed files with 29 additions and 26 deletions
+8 -6
View File
@@ -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