Summer 2021

This commit is contained in:
gac-x07ma
2021-09-01 10:22:59 +02:00
parent 99bca0bd79
commit ca26181ed4
94 changed files with 2062 additions and 315 deletions

View File

@@ -7,7 +7,14 @@ ENERGY_CHANGE_SLEEP = 0.5
MODE = 'CIRC +'
OFFSET = -1.0
'''
"""
FIELD = field_x
RANGES =[(B1, B2, rr1),(B2,-B2,rr2),(-B2,-B1,rr1)]
ENERGIES = [E1,E2]
ENERGY_CHANGE_SLEEP = 0.5
MODE =None
OFFSET=None
"""
FIELD_PRECISION = 0.01
if FIELD == field_z: FIELD = "Hz"
@@ -23,7 +30,7 @@ if MODE is not None:
pol_mode.write(MODE)
if OFFSET is not None:
pol_offset.write(OFFSET) #caput('X07MA-ID:ENERGY-OFFS', OFFSET)
caputq('X07MA-PC:CSCALER.INPB', '1')
#caputq('X07MA-PC:CSCALER.INPB', '1')
if len(ENERGIES) ==2:
dif_series = plot([],"Dif", title="Dif")[0].getSeries(0)
@@ -59,8 +66,32 @@ for (START_FIELD, END_FIELD, RAMP_RATE) in RANGES:
time.sleep(0.1)
print "Done waiting"
else:
# OLD AND PRONE TO HANG
#time.sleep(3.0)
#wait_device(field_done, 1) #ramp_done.wait_for_value(1.0)
# NEW, copied from hystscan_esr, april 2021
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)
### this waiting procedure was introduced because sometimes the field does not move and the whole script gets stuck then.
difference = field.readback.read() - START_FIELD
difference0 = difference # difference0 is the field offset before entering the stabilization loop
last_difference = difference # last_difference is updated during the stabilization loop
while abs(difference) > FIELD_PRECISION:
time.sleep(5.0)
difference = field.readback.read() - START_FIELD
# resend a start ramp in case nothing is happening, ie when it is stuck in this waitfield
if abs(difference-difference0) < FIELD_PRECISION:
caput('X07MA-PC-MAG:STARTRAMP.PROC',1)
print('Field setting stuck: re-starting ramp')
# also resend a start ramp in case nothing is happening wrt to the last 5 seconds
elif abs(difference-last_difference) < FIELD_PRECISION:
caput('X07MA-PC-MAG:STARTRAMP.PROC',1)
print('Field setting stuck: re-starting ramp')
last_difference = difference