From 99cb0fdbdbed3ae4e0e8c77a2502f176e6de9bf5 Mon Sep 17 00:00:00 2001 From: x03daop Date: Wed, 23 Aug 2017 11:25:21 +0200 Subject: [PATCH] Closedown --- config/tasks.properties | 2 +- script/ExitSlitScan.py | 28 -------------- script/ExitSlitYScan.py | 28 -------------- script/FocusXRotScan.py | 45 --------------------- script/FocusYRotScan.py | 34 ---------------- script/FrontEndBladeScan.py | 63 ------------------------------ script/MonoThetaBetaScan.py | 33 ---------------- script/PhotonFluxSpectrum.py | 71 ---------------------------------- script/optics/ExitSlitYScan.py | 2 +- script/scan_guard.py | 34 ++++------------ 10 files changed, 10 insertions(+), 330 deletions(-) delete mode 100644 script/ExitSlitScan.py delete mode 100644 script/ExitSlitYScan.py delete mode 100644 script/FocusXRotScan.py delete mode 100644 script/FocusYRotScan.py delete mode 100644 script/FrontEndBladeScan.py delete mode 100644 script/MonoThetaBetaScan.py delete mode 100644 script/PhotonFluxSpectrum.py diff --git a/config/tasks.properties b/config/tasks.properties index ec79a3b8..22034336 100644 --- a/config/tasks.properties +++ b/config/tasks.properties @@ -1,3 +1,3 @@ reinit=60 -scan_guard=10 +#scan_guard=10 #monitoring=5 diff --git a/script/ExitSlitScan.py b/script/ExitSlitScan.py deleted file mode 100644 index 8b4bc87b..00000000 --- a/script/ExitSlitScan.py +++ /dev/null @@ -1,28 +0,0 @@ -""" -exit slit test scan -""" - -POSITIONERS = (ExitSlit) -SENSORS = (SampleCurrent, RefCurrent, AuxCurrent, MachineCurrent) -STARTPOS = (-10.0) -ENDPOS = (200.0) -STEPS = 10.0 -LATENCY = 0.1 -DWELL = 1.0 - -value = DWELL * 10.0 -SampleCurrentAveraging.write(value) -RefCurrentAveraging.write(value) -AuxCurrentAveraging.write(value) - -def trig(): - wait_beam() - caput("X03DA-OP-10ADC:TRG.PROC", 1) - -lscan(POSITIONERS, SENSORS, STARTPOS, ENDPOS, STEPS, LATENCY, before_read=trig, after_read=after_readout) - -STARTPOS = (200.0) -ENDPOS = (-10.0) -STEPS = -10.0 - -lscan(POSITIONERS, SENSORS, STARTPOS, ENDPOS, STEPS, LATENCY, before_read=trig, after_read=after_readout) diff --git a/script/ExitSlitYScan.py b/script/ExitSlitYScan.py deleted file mode 100644 index f9aac00a..00000000 --- a/script/ExitSlitYScan.py +++ /dev/null @@ -1,28 +0,0 @@ -""" -exit slit calibration scan - -manual settings: photon energy 800 eV (G1200), FE = 1 x 1 -""" - -POSITIONERS = (ExitSlitY) -SENSORS = (SampleCurrent, RefCurrent, AuxCurrent, MachineCurrent) -STARTPOS = (-0.5) -ENDPOS = (1.5) -STEPS = 0.01 -LATENCY = 0.1 -DWELL = 1.0 - -value = DWELL * 10.0 -SampleCurrentAveraging.write(value) -RefCurrentAveraging.write(value) -AuxCurrentAveraging.write(value) - -SampleCurrentGain.write("L, 10^7") -RefCurrentGain.write("L, 10^9") -AuxCurrentGain.write("L, 10^8") - -def trig(): - wait_beam() - caput("X03DA-OP-10ADC:TRG.PROC", 1) - -lscan(POSITIONERS, SENSORS, STARTPOS, ENDPOS, STEPS, LATENCY, before_read=trig, after_read=after_readout) diff --git a/script/FocusXRotScan.py b/script/FocusXRotScan.py deleted file mode 100644 index 4070b248..00000000 --- a/script/FocusXRotScan.py +++ /dev/null @@ -1,45 +0,0 @@ -""" -Focusing mirror Rx scan -to center the beam on the monochromator grating -Rx = -20...+20 -set the front end to 0.5 x 0.5, exit slit to 25, photon energy to 1500 -""" - -import math - -# adjust the following parameters -STARTPOS = (-5.0) -ENDPOS = (+5.0) -STEPS = 0.01 -LATENCY = 1.0 -DWELL = 1.0 -ENDSCAN = False - -MOTORS = [FocusXRot] -SENSORS = [SampleCurrent, RefCurrent, MachineCurrent, OpticsCameraCentroidX, OpticsCameraSigmaX] -RELATIVE = False - -value = DWELL * 10.0 -SampleCurrentAveraging.write(value) -RefCurrentAveraging.write(value) - -SampleCurrentGain.write("L, 10^9") -RefCurrentGain.write("L, 10^9") - -# front end size includes offset! -FrontendHSize.write(1.0) -FrontendVSize.write(0.9) -ExitSlit.write(25.0) - -adjust_sensors() -set_adc_averaging() - -def trig(): - wait_beam() - caput("X03DA-OP-10ADC:TRG.PROC", 1) - -try: - lscan(MOTORS, SENSORS, STARTPOS, ENDPOS, STEPS, LATENCY, RELATIVE, before_read=trig, after_read = after_readout) -finally: - if ENDSCAN: - after_scan() diff --git a/script/FocusYRotScan.py b/script/FocusYRotScan.py deleted file mode 100644 index 6ca07479..00000000 --- a/script/FocusYRotScan.py +++ /dev/null @@ -1,34 +0,0 @@ -""" -Focusing mirror Ry scan - -set scan parameters below, move the mirror to the center position. -set analyser parameters separately! -""" - -import math - -# adjust the following parameters -DISTANCE = 0.08 -STEPS = 40 -LATENCY = 0.5 -ENDSCAN = False - -MOTORS = [FocusYRot] -SENSORS = [Counts, SampleCurrent, RefCurrent, MachineCurrent, OpticsCameraCentroidX, OpticsCameraSigmaX] -STARTPOS = (-DISTANCE / 2.0) -ENDPOS = (DISTANCE / 2.0) -RELATIVE = True - -adjust_sensors() -set_adc_averaging() - -def trig_sensors(): - wait_beam() - #trig_scienta() - caput("X03DA-OP-10ADC:TRG.PROC", 1) - -try: - lscan(MOTORS, SENSORS, STARTPOS, ENDPOS, STEPS, LATENCY, RELATIVE, before_read=trig_sensors, after_read = after_readout) -finally: - if ENDSCAN: - after_scan() diff --git a/script/FrontEndBladeScan.py b/script/FrontEndBladeScan.py deleted file mode 100644 index 097c2e31..00000000 --- a/script/FrontEndBladeScan.py +++ /dev/null @@ -1,63 +0,0 @@ -""" -front end calibration scans - -RefCurrent: RMU -AuxCurrent: not connected -""" - -import time - -SENSORS = (RefCurrent, AuxCurrent, MachineCurrent) -STARTPOS = (-1.5) -ENDPOS = (+1.5) -STEPS = 0.01 -LATENCY = 1.0 -DWELL = 1.0 - -def trig(): - wait_beam() - caput("X03DA-OP-10ADC:TRG.PROC", 1) - -value = DWELL * 10.0 -SampleCurrentAveraging.write(value) -RefCurrentAveraging.write(value) -AuxCurrentAveraging.write(value) - -RefCurrentGain.write("L, 10^7") -AuxCurrentGain.write("L, 10^7") - -FrontendHSize.write(2.0) -FrontendVSize.write(2.0) -ExitSlit.write(25.0) -caput("X03DA-PGM:ronbeta.A", -87.0) -caput("X03DA-PGM:rontheta.A", +87.0) - -#MonoBeta.waitValueInRange(-87.01, -86.99, 100000) -#MonoTheta.waitValueInRange(+86.99, +87.01, 100000) - -POSITIONERS = (FrontendBladeUp) -FrontendBladeDown.write(-2.0) -lscan(POSITIONERS, SENSORS, STARTPOS, ENDPOS, STEPS, LATENCY, before_read=trig, after_read=after_readout) - -POSITIONERS = (FrontendBladeDown) -FrontendBladeUp.write(+2.0) -lscan(POSITIONERS, SENSORS, STARTPOS, ENDPOS, STEPS, LATENCY, before_read=trig, after_read=after_readout) - -FrontendHSize.write(2.0) -FrontendVSize.write(2.0) -time.sleep(10.0) - -STARTPOS = (-4.0) -ENDPOS = (+4.0) -STEPS = 0.1 - -POSITIONERS = (FrontendBladeRing) -FrontendBladeWall.write(-4.0) -lscan(POSITIONERS, SENSORS, STARTPOS, ENDPOS, STEPS, LATENCY, before_read=trig, after_read=after_readout) - -POSITIONERS = (FrontendBladeWall) -FrontendBladeRing.write(+4.0) -lscan(POSITIONERS, SENSORS, STARTPOS, ENDPOS, STEPS, LATENCY, before_read=trig, after_read=after_readout) - -FrontendHSize.write(0.0) -FrontendVSize.write(0.0) diff --git a/script/MonoThetaBetaScan.py b/script/MonoThetaBetaScan.py deleted file mode 100644 index 74164ed9..00000000 --- a/script/MonoThetaBetaScan.py +++ /dev/null @@ -1,33 +0,0 @@ -""" -TEST: OTF scan for mono calibration - -under development - does not run yet - -tasks: -- find out positioner of beta angle and set up device (must be of motor class). -- load table of scan positions. -- add outer theta loop. -""" - -MOTORS = (MonoBeta) -SENSORS = (SampleCurrent, RefCurrent, MachineCurrent) -STARTPOS = (beta1) -ENDPOS = (beta2) -TIME = 120.0 # seconds -STEPS = 1000 -RELATIVE = False -ENDSCAN = False - -adjust_sensors() -set_adc_averaging() - -def trig_sensors(): - caput("X03DA-OP-10ADC:TRG.PROC", 1) - -try: - wait_beam() - cscan(MOTORS, SENSORS, STARTPOS, ENDPOS, STEPS, time = TIME, relative = RELATIVE, before_read = trig_sensors) -finally: - if ENDSCAN: - after_scan() - diff --git a/script/PhotonFluxSpectrum.py b/script/PhotonFluxSpectrum.py deleted file mode 100644 index ae133c28..00000000 --- a/script/PhotonFluxSpectrum.py +++ /dev/null @@ -1,71 +0,0 @@ -""" -photon flux spectrum - -SampleCurrent: diode -RefCurrent: RMU -AuxCurrent: not connected -""" - -import time - -# G600 full spectrum -#STARTPOS = (50.0) -#ENDPOS = (1100.0) -#STEPS = 10.0 -#LATENCY = 5.0 -#DWELL = 1.0 - -# G1200 full spectrum -#STARTPOS = (100.0) -#ENDPOS = (2000.0) -#STEPS = 25.0 -#LATENCY = 5.0 -#DWELL = 1.0 - -# carbon edge -STARTPOS = (270.0) -ENDPOS = (310.0) -STEPS = 0.5 -LATENCY = 1.0 -DWELL = 1.0 - -# G600 1x1 reference sscan_2268 (elog:119) -#SampleCurrentGain.write("L, 10^7") -#RefCurrentGain.write("L, 10^9") -#FrontendHSize.write(1.5) -#FrontendVSize.write(1.4) -#ExitSlit.write(100.0) - -# G600 1x1 reference sscan_2268 (elog:119) -SampleCurrentGain.write("L, 10^5") -RefCurrentGain.write("L, 10^7") -FrontendHSize.write(6.5) -FrontendVSize.write(10.4) -ExitSlit.write(100.0) - -# G1200 1x1 reference sscan_2264 (elog:114) -#SampleCurrentGain.write("L, 10^8") -#RefCurrentGain.write("L, 10^9") -#FrontendHSize.write(1.5) -#FrontendVSize.write(1.4) -#ExitSlit.write(100.0) - -# G1200 6x10 reference sscan_2266 (elog:116) -#SampleCurrentGain.write("L, 10^6") -#RefCurrentGain.write("L, 10^8") -#FrontendHSize.write(6.5) -#FrontendVSize.write(10.4) -#ExitSlit.write(100.0) - -def trig(): - wait_beam() - caput("X03DA-OP-10ADC:TRG.PROC", 1) - -value = DWELL * 10.0 -SampleCurrentAveraging.write(value) -RefCurrentAveraging.write(value) - -POSITIONERS = (Eph) -SENSORS = (SampleCurrent, RefCurrent, MachineCurrent) - -lscan(POSITIONERS, SENSORS, STARTPOS, ENDPOS, STEPS, LATENCY, before_read=trig, after_read=after_readout) diff --git a/script/optics/ExitSlitYScan.py b/script/optics/ExitSlitYScan.py index f9aac00a..976d3874 100644 --- a/script/optics/ExitSlitYScan.py +++ b/script/optics/ExitSlitYScan.py @@ -7,7 +7,7 @@ manual settings: photon energy 800 eV (G1200), FE = 1 x 1 POSITIONERS = (ExitSlitY) SENSORS = (SampleCurrent, RefCurrent, AuxCurrent, MachineCurrent) STARTPOS = (-0.5) -ENDPOS = (1.5) +ENDPOS = (1.0) STEPS = 0.01 LATENCY = 0.1 DWELL = 1.0 diff --git a/script/scan_guard.py b/script/scan_guard.py index 3302df80..eaf57f21 100644 --- a/script/scan_guard.py +++ b/script/scan_guard.py @@ -13,13 +13,9 @@ IMPLEMENTED: * Beam loss: Repeat the last Scienta measurement when the beam is restored. * Beam loss: Close/open the station shutter. * Beam loss: Independent low and high trip levels. -* Beam loss: Beam loss actions are done only if beamline operation is set to "unattended" +* Beam loss: Beam can be okay only if beamline is "attended" or "unattended" * Beam loss: Closed absorber or front end shutter will also trigger a beam loss -PLANNED: - -* Update the data folder and file names according to the current date. -* Serve operation parameters as EPICS channels TODO: @@ -31,9 +27,8 @@ Created: Copyright: (c) 2013 Paul Scherrer Institut - -$Id: scan_guard.py 43 2015-10-07 16:38:05Z muntwiler_m $ """ + import time import logging import epicsPV @@ -803,17 +798,6 @@ class ScanGuard(object): def ringcurrent_dead_band(self, value): self._ringcurrent.dead_band = value - @property - def unattended_only(self): - """ - Scan guard is active during unattended operation only - """ - return self._beamline_mode.device_active - - @unattended_only.setter - def unattended_only(self, value): - self._beamline_mode.device_active = value - def connect(self): for monitor in self.monitors: monitor.connect() @@ -845,10 +829,6 @@ class ScanGuard(object): self.test_start_seconds = time.time() self.running = True - if self.unattended_only: - logging.info("guard active in unattended operation mode only") - else: - logging.info("guard active regardless of beamline operation mode") if self.test: logging.info("test mode. simulated beam loss in %g seconds.", self.test_time_seconds) @@ -907,14 +887,12 @@ def main(): nll = logging.INFO logging.basicConfig(format="%(asctime)s %(levelname)s: %(message)s", level=nll) logging.info("PEARL Scan Guard") - logging.info("version 1.1.2") + logging.info("version 1.1.3") guard = ScanGuard() guard.ringcurrent_trip_lo = 390.0 guard.ringcurrent_trip_hi = 410.0 guard.ringcurrent_dead_band = 1.0 - # True = offline mode is interpreted as beam down - guard.unattended_only = True # True = block acquisition while beam is down, False = do not block (e.g. for He lamp measurements) guard.controls_active = True # True = simulate beam down after a few seconds, False = normal operation @@ -928,7 +906,11 @@ def main(): logging.info("scan guard aborted by user") except: print sys.exc_info()[1] - + + print "guard shutting down - measurements enabled" + global beam_ok + beam_ok = True + #This is to dispose created channels - otherwise, if channel is off, old channels remain and CPU consumption goes 100%. import _ca _ca.initialize()