diff --git a/script/Dy_hyst_plus.py b/script/Dy_hyst_plus.py new file mode 100644 index 0000000..498503b --- /dev/null +++ b/script/Dy_hyst_plus.py @@ -0,0 +1,106 @@ +#Script imported from: Dy_hyst_plus.xml + +#Pre-actions +cawait('ACOAU-ACCU:OP-MODE', 'Light Available', type = 's') +caput('X07MA-ID:MODE', 'CIRC +') +time.sleep(1.0) +cawait('X07MA-ID:DONE', 'DONE', type = 's') +caput('X07MA-ID:ENERGY-OFFS', '-8.75') +cawait('X07MA-ID:DONE', 'DONE', type = 's') +caputq('X07MA-PC:CSCALER.INPB', '1') +caputq('X07MA-PC-PS2:SET:DMD:RAMPRATE:TPM', '2.0') +time.sleep(15.0) +caput('X07MA-OP-VG13:WT_SET', 'Try open') +time.sleep(5.0) + +#TODO: Set the diplay names of positioners and detectors +scan = ManualScan(['field', 'Energy'], ['TEY', 'I0', 'trans', 'polarization', 'polAngle', 'temperature', 'RingCurrent', 'fieldAnalogX', 'tey_norm', 'trans_norm'] , [0.0, 1283.8], [55.0, 1291.8], [55, 1]) +scan.start() + +#Dimension 1 + +#RegionPositioner field +field = Channel('X07MA-PC:GO', type = 'd') +fieldReadback = Channel('X07MA-PC-PS2:STS:PMCURRENT', type = 'd') +for setpoint1 in frange(0.0, 55.0, 1.0, True): + #Region 1 pre-actions + if setpoint1 == 0.0: + caputq('X07MA-PC-PS2:M:GO.A', '-3') + field.put(setpoint1) # TODO: Add appropriate timeout + readback1 = fieldReadback.get() + if abs(readback1 - setpoint1) > 0.5 : # TODO: Check accuracy + raise Exception('Actor field could not be set to the value ' + str(setpoint1)) + #Dimension 2 + + #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') + #ArrayPositioner Energy + Energy = Channel('X07MA-PHS-E:GO.A', type = 'd') + EnergyReadback = Channel('X07MA-PGM:CERBK', type = 'd') + for setpoint2 in (1291.8, 1283.8): + Energy.put(setpoint2) # TODO: Add 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)) + time.sleep( 0.5 ) # Settling time + #Detector TEY + detector1 = TEY.get() + #Detector I0 + detector2 = I0.get() + #Detector trans + detector3 = trans.get() + #Detector polarization + detector4 = polarization.get() + #Detector polAngle + detector5 = polAngle.get() + #Detector temperature + detector6 = temperature.get() + #Detector RingCurrent + detector7 = RingCurrent.get() + #Detector fieldAnalogX + detector8 = fieldAnalogX.get() + #Manipulation tey_norm + #Variable Mappings + c = detector1 + d = detector2 + + import math + tey_norm = c/d + + #Manipulation trans_norm + #Variable Mappings + c = detector3 + d = detector2 + + import math + trans_norm = c/d + + scan.append ([setpoint1, setpoint2], [readback1, readback2], [detector1, detector2, detector3, detector4, detector5, detector6, detector7, detector8, tey_norm, trans_norm]) + Energy.close() + EnergyReadback.close() + TEY.close() + I0.close() + trans.close() + polarization.close() + polAngle.close() + temperature.close() + RingCurrent.close() + fieldAnalogX.close() +field.close() +fieldReadback.close() + +scan.end()