From ebd0d94856a6170c31d6c94fc5ed86673263bfb4 Mon Sep 17 00:00:00 2001 From: x07maop Date: Sun, 3 Apr 2016 17:57:35 +0200 Subject: [PATCH] Startup --- script/Ni_energy.py | 18 +++++++++ script/scan_vertical.py | 85 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 103 insertions(+) create mode 100644 script/Ni_energy.py create mode 100644 script/scan_vertical.py diff --git a/script/Ni_energy.py b/script/Ni_energy.py new file mode 100644 index 0000000..ad78335 --- /dev/null +++ b/script/Ni_energy.py @@ -0,0 +1,18 @@ +#set pol c+ +#otf 840 890 1 delay 5 +#file Ni_plus +#start +set_pol_cplus(offset = None) +wait_beam() +set_file('Ni_plus') +otf(start=840, end=890, time=1, delay=5) + +#set pol c- +#otf 840 890 1 delay 5 +#file Ni_minus +#start +set_pol_cminus(offset = None) +wait_beam() +set_file('Ni_minus') +otf(start=840, end=890, time=1, delay=5) + diff --git a/script/scan_vertical.py b/script/scan_vertical.py new file mode 100644 index 0000000..01af47e --- /dev/null +++ b/script/scan_vertical.py @@ -0,0 +1,85 @@ +#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()