Files
x07ma/script/scan_vertical.py
2016-04-03 17:57:35 +02:00

86 lines
3.0 KiB
Python

#Script imported from: scan_vertical.xml
#TODO: Set the diplay names of positioners and detectors
scan = ManualScan(['p2', 'vertical'], ['ADC1', 'ADC2', 'polarization', 'polangle', 'temperature', 'ringCurrent', 'energy', 'ADC3', 'ADC1_norm'] , [770.0, 10.0], [778.0, 23.0], [1, 26])
scan.start()
#Creating channels: dimension 1
#ArrayPositioner p2
p2 = Channel('X07MA-PHS-E:GO.A', type = 'd')
p2Readback = Channel('X07MA-PGM:CERBK', type = 'd')
#Creating channels: dimension 2
#RegionPositioner vertical
vertical = Channel('X07MA-ES1-MAG:TRY1', type = 'd')
#ScalarDetector ADC1
ADC1 = Channel('X07MA-ES1-AI:SIGNAL0', type = 'd')
#ScalarDetector ADC2
ADC2 = Channel('X07MA-ES1-AI:SIGNAL1', type = 'd')
#ScalarDetector polarization
polarization = Channel('X07MA-ID:MODE', type = 'd')
#ScalarDetector polangle
polangle = Channel('X07MA-ID:ALPHA', type = 'd')
#ScalarDetector temperature
temperature = Channel('X07MA-PC-TC:STS:T1', type = 'd')
#ScalarDetector ringCurrent
ringCurrent = Channel('ARIDI-PCT:CURRENT', type = 'd')
#ScalarDetector energy
energy = Channel('X07MA-PHS-E:GO.A', type = 'd')
#ScalarDetector ADC3
ADC3 = Channel('X07MA-ES1-AI:SIGNAL2', type = 'd')
#Dimension 1
#ArrayPositioner p2
for setpoint1 in (778, 770):
p2.put(setpoint1, timeout=None) # TODO: Set appropriate timeout
readback1 = p2Readback.get()
if abs(readback1 - setpoint1) > 0.1 : # TODO: Check accuracy
raise Exception('Actor p2 could not be set to the value ' + str(setpoint1))
#Dimension 2
#Dimension Pre-actions
caput('X07MA-OP-VG13:WT_SET', '1')
#RegionPositioner vertical
for setpoint2 in frange(10.0, 23.0, 0.5, True):
vertical.put(setpoint2, timeout=None) # TODO: Set appropriate timeout
readback2 = vertical.get()
if abs(readback2 - setpoint2) > 0.25 : # TODO: Check accuracy
raise Exception('Actor vertical could not be set to the value ' + str(setpoint2))
sleep( 0.5 ) # Settling time
#Detector ADC1
detector1 = ADC1.get()
#Detector ADC2
detector2 = ADC2.get()
#Detector polarization
detector3 = polarization.get()
#Detector polangle
detector4 = polangle.get()
#Detector temperature
detector5 = temperature.get()
#Detector ringCurrent
detector6 = ringCurrent.get()
#Detector energy
detector7 = energy.get()
#Detector ADC3
detector8 = ADC3.get()
#Manipulation ADC1_norm
#Variable Mappings
c = detector1
d = detector2
#TODO: Move, if needed, this import to the file header: import math
ADC1_norm = c/d
scan.append ([setpoint1, setpoint2], [readback1, readback2], [detector1, detector2, detector3, detector4, detector5, detector6, detector7, detector8, ADC1_norm])
#Closing channels
vertical.close()
ADC1.close()
ADC2.close()
polarization.close()
polangle.close()
temperature.close()
ringCurrent.close()
energy.close()
ADC3.close()
p2.close()
p2Readback.close()
scan.end()