Script execution

This commit is contained in:
X11MA
2017-02-03 14:17:49 +01:00
parent dc61667e5a
commit 82c1f1e328
+13 -12
View File
@@ -1,7 +1,7 @@
#Parameters
B1 = -6.8 # starting mag. field in Amps
B2 = 6.8 # final mag. field in Amps
B1 = 6.8 # starting mag. field in Amps
B2 = -6.8 # final mag. field in Amps
BSTEP = 0.2 # step size mag. field in Amps
ENERGIES = (707.90, 703.90) #list of energies in eV
MODE = 'CIRC +' #polarization (CIRC+ or CIRC-)
@@ -14,11 +14,12 @@ FIELD_CHANGE_SLEEP = 0.0 # put the Field settling time if needed
# List of scans. Each scan is defined as: (start,stop, step)
# to make a whole loop two scans are needed: [(B1, B2, BSTEP),(B2,B1,-BSTEP)]
# to make half of a loop one scan is needed: [(B1, B2, BSTEP),] <- don't forget to put comma before ]
RANGES = [(B1, B2, BSTEP),(B2,B1,-BSTEP)]
RANGES = [(B1, B2, BSTEP),(B2,B1,BSTEP)]
#Pre-actions
# Here polarization and offsets are set
'''
if MODE is ["CIRC +", "CIRC -"]:
caput(OTF_MODE1,MODE)
caput(OTF_MODE2,MODE)
@@ -29,7 +30,7 @@ caput(OTF_OFF1,OFFSET1) #caput('X11MA-ID1:ENERGY-OFFS', OFFSET)
caput(OTF_OFF2,OFFSET2)
wait_channel(OTF_DONE, 1, type = 'i')
'''
# Generating a list of mag. fields (setpoints) needed for the loop
setpoints = []
@@ -40,7 +41,7 @@ for r in RANGES:
set_preference(Preference.ENABLED_PLOTS, ['field', 'tey_norm', 'trans_norm'])
set_preference(Preference.PLOT_TYPES, {'tey_norm':1, 'trans_norm':1})
scan = ManualScan(['Mag. field', 'Energy'], ['TEY', 'I0', 'polarization', 'polAngle', 'RingCurrent', 'tey_norm'] , [min(setpoints), min(ENERGIES)], [max(setpoints), max(ENERGIES)], [len(setpoints)-1, len(ENERGIES)-1])
scan = ManualScan(['Mag. field', 'Energy'], ['TEY', 'I0', 'polarization', 'temperature', 'RingCurrent', 'tey_norm'] , [min(setpoints), min(ENERGIES)], [max(setpoints), max(ENERGIES)], [len(setpoints)-1, len(ENERGIES)-1])
scan.start()
# Main loop
@@ -57,24 +58,24 @@ for B in setpoints:
for E in ENERGIES:
print "Setting energy = ", E
caput(OTF_ESET, E)
wait_channel(OTF_DONE, 1, type = 'i')
#caput(OTF_ESET, E)
#wait_channel(OTF_DONE, 1, type = 'i')
readback2 = energy.read()
if abs(readback2 - E) > 0.1 : # TODO: Check accuracy
raise Exception('Energy could not be set to the value ' + str(E))
#if abs(readback2 - E) > 0.1 : # TODO: Check accuracy
# raise Exception('Energy could not be set to the value ' + str(E))
sleep( ENERGY_CHANGE_SLEEP ) # Settling time
detector1 = keithley_1a.read() #Keithley1
detector2 = keithley_2a.read() #Keithley2
#detector3 = keithley_3a.read() #Keithley3
detector4 = caget(OTF_MODE1) #polarization in ID1
detector5 = caget("X11MA-ID1:ALPHA-READ") # polAngle in ID1
#detector6 = temperature.read() #temperature.get()
#detector5 = caget("X11MA-ID1:ALPHA-READ") # polAngle in ID1
detector6 = aget('X11MA-ES3-LSCI:TEMP_RBV') #temperature.get()
detector7 = caget("ARIDI-PCT:CURRENT")
#detector8 = signal_field_analog_x.read() # fieldAnalogX.get()
tey_norm = detector1/detector2
#trans_norm = detector3/detector2
scan.append ([B, E], [readback1, readback2], [detector1, detector2, detector3, detector4, detector5, detector7, tey_norm, trans_norm])
scan.append ([B, E], [readback1, readback2], [detector1, detector2, detector4, detector6, detector7, tey_norm])
scan.end()