Commit 23deb9dc authored by Emmanuel Papillon's avatar Emmanuel Papillon
Browse files

add nscope scans presets

parent 96fb962b
from bliss.config.static import get_config
from bliss.common.scans import DEFAULT_CHAIN
from bliss.scanning.chain import ChainPreset
from bliss.scanning.scan import ScanPreset
class CountMuxPreset(ChainPreset):
def __init__(self, opmux, fsh):
self.opmux = opmux
self.fsh = fsh
def prepare(self, chain):
self.soft_fsh = True
# --- shutter
frelonnodes = [
node for node in chain.nodes_list if node.name.startswith("frelon")
]
frelon2shutter = {"frelon4": "CAM1", }
for node in frelonnodes:
dev = node.device
if dev.name in frelon2shutter:
if dev.camera.image_mode == "FULL FRAME":
shutter_mode = frelon2shutter[dev.name]
dev.shutter.mode = "AUTO_FRAME"
dev.shutter.close_time = self.fsh.shutter_time
if self.fsh.is_enabled():
self.fsh.mode = shutter_mode
self.soft_fsh = False
else:
print("!!! WARNING !!!")
print(f"Your are using frelon {dev.name} in FULL FRAME mode")
print("but the fastshutter is DISABLED !!!\n")
break
if not self.fsh.is_enabled():
self.soft_fsh = False
# --- triggers
self.opmux.switch("TRIGGER_MODE", "COUNTER_CARD")
self.opmux.switch("CAM1", "ON")
self.opmux.switch("MCA1", "ON")
def start(self, chain):
if self.soft_fsh:
self.fsh.open(wait=True)
def stop(self, chain):
if self.soft_fsh:
self.fsh.close()
CAM2MUX = {
"frelon4": "CAM1",
}
class FScanMuxPreset(ScanPreset):
def __init__(self, opmux, fsh):
self.opmux = opmux
self.fsh = fsh
def set_fscan_master(self, master):
self.limadevs = master.lima_used
def prepare(self, scan):
self.soft_fsh = True
self.opmux.switch("TRIGGER_MODE", "MUSST")
self.opmux.switch("MUSST", "BTRIG")
self.opmux.switch("MCA1", "ON")
for dev in self.limadevs:
cam_mux = CAM2MUX[dev.name]
self.opmux.switch(cam_mux, "ON")
if dev.name.startswith("frelon") and self.soft_fsh is True:
if dev.camera.image_mode == "FULL FRAME":
dev.shutter.mode = "AUTO_FRAME"
dev.shutter.close_time = self.fsh.shutter_time
if self.fsh.is_enabled():
self.fsh.mode = cam_mux
self.soft_fsh = False
else:
print("!!! WARNING !!!")
print(f"Your are using frelon {dev.name} in FULL FRAME mode")
print("but the fastshutter is DISABLED !!!\n")
if not self.fsh.is_enabled():
self.soft_fsh = False
def start(self, scan):
if self.soft_fsh:
self.fsh.open(wait=True)
def stop(self, scan):
if self.soft_fsh:
self.fsh.close()
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