Closedown
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user