Commit 1a80708a authored by Emmanuel Papillon's avatar Emmanuel Papillon
Browse files

put in place config for shutter calibration

3dxrd -> tdxrd migration changes
parent 95a9bb1b
from bliss.config.settings import HashObjSetting from bliss.config.settings import HashObjSetting
from bliss.controllers.ct2.client import CT2CounterTimer
# from bliss.common.shutter import BaseShutter, BaseShutterState
from bliss import current_session from bliss import current_session
...@@ -14,6 +14,11 @@ class FastShutter: ...@@ -14,6 +14,11 @@ class FastShutter:
self.__settings = HashObjSetting(f"fastshutter:{name}") self.__settings = HashObjSetting(f"fastshutter:{name}")
self.__time = None self.__time = None
self.__calib = None
calib_config = config.get("calibration", None)
if calib_config is not None:
self.__calib = FastShutterCalibration(self, calib_config)
@property @property
def name(self): def name(self):
return self.__name return self.__name
...@@ -92,3 +97,38 @@ class FastShutter: ...@@ -92,3 +97,38 @@ class FastShutter:
def mode(self, value): def mode(self, value):
self.__check_session() self.__check_session()
self.__shutter_mux.switch("SHUTTER", value.upper()) self.__shutter_mux.switch("SHUTTER", value.upper())
@property
def calibration(self):
if self.__calib is None:
raise RuntimeError("No shutter calibration available !!")
return self.__calib
def measure(self):
self.calibration.measure()
class FastShutterCalibration(object):
def __init__(self, shutter, config):
self.shutter = shutter
self.__musst = config["musst"]
self.__p201 = config["p201_card"]
self.__diode_name = config["p201_diode_name"]
def __check_counters(self):
self.__diode = None
self.__timer = None
for counter in self.__p201.counters:
if counter.name == self.__diode_name:
self.__diode = counter
elif isinstance(counter, CT2CounterTimer):
self.__timer = counter
if self.__diode is None:
raise RuntimeError(f"Could find {self.__diode_name} counter on {self.__p201.name}")
if self.__timer is None:
raise RuntimeError(f"Could not find timer on {self.__p201.name}")
def measure(self):
self.__check_counters()
...@@ -71,6 +71,7 @@ def mot_findref(axis): ...@@ -71,6 +71,7 @@ def mot_findref(axis):
ref_pos = axis.home_found_dial() ref_pos = axis.home_found_dial()
elif refcfg["search"] == "HOME": elif refcfg["search"] == "HOME":
dial_pos = axis.dial dial_pos = axis.dial
# s6d vs s6u in iceid116... still only if above switch??
if (dial_pos - refcfg["dial"])> 0 and (axis.steps_per_unit > 0): if (dial_pos - refcfg["dial"])> 0 and (axis.steps_per_unit > 0):
home_dir = -1 home_dir = -1
else: else:
......
...@@ -5,13 +5,13 @@ from bliss.scanning.chain import ChainPreset ...@@ -5,13 +5,13 @@ from bliss.scanning.chain import ChainPreset
def set_frelon_trigger(): def set_frelon_trigger():
config = get_config() config = get_config()
chaincfg = config.get("chain_3dxrd_trig") chaincfg = config.get("chain_tdxrd_trig")
DEFAULT_CHAIN.set_settings(chaincfg["chain_config"]) DEFAULT_CHAIN.set_settings(chaincfg["chain_config"])
def set_frelon_gate(): def set_frelon_gate():
config = get_config() config = get_config()
chaincfg = config.get("chain_3dxrd_gate") chaincfg = config.get("chain_tdxrd_gate")
DEFAULT_CHAIN.set_settings(chaincfg["chain_config"]) DEFAULT_CHAIN.set_settings(chaincfg["chain_config"])
......
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