Closedown

This commit is contained in:
x03daop
2016-04-05 15:52:08 +02:00
parent 11daf206aa
commit b293cc8ff4
2 changed files with 38 additions and 0 deletions

View File

@@ -3,6 +3,9 @@ import ch.psi.pshell.device.Readable.ReadableArray as ReadableArray
import ch.psi.pshell.device.Readable.ReadableCalibratedArray as ReadableCalibratedArray
import ch.psi.pshell.device.ArrayCalibration as ArrayCalibration
import ch.psi.utils.Str
beam_ok = True
class SimulatedOutput(Writable):
def write(self, value):
@@ -208,7 +211,19 @@ def append_diag_datasets(parent = None):
append_dataset(group+get_diag_name(f), x)
def before_readout():
if not beam_ok:
print "Waiting for beam..."
while not beam_ok:
time.sleep(0.1)
print "Beam ok"
trig_scienta()
def after_readout(rec):
if not beam_ok:
rec.invalidate()
return
if get_context().persist:
if rec.index == 0:
create_diag_datasets()

View File

@@ -678,6 +678,28 @@ class StationShutter(ControlledDevice):
logging.error("failed to set station shutter (requested %g, actual %g)", newpos, curpos)
return result
###Global flag
class GlobalFlag(ControlledDevice):
def __init__(self, name):
pass
def pause(self):
"""
"""
global beam_ok
beam_ok = False
def resume(self):
"""
Opens the shutter if it was open before the pause.
"""
global beam_ok
beam_ok = True
##### ScanGuard class #####
@@ -743,6 +765,7 @@ class ScanGuard(object):
self.devices.append(AreaDetector('X03DA-SCIENTA'))
self.devices.append(AnalogChannels('X03DA-OP-10ADC'))
self.devices.append(StationShutter('X03DA-OP-ST1'))
self.devices.append(GlobalFlag())
@property
def ringcurrent_trip_lo(self):