Files
x07ma/script/unused/harmonic_TEST.py
2020-02-18 13:34:57 +01:00

96 lines
3.3 KiB
Python

#Script imported from: harmonic_TEST.xml
#Pre-actions
caput('X07MA-ID:ENERGY', '776.7')
cawait('X07MA-ID:DONE', 'DONE', type = 's')
caput('X07MA-PHS-E:OPT', 'PGM')
#TODO: Set the diplay names of positioners and detectors
scan = ManualScan(['IDenergy', 'PGMenergy'], ['sample', 'I0', 'polarization', 'polangle', 'temperature', 'ringCurrent', 'SetEnergy', 'field', 'transmission', 'offset'] , [600.0, 766.0], [750.0, 780.0], [3, 14])
scan.start()
#Creating channels: dimension 1
#ArrayPositioner IDenergy
IDenergy = Channel('X07MA-ID:ENERGY', type = 'd')
#Creating channels: dimension 2
#RegionPositioner PGMenergy
PGMenergy = Channel('X07MA-PHS-E:GO.A', type = 'd')
PGMenergyReadback = Channel('X07MA-PGM:CERBK', type = 'd')
#ScalarDetector sample
sample = Channel('X07MA-ES1-AI:SIGNAL0', type = 'd')
#ScalarDetector I0
I0 = 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 SetEnergy
SetEnergy = Channel('X07MA-PHS-E:GO.A', type = 'd')
#ScalarDetector field
field = Channel('X07MA-PC-PS2:STS:PMCURRENT', type = 'd')
#ScalarDetector transmission
transmission = Channel('X07MA-ES1-AI:SIGNAL2', type = 'd')
#ScalarDetector offset
offset = Channel('X07MA-ID:ENERGY-OFFS', type = 'd')
#Dimension 1
#ArrayPositioner IDenergy
for setpoint1 in (600, 650, 700, 750):
IDenergy.put(setpoint1, timeout=None) # TODO: Set appropriate timeout
readback1 = IDenergy.get()
if abs(readback1 - setpoint1) > 0.1 : # TODO: Check accuracy
raise Exception('Actor IDenergy could not be set to the value ' + str(setpoint1))
#Dimension 2
#RegionPositioner PGMenergy
for setpoint2 in frange(766.0, 780.0, 1.0, True):
PGMenergy.put(setpoint2, timeout=None) # TODO: Set appropriate timeout
readback2 = PGMenergyReadback.get()
if abs(readback2 - setpoint2) > 0.5 : # TODO: Check accuracy
raise Exception('Actor PGMenergy could not be set to the value ' + str(setpoint2))
sleep( 0.5 ) # Settling time
#Detector sample
detector1 = sample.get()
#Detector I0
detector2 = I0.get()
#Detector polarization
detector3 = polarization.get()
#Detector polangle
detector4 = polangle.get()
#Detector temperature
detector5 = temperature.get()
#Detector ringCurrent
detector6 = ringCurrent.get()
#Detector SetEnergy
detector7 = SetEnergy.get()
#Detector field
detector8 = field.get()
#Detector transmission
detector9 = transmission.get()
#Detector offset
detector10 = offset.get()
scan.append ([setpoint1, setpoint2], [readback1, readback2], [detector1, detector2, detector3, detector4, detector5, detector6, detector7, detector8, detector9, detector10])
#Closing channels
PGMenergy.close()
PGMenergyReadback.close()
sample.close()
I0.close()
polarization.close()
polangle.close()
temperature.close()
ringCurrent.close()
SetEnergy.close()
field.close()
transmission.close()
offset.close()
IDenergy.close()
scan.end()
#Post-actions
caput('X07MA-PHS-E:OPT', 'PGM+ID')