fixed HystScanMult
This commit is contained in:
@@ -1,2 +1,2 @@
|
||||
#Tue Feb 18 13:53:05 CET 2020
|
||||
FileSequentialNumber=2115
|
||||
#Tue Feb 18 16:00:59 CET 2020
|
||||
FileSequentialNumber=2126
|
||||
|
||||
@@ -208,7 +208,7 @@ try:
|
||||
raise Exception("Data file not found: " + name)
|
||||
|
||||
convert_file(name, newName)
|
||||
log("Created data file: " + newName)
|
||||
mail
|
||||
#plot_file(newName)
|
||||
#print("Success")
|
||||
#"PlotDomain", "Ecrbk"
|
||||
|
||||
@@ -1,30 +1,24 @@
|
||||
#Parameters
|
||||
"""
|
||||
'''
|
||||
FIELD = "Hx"
|
||||
RANGES = [(-0.1, 0.1, 0,2),]
|
||||
RANGES = [(-0.2, -0.1, 1.5),(-0.1, 0.0, 1.0),(0.0, 0.1, 1.0),(0.1, 0.2, 1.5)]
|
||||
ENERGIES = (707.90, 703.90)
|
||||
ENERGY_CHANGE_SLEEP = 0.5
|
||||
MODE = 'CIRC +'
|
||||
OFFSET = -1.0
|
||||
"""
|
||||
|
||||
iPS = False # false for old power supply, True for new (Oxford Instr) supply
|
||||
|
||||
if iPS == True:
|
||||
caput('X07MA-ES1-IPS:RAMP-ENBL', 1) # enable non-overshoot mode
|
||||
'''
|
||||
|
||||
|
||||
FIELD_PRECISION = 0.01
|
||||
if FIELD == field_z: FIELD = "Hz"
|
||||
field = field_z if FIELD == "Hz" else (field_x_ips if iPS else field_x )
|
||||
field_done = field_z_done if FIELD == "Hz" else (None if iPS else field_x_done)
|
||||
ramp_rate = ramp_rate_z if FIELD == "Hz" else (ramp_rate_x_ips if iPS else ramp_rate_x)
|
||||
|
||||
START_FIELD=RANGES[0][0] # ADDED BY CP ON 7.2.2020
|
||||
field = field_z if FIELD == "Hz" else field_x
|
||||
field_done = field_z_done if FIELD == "Hz" else field_x_done
|
||||
ramp_rate = ramp_rate_z if FIELD == "Hz" else ramp_rate_x
|
||||
|
||||
#Pre-actions
|
||||
#cawait('ACOAU-ACCU:OP-MODE', 'Light Available', type = 's')
|
||||
wait_beam()
|
||||
|
||||
if NO_BEAM_CHECK == False:
|
||||
wait_beam()
|
||||
if MODE is not None:
|
||||
pol_mode.write(MODE)
|
||||
if OFFSET is not None:
|
||||
@@ -39,54 +33,29 @@ else:
|
||||
set_preference(Preference.ENABLED_PLOTS, ['field', 'tey_norm', 'trans_norm'])
|
||||
set_preference(Preference.PLOT_TYPES, {'tey_norm':1, 'trans_norm':1})
|
||||
|
||||
print "Set energy..."
|
||||
setpoint2 = ENERGIES[0]
|
||||
print setpoint2
|
||||
energy.write(setpoint2)
|
||||
#sleep( ENERGY_CHANGE_SLEEP ) # Settling time
|
||||
|
||||
scan = ManualScan(['field', 'Energy'], ['TEY', 'I0', 'trans', 'polarization', 'polAngle', 'temperature', 'RingCurrent', 'fieldAnalogX', 'tey_norm','trans_norm'], [0.0, ENERGIES[0]], [0.0, ENERGIES[-1]], [0, len(ENERGIES)-1])
|
||||
field_var = 'fieldAnalogZ' if (FIELD == "Hz") else 'fieldAnalogX'
|
||||
scan = ManualScan(['field', 'Energy'], ['TEY', 'I0', 'trans', 'polarization', 'polAngle', 'temperature', 'RingCurrent', field_var, 'tey_norm','trans_norm'], [0.0, ENERGIES[0]], [0.0, ENERGIES[-1]], [0, len(ENERGIES)-1])
|
||||
scan.start()
|
||||
|
||||
write_logs()
|
||||
|
||||
#for (START_FIELD, END_FIELD, RAMP_RATE) in RANGES:
|
||||
for (START_FIELD, END_FIELD, RAMP_RATE) in RANGES:
|
||||
#ramp_rate.write(RAMP_RATE)
|
||||
# if abs(field.readback.read() - START_FIELD) > FIELD_PRECISION:
|
||||
# print "Setting start field: ", START_FIELD
|
||||
# field.write(START_FIELD)
|
||||
# time.sleep(3.0)
|
||||
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)
|
||||
|
||||
#wait_device(field_done, 1) #ramp_done.wait_for_value(1.0)
|
||||
|
||||
|
||||
|
||||
if abs(field.readback.read() - START_FIELD) > FIELD_PRECISION:
|
||||
ramp_rate.write(2.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)
|
||||
|
||||
wait_device(pol_done, "DONE")
|
||||
|
||||
ramp_rate.write(RAMP_RATE)
|
||||
if RAMP_RATE is not None:
|
||||
ramp_rate.write(RAMP_RATE)
|
||||
ramp_rate.waitInPosition(RAMP_RATE,10000)
|
||||
|
||||
print "Set end field: ", END_FIELD
|
||||
field.write(END_FIELD) #caputq('X07MA-PC-PS2:M:GO.A', END_FIELD)
|
||||
|
||||
@@ -114,17 +83,16 @@ if abs(field.readback.read() - START_FIELD) > FIELD_PRECISION:
|
||||
detector7 = current.read()
|
||||
detector8 = signal_field_analog_x.read() # fieldAnalogX.get()
|
||||
|
||||
_tey_norm = detector1/detector2
|
||||
_trans_norm = detector3/detector2
|
||||
tey_norm = detector1/detector2
|
||||
trans_norm = detector3/detector2
|
||||
|
||||
if dif_series is not None:
|
||||
if setpoint2 == ENERGIES[0]:
|
||||
first = _tey_norm
|
||||
first = tey_norm
|
||||
else:
|
||||
dif = _tey_norm-first
|
||||
dif = tey_norm-first
|
||||
dif_series.appendData(field_readback,dif)
|
||||
scan.append ([field_readback, setpoint2], [field_readback, readback2], [detector1, detector2, detector3, detector4, detector5, detector6, detector7, detector8, _tey_norm, _trans_norm])
|
||||
after_sample() #To call check_id_error()
|
||||
scan.append ([field_readback, setpoint2], [field_readback, readback2], [detector1, detector2, detector3, detector4, detector5, detector6, detector7, detector8, tey_norm, trans_norm])
|
||||
|
||||
if field_done.read() == 1: #If not ramping #ramp_done.get() == 1:
|
||||
print "Reached end field. Readback=", field_readback
|
||||
@@ -134,5 +102,11 @@ if abs(field.readback.read() - START_FIELD) > FIELD_PRECISION:
|
||||
scan.end()
|
||||
|
||||
if RAMP_RATE is not None:
|
||||
ramp_rate.write(2.0)
|
||||
ramp_rate.waitInPosition(2.0,10000)
|
||||
if FIELD == "Hz":
|
||||
print "Reset ramp rate-z"
|
||||
ramp_rate.write(0.35)
|
||||
ramp_rate.waitInPosition(0.35,10000)
|
||||
else:
|
||||
print "Reset ramp rate-x"
|
||||
ramp_rate.write(2.0)
|
||||
ramp_rate.waitInPosition(2.0,10000)
|
||||
|
||||
Reference in New Issue
Block a user