This commit is contained in:
gac-x07ma
2020-03-17 10:13:45 +01:00
parent 0a68e48eae
commit a72079f33c
12 changed files with 114 additions and 38 deletions

View File

@@ -43,12 +43,27 @@ for (START_FIELD, END_FIELD, RAMP_RATE) in RANGES:
#ramp_rate.write(RAMP_RATE)
if abs(field.readback.read() - START_FIELD) > FIELD_PRECISION:
ramp_rate.write(2.0)
print "Setting start field: ", START_FIELD
field.write(START_FIELD)
time.sleep(3.0)
field.write(START_FIELD)
#if iPS == True:
#caput("X07MA-PC-MAG:X:DMD",float(START_FIELD))
if field_done is None:
#ramp_rate.write(2.0)
ramp_rate.waitInPosition(2.0,10000)
time.sleep(1.0)
caput("X07MA-ES1-IPS:ACTION", 1)
time.sleep(3.0)
wait_device_in_range(field, START_FIELD, FIELD_PRECISION)
print "Waiting field done..."
while caget("X07MA-ES1-IPS:OUTPUT_RBV", "i") != 0 :
time.sleep(0.1)
print "Done waiting"
else:
time.sleep(3.0)
wait_device(field_done, 1) #ramp_done.wait_for_value(1.0)
wait_device(field_done, 1) #ramp_done.wait_for_value(1.0)
wait_device(pol_done, "DONE")
#open_valve(2.0)
@@ -68,8 +83,23 @@ for (START_FIELD, END_FIELD, RAMP_RATE) in RANGES:
#TODO: change to Controlled variable?
readback2 = energy_readback.read() #EnergyReadback.get()
#if abs(readback2 - setpoint2) > 0.5 : # TODO: Check accuracy
# raise Exception('Energy could not be set to the value ' + str(setpoint2))
#while abs(readback2 - setpoint2) > 0.1 : # TODO: Check accuracy
#print "Energy could not be set to the value ", setpoint2, "Readback:", readback2
#time.sleep(2.0)
#energy.write(setpoint2)
#sleep( ENERGY_CHANGE_SLEEP ) # Settling time
#readback2 = energy_readback.read()
#readback2 = energy_readback.read() #EnergyReadback.get()
if abs(readback2 - setpoint2) > 0.1 : # TODO: Check accuracy
raise Exception('Energy could not be set to the value ' + str(setpoint2))
#raise Exception('Energy could not be set to the value ' + str(setpoint2))
#print 'Energy could not be set to the value, try again. ' + str(setpoint2)
energy.write(setpoint2)
sleep( ENERGY_CHANGE_SLEEP ) # Settling time
#Detector field readback
field_readback = field.readback.read() #fieldReadback.get()
@@ -101,6 +131,8 @@ for (START_FIELD, END_FIELD, RAMP_RATE) in RANGES:
scan.end()
log_scan_filename()
if RAMP_RATE is not None:
if FIELD == "Hz":
print "Reset ramp rate-z"