Script execution

This commit is contained in:
gac-x11ma
2017-11-30 13:49:48 +01:00
parent 7f66f03b44
commit 90fe3cd8a0

View File

@@ -1,27 +1,27 @@
#Parameters
'''
B = 0.5 # starting mag. field in Amps
E1 = 704 #start energy
E2 = 708 #end energy
dE = 1.0 # energy step size
MODE = 1 #polarization (CIRC+ -> 1 or CIRC- -> 2)
OFFSET1 = -15 #ID1 offset
OFFSET2 = -15 #ID2 offset
OFFSET1 = -0.4 #ID1 offset
OFFSET2 = -1.9 #ID2 offset
FIELD_PRECISION = 0.05 # in Amps
ENERGY_CHANGE_SLEEP = 0.0 # put the Enerrgy settling time if needed
'''
#Pre-actions
# Here polarization and offsets are set
caput ("X11PHS-E:OPT","PGM+ID1+ID2")
caput(OTF_OFF1,OFFSET1) #detune ID1
caput ("X11PHS-E:OPT","PGM+ID2")
#caput(OTF_OFF1,OFFSET1) #detune ID1
caput(OTF_OFF2,OFFSET2) #detune ID2
wait_channel(OTF_DONE, 1, type = 'i')
if MODE is 1 or 2:
caput(OTF_MODE1,MODE)
# caput(OTF_MODE1,MODE)
caput(OTF_MODE2,MODE)
else:
raise Exception("Invalid polarization type: " + MODE)
@@ -36,8 +36,11 @@ fields = [B,-B]
set_preference(Preference.ENABLED_PLOTS, ['energy', 'tey_norm'])
set_preference(Preference.PLOT_TYPES, {'tey_norm':1})
scan = ManualScan('Energy', 'Field'], ['TEY', 'I0', 'polarization', 'RingCurrent', 'tey_norm'] , [min(setpoints), min(fields)], [max(setpoints), max(fields)], [len(setpoints)-1, len(fields)-1])
scan.start()
scan1 = ManualScan(['Energy', 'Field'], ['TEY', 'I0', 'polarization', 'RingCurrent', 'tey_norm'] , [min(setpoints), min(fields)], [max(setpoints), max(fields)], [len(setpoints)-1, len(fields)-1])
scan1.start()
scan2 = ManualScan(['Energy', 'Field'], ['TEY', 'I0', 'polarization', 'RingCurrent', 'tey_norm'] , [min(setpoints), min(fields)], [max(setpoints), max(fields)], [len(setpoints)-1, len(fields)-1])
scan2.start()
# Main loop
for E in setpoints:
@@ -45,7 +48,7 @@ for E in setpoints:
caput("OTF_ESET",E)
wait_channel(OTF_DONE, 1, type = 'i') # Settling time
readback1 = caget("X11MA-XMCD:Ireadout")
readback1 = caget("X11MA-PGM:rbkenergy")
if abs(readback1 - E) > 0.1 : # TODO: Check accuracy
raise Exception('Energy could not be set to the value ' + str(E))
sleep( ENERGY_CHANGE_SLEEP ) # Settling time
@@ -75,6 +78,12 @@ for E in setpoints:
elif detector4 == 'CIRC -': detector4 = 2
else: detector4 = 0
scan.append ([E, H], [readback1, readback2], [detector1, detector2, detector4, detector7, tey_norm])
if(H>0):
scan1.append ([E, H], [readback1, readback2], [detector1, detector2, detector4, detector7, tey_norm])
if(H<0):
scan2.append ([E, H], [readback1, readback2], [detector1, detector2, detector4, detector7, tey_norm])
else:
raise Exception('Wrong B field value:' + str(H))
scan.end()