129 lines
4.0 KiB
Python
129 lines
4.0 KiB
Python
#Script imported from: Fe_hyst_plus.xml
|
|
|
|
#Parameters
|
|
START_FIELD = 1.0
|
|
END_FIELD = -1.0
|
|
ENERGIES = (707.90, 703.90)
|
|
|
|
#Pre-actions
|
|
#cawait('ACOAU-ACCU:OP-MODE', 'Light Available', type = 's')
|
|
#caput('X07MA-ID:MODE', 'CIRC +')
|
|
sleep(1.0)
|
|
#cawait('X07MA-ID:DONE', 'DONE', type = 's')
|
|
#caput('X07MA-ID:ENERGY-OFFS', '-1.0')
|
|
#cawait('X07MA-ID:DONE', 'DONE', type = 's')
|
|
caputq('X07MA-PC:CSCALER.INPB', '1')
|
|
caputq('X07MA-PC-PS2:SET:DMD:RAMPRATE:TPM', '2.0')
|
|
#sleep(15.0)
|
|
|
|
#TODO: Set the diplay names of positioners and detectors
|
|
scan = ManualScan(['index', 'Energy'], ['FieldRbk', 'TEY', 'I0', 'trans', 'polarization', 'polAngle', 'temperature', 'RingCurrent', 'fieldAnalogX', 'tey_norm', 'trans_norm'] , [0.0, 703.9], [80.0, 707.9], [80, 1])
|
|
scan.start()
|
|
|
|
#Stop condition
|
|
ramp_done = Channel('X07MA-PC-MAG:X:RAMP:DONE', type = 'i')
|
|
|
|
#Creating channels: dimension 1
|
|
#RegionPositioner field
|
|
#field = Channel('X07MA-PC:GO', type = 'd')
|
|
fieldReadback = Channel('X07MA-PC-PS2:STS:PMCURRENT', type = 'd')
|
|
#Creating channels: dimension 2
|
|
#ArrayPositioner Energy
|
|
Energy = sim_energy #Channel('X07MA-PHS-E:GO.A', type = 'd')
|
|
EnergyReadback = sim_energy_readback # Channel('X07MA-PGM:CERBK', type = 'd')
|
|
#ScalarDetector TEY
|
|
TEY = Channel('X07MA-ES1-AI:SIGNAL0', type = 'd')
|
|
#ScalarDetector I0
|
|
I0 = Channel('X07MA-ES1-AI:SIGNAL1', type = 'd')
|
|
#ScalarDetector trans
|
|
trans = Channel('X07MA-ES1-AI:SIGNAL2', 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 fieldAnalogX
|
|
fieldAnalogX = Channel('X07MA-ES1-AI:SIGNAL4', type = 'd')
|
|
|
|
#Dimension 1
|
|
#RegionPositioner field
|
|
#Region 1 pre-actions
|
|
print "Waiting for start field"
|
|
caput('X07MA-PC-PS2:M:GO.A', START_FIELD)
|
|
print "Set end field"
|
|
caputq('X07MA-PC-PS2:M:GO.A', END_FIELD)
|
|
|
|
|
|
|
|
index = 0
|
|
while(True):
|
|
#Dimension 2
|
|
#ArrayPositioner Energy
|
|
for setpoint2 in ENERGIES:
|
|
Energy.put(setpoint2, timeout=None) # TODO: Set appropriate timeout
|
|
readback2 = EnergyReadback.get()
|
|
if abs(readback2 - setpoint2) > 0.1 : # TODO: Check accuracy
|
|
raise Exception('Actor Energy could not be set to the value ' + str(setpoint2))
|
|
sleep( 0.5 ) # Settling time
|
|
|
|
#Detector field readback
|
|
field_readback = fieldReadback.get()
|
|
|
|
#Detector TEY
|
|
detector1 = TEY.get()
|
|
#Detector I0
|
|
detector2 = I0.get()
|
|
#Detector trans
|
|
detector3 = trans.get()
|
|
#Detector polarization
|
|
detector4 = sim_energy_readback.read() # polarization.get()
|
|
#Detector polAngle
|
|
detector5 = sim_energy_readback.read() #polAngle.get()
|
|
#Detector temperature
|
|
detector6 = temperature.get()
|
|
#Detector RingCurrent
|
|
detector7 = RingCurrent.get()
|
|
#Detector fieldAnalogX
|
|
detector8 = fieldAnalogX.get()
|
|
|
|
|
|
#Manipulation tey_norm
|
|
#Variable Mappings
|
|
|
|
#TODO: Move, if needed, this import to the file header: import math
|
|
tey_norm = detector1/detector2
|
|
|
|
#Manipulation trans_norm
|
|
#Variable Mappings
|
|
|
|
#TODO: Move, if needed, this import to the file header: import math
|
|
trans_norm = detector3/detector2
|
|
|
|
scan.append ([index, setpoint2], [index, readback2], [field_readback, detector1, detector2, detector3, detector4, detector5, detector6, detector7, detector8, tey_norm, trans_norm])
|
|
|
|
print "Field = " + fieldReadback.get()
|
|
if ramp_done.get() == 1: #If not ramping
|
|
print "Not ramping, breaking execution"
|
|
break
|
|
index = index+1
|
|
|
|
#Closing channels
|
|
Energy.close()
|
|
EnergyReadback.close()
|
|
TEY.close()
|
|
I0.close()
|
|
trans.close()
|
|
#polarization.close()
|
|
polAngle.close()
|
|
temperature.close()
|
|
RingCurrent.close()
|
|
fieldAnalogX.close()
|
|
field.close()
|
|
fieldReadback.close()
|
|
ramp_done.close()
|
|
|
|
scan.end()
|