Commit ec79f666 authored by Emmanuel Papillon's avatar Emmanuel Papillon
Browse files

added fastshutter

use it in tdxrd count preset
parent 03c0a559
from bliss.config.settings import HashObjSetting
#from bliss.common.shutter import BaseShutter, BaseShutterState
from bliss import current_session
class FastShutter:
def __init__(self, name, config):
self.__name = name
self.__config = config
self.__shutter_mux = config["shutter_mux"]
self.__session_mux = config["session_mux"]
self.__settings = HashObjSetting(f"fastshutter:{name}")
self.__time = None
def name(self):
return self.__name
def config(self):
return self.__config
def __info__(self):
info = f"FastShutter [{}]:\n"
info += f"Controlled by session = {self.session}\n"
info += f"Shutter polarity = {self.polarity}\n"
info += f"Shutter mode = {self.mode}\n"
info += f"Shutter time = {self.shutter_time:.3f} sec\n"
return info
def session(self):
return self.__session_mux.getOutputStat("SHUTTER_SESSION")
def session(self, value):
self.__session_mux.switch("SHUTTER_SESSION", value.upper())
def __check_session(self):
current =
if current != self.session:
print("!!! FastShutter WARNING !!!")
print(f"Session [{self.session}] is now controlling shutter")
print("Current session has NO control !!!\n")
def polarity(self):
return self.__shutter_mux.getOutputStat("SHUTTER_POLARITY")
def polarity(self, value):
self.__shutter_mux.switch("SHUTTER_POLARITY", value.upper())
def shutter_time(self):
if self.__time is None:
self.__time = self.__settings.get("time", 0.)
return self.__time
def shutter_time(self, value):
self.__settings["time"] = value
self.__time = None
def open(self, wait=False):
self.__shutter_mux.switch("SHUTTER", "OPEN")
if wait:
def close(self, wait=False):
self.__shutter_mux.switch("SHUTTER", "CLOSE")
if wait:
def state(self):
return self.__shutter_mux.getOutputStat("SHUTTER")
def mode(self):
return self.__shutter_mux.getOutputStat("SHUTTER")
def mode(self, value):
self.__shutter_mux.switch("SHUTTER", value.upper())
......@@ -17,22 +17,28 @@ def set_frelon_soft():
class CountMuxPreset(ChainPreset):
def __init__(self, opmux):
def __init__(self, opmux, fsh):
self.opmux = opmux
self.fsh = fsh
def prepare(self, chain):
devused = [ for node in chain.nodes_list ]
frelons = [ name for name in devused if name.startswith("frelon") ]
frelon2mux = {
# --- shutter
frelonnodes = [ node for node in chain.nodes_list if"frelon") ]
frelon2shutter = {
"frelon1": "CAM1",
"frelon2": "CAM2",
"frelon3": "CAM3",
shutter = "COUNTER"
if frelons:
shutter = frelon2mux.get(frelons[0], shutter)
shutter_mode = "COUNTER"
for node in frelonnodes:
dev = node.device
if in frelon2shutter:
shutter_mode = frelon2shutter[]
dev.shutter.close_time = self.fsh.shutter_time
self.fsh.mode = shutter_mode
self.opmux.switch("SHUTTER", shutter)
# --- triggers
self.opmux.switch("TRIGGER_MODE", "COUNTER_CARD")
self.opmux.switch("CAM1", "ON")
self.opmux.switch("CAM2", "ON")
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment