140 lines
4.1 KiB
Python
140 lines
4.1 KiB
Python
#Script imported from: Mono_pitch.xml
|
|
|
|
#Pre-actions
|
|
caput('X07MB-OP2:START-CSMPL', '0')
|
|
sleep(0.1)
|
|
caput('X07MB-XMAP:StopAll', '1')
|
|
sleep(0.1)
|
|
caput('X07MB-XMAP:PresetMode', '0')
|
|
sleep(0.1)
|
|
caput('X07MB-XMAP:PresetReal', '0')
|
|
sleep(0.1)
|
|
caput('X07MB-OP2:TOTAL-CYCLES', '1')
|
|
sleep(0.1)
|
|
print('dd')
|
|
|
|
#TODO: Set the diplay names of positioners and detectors
|
|
scan = ManualScan(['Pitch'], ['bm3', 'bm4', 'Filter_RY', 'Harmonic', 'TC_Y', 'TC_Z', 'T_THETA', 'Id_OFF', 'Id_energy', 'E_Mono', 'Bragg_Id_theo', 'Theta_rbv', 'Theta_offset', 'Delta_E', 'Delta_theta', 'XX'] , [-10700.0], [-10750.0], [25])
|
|
scan.start()
|
|
|
|
#Creating channels: dimension 1
|
|
#LinearPositioner Pitch
|
|
Pitch = Channel('X07MB-OP-MO:C2-ROX.VAL', type = 'd')
|
|
PitchReadback = Channel('X07MB-OP-MO:C2-ROX.RBV', type = 'd')
|
|
#ScalarDetector bm3
|
|
bm3 = Channel('X07MB-OP2-SAI_03:MEAN', type = 'd')
|
|
#ScalarDetector bm4
|
|
bm4 = Channel('X07MB-OP2-SAI_04:MEAN', type = 'd')
|
|
#ScalarDetector Filter_RY
|
|
Filter_RY = Channel('X07MB-OP-FI:ROY.VAL', type = 'd')
|
|
#ScalarDetector Harmonic
|
|
Harmonic = Channel('X07MA-ID:HARMONIC', type = 'd')
|
|
#ScalarDetector TC_Y
|
|
TC_Y = Channel('X07MB-OP-MOC2:TC_Y', type = 'd')
|
|
#ScalarDetector TC_Z
|
|
TC_Z = Channel('X07MB-OP-MOC2:TC_Z', type = 'd')
|
|
#ScalarDetector T_THETA
|
|
T_THETA = Channel('X07MB-OP-MOTHETA:TC1', type = 'd')
|
|
#ScalarDetector Id_OFF
|
|
Id_OFF = Channel('X07MA-ID:ENERGY-OFFS', type = 'd')
|
|
#ScalarDetector Id_energy
|
|
Id_energy = Channel('X07MA-ID:ENERGY', type = 'd')
|
|
#ScalarDetector E_Mono
|
|
E_Mono = Channel('X07MB-OP-MO:E-GET', type = 'd')
|
|
#ScalarDetector Bragg_Id_theo
|
|
Bragg_Id_theo = Channel('X07MB-OP-MO:BRAGG-CALC', type = 'd')
|
|
#ScalarDetector Theta_rbv
|
|
Theta_rbv = Channel('X07MB-OP-MO:THETA.RBV', type = 'd')
|
|
#ScalarDetector Theta_offset
|
|
Theta_offset = Channel('X07MB-OP-MO:THETA.OFF', type = 'd')
|
|
|
|
#Dimension 1
|
|
#Dimension Guard
|
|
cawait('ACOAU-ACCU:OP-MODE', 6, type = 'l')
|
|
#LinearPositioner Pitch
|
|
for setpoint1 in frange(-10700.0, -10750.0, -2.0, True):
|
|
if setpoint1 > -10700.0 or setpoint1 < -10750.0:
|
|
break
|
|
Pitch.put(setpoint1, timeout=None) # TODO: Set appropriate timeout
|
|
readback1 = PitchReadback.get()
|
|
if abs(readback1 - setpoint1) > 10.0 : # TODO: Check accuracy
|
|
print readback1, setpoint1
|
|
raise Exception('Actor Pitch could not be set to the value ' + str(setpoint1))
|
|
#Detector bm3
|
|
#Detector X07MB-OP2-SAI_03:MEAN pre-actions
|
|
caput('X07MB-OP2:SMPL', '1')
|
|
sleep(0.1)
|
|
cawait('X07MB-OP2:SMPL-DONE', 1, type = 'l')
|
|
detector1 = bm3.get()
|
|
#Detector bm4
|
|
detector2 = bm4.get()
|
|
#Detector Filter_RY
|
|
detector3 = Filter_RY.get()
|
|
#Detector Harmonic
|
|
detector4 = Harmonic.get()
|
|
#Detector TC_Y
|
|
detector5 = TC_Y.get()
|
|
#Detector TC_Z
|
|
detector6 = TC_Z.get()
|
|
#Detector T_THETA
|
|
detector7 = T_THETA.get()
|
|
#Detector Id_OFF
|
|
detector8 = Id_OFF.get()
|
|
#Detector Id_energy
|
|
detector9 = Id_energy.get()
|
|
#Detector E_Mono
|
|
detector10 = E_Mono.get()
|
|
#Detector Bragg_Id_theo
|
|
detector11 = Bragg_Id_theo.get()
|
|
#Detector Theta_rbv
|
|
detector12 = Theta_rbv.get()
|
|
#Detector Theta_offset
|
|
detector13 = Theta_offset.get()
|
|
#Manipulation Delta_E
|
|
#Variable Mappings
|
|
a = detector10
|
|
b = detector9
|
|
Delta_E = a-b
|
|
#Manipulation Delta_theta
|
|
#Variable Mappings
|
|
a = detector11
|
|
b = detector12
|
|
Delta_theta = a-b
|
|
#Manipulation XX
|
|
#Variable Mappings
|
|
a = detector11
|
|
b = detector12
|
|
XX = a*b
|
|
print(XX)
|
|
scan.append ([setpoint1], [readback1], [detector1, detector2, detector3, detector4, detector5, detector6, detector7, detector8, detector9, detector10, detector11, detector12, detector13, Delta_E, Delta_theta, E_Mono, XX])
|
|
|
|
#Closing channels
|
|
Pitch.close()
|
|
PitchReadback.close()
|
|
bm3.close()
|
|
bm4.close()
|
|
Filter_RY.close()
|
|
Harmonic.close()
|
|
TC_Y.close()
|
|
TC_Z.close()
|
|
T_THETA.close()
|
|
Id_OFF.close()
|
|
Id_energy.close()
|
|
E_Mono.close()
|
|
Bragg_Id_theo.close()
|
|
Theta_rbv.close()
|
|
Theta_offset.close()
|
|
|
|
scan.end()
|
|
|
|
|
|
#Post-actions
|
|
caput('X07MB-OP2:START-CSMPL', '1')
|
|
sleep(0.1)
|
|
caput('X07MB-OP2:START-CSMPL', '1')
|
|
sleep(0.3)
|
|
caput('X07MB-OP2:SMPL', '1')
|
|
sleep(0.3)
|
|
caput('X07MB-OP2:SMPL', '1')
|
|
sleep(0.3)
|