diff --git a/Readme.md b/Readme.md index f281c61..2b48e36 100755 --- a/Readme.md +++ b/Readme.md @@ -62,7 +62,7 @@ class Myobject(Assembly): The `Assembly` object has different methods that help to assemble different other eco objects together. ```python # in -self._append(MySubObject,*args, **kwargs, name='mysubobjname', is_setting=True, is_status=True) +self._append(MySubObject,*args, **kwargs, name='mysubobjname', is_setting=True, is_display=True) ``` The `is_setting` flag requires that the appended object is an adjustable (can be set afterwards) or has adjustable settings in case it is itself an assembly. -The `is_status` flag independently determines if the subobject should be used to describe the status of the new assembly, e.g. show up in its representation. In case the subobject is no adjustable itself but has adjustable settings that should be shown in the object status, please use `is_status='recursive'`. +The `is_status` flag independently determines if the subobject should be used to describe the status of the new assembly, e.g. show up in its representation. In case the subobject is no adjustable itself but has adjustable settings that should be shown in the object status, please use `is_display='recursive'`. diff --git a/eco/bernina/bernina.py b/eco/bernina/bernina.py index 3fe97e7..98ae666 100644 --- a/eco/bernina/bernina.py +++ b/eco/bernina/bernina.py @@ -966,14 +966,14 @@ class JohannAnalyzer(Assembly): "SARES20-MF1:MOT_3", name="pitch", is_setting=True, - is_status=True, + is_display=True, ) self._append( MotorRecord, "SARES20-MF1:MOT_4", name="roll", is_setting=True, - is_status=True, + is_display=True, ) @@ -995,7 +995,7 @@ namespace.append_obj(JohannAnalyzer, name="analyzer") # self.pump_exp_delaystage, # name="pump_delay_exp", # is_setting=False, -# is_status=True, +# is_display=True, # reset_current_value_to=False, # ) # self._append(SmaractStreamdevice, "SARES23-ESB5", name="wp", is_setting=True) @@ -1010,7 +1010,7 @@ namespace.append_obj(JohannAnalyzer, name="analyzer") # self.pump_2_delaystage, # name="pump_2_delay", # is_setting=False, -# is_status=True, +# is_display=True, # reset_current_value_to=False, # ) # self._append(SmaractStreamdevice, "SARES23-ESB6", name="ratio", is_setting=True) @@ -1065,7 +1065,7 @@ namespace.append_obj(JohannAnalyzer, name="analyzer") # self.delaystage, # name="delay", # is_setting=True, -# is_status=True, +# is_display=True, # ) # self._append( # SmaractStreamdevice, @@ -1083,7 +1083,7 @@ namespace.append_obj(JohannAnalyzer, name="analyzer") # camserver_alias="tt_spatial", # pvname_zoom="SARES20-MF1:MOT_15", # is_setting=True, -# is_status="recursive", +# is_display="recursive", # name="microscope", # ) # diff --git a/eco/bs/detector.py b/eco/bs/detector.py index 4ce5d83..4ba0a2c 100644 --- a/eco/bs/detector.py +++ b/eco/bs/detector.py @@ -15,7 +15,7 @@ from eco.epics import get_from_archive class DetectorBsData(Assembly): def __init__(self, bschannel, name=None): super().__init__(name=name) - self.status_indicators_collection.append(self) + self.status_collection.append(self) self.bschannel = bschannel if epics_pv_available & epics_pv_availabe == "same": self._pv = PV(pvname) diff --git a/eco/detector/jungfrau.py b/eco/detector/jungfrau.py index 995c8e9..9d80dd3 100644 --- a/eco/detector/jungfrau.py +++ b/eco/detector/jungfrau.py @@ -24,7 +24,7 @@ class Jungfrau(Assembly): self._append( AdjustablePv, pv_trigger, - is_status=True, + is_display=True, is_setting=False, name="trigger", ) @@ -46,7 +46,7 @@ class Jungfrau(Assembly): "Can not set the pedestal file manually yet." ), name="pedestal_file", - is_status=True, + is_display=True, ) self._append( AdjustableGetSet, @@ -55,7 +55,7 @@ class Jungfrau(Assembly): "Can not set the pedestal file manually yet." ), name="gain_file", - is_status=True, + is_display=True, ) def _set_trigger_enable(self, value): diff --git a/eco/devices_general/cameras_swissfel.py b/eco/devices_general/cameras_swissfel.py index 199ec87..28c5f54 100644 --- a/eco/devices_general/cameras_swissfel.py +++ b/eco/devices_general/cameras_swissfel.py @@ -127,7 +127,11 @@ class CamserverConfig(Assembly): conditions is a dictionary holding the conditions to select a subset of cameras, e.g. {"group": Bernina} fields is a dictionary containing the keys and values that should be updated, e.g. fields={'alias': ['huhu', 'duda']} """ - cams = {cam: self.cc.get_camera_config(cam) for cam in self.cc.get_cameras()} + cams = { + cam: self.cc.get_camera_config(cam) + for cam in self.cc.get_cameras() + if not "jungfrau" in cam + } cams_selected = {} for cam, cfg in cams.items(): try: @@ -166,7 +170,7 @@ class CameraBasler(Assembly): camserver_alias=camserver_alias, camserver_group=camserver_group, name="config_cs", - is_status=False, + is_display=False, ) self.config_cs.set_alias() if camserver_group is not None: @@ -176,126 +180,126 @@ class CameraBasler(Assembly): self.pvname + ":INIT", name="initialize", is_setting=True, - is_status=False, + is_display=False, ) self._append( AdjustablePvEnum, self.pvname + ":CAMERASTATUS", name="running", is_setting=True, - is_status=False, + is_display=False, ) self._append( AdjustablePv, self.pvname + ":BOARD", name="board_no", is_setting=True, - is_status=False, + is_display=False, ) self._append( AdjustablePv, self.pvname + ":SERIALNR", name="serial_no", is_setting=True, - is_status=False, + is_display=False, ) self._append( AdjustablePv, self.pvname + ":EXPOSURE", name="_exposure_time", is_setting=True, - is_status=False, + is_display=False, ) self._append( AdjustablePvEnum, self.pvname + ":ACQMODE", name="_acq_mode", is_setting=True, - is_status=False, + is_display=False, ) self._append( AdjustablePvEnum, self.pvname + ":RECMODE", name="_req_mode", is_setting=True, - is_status=False, + is_display=False, ) self._append( AdjustablePvEnum, self.pvname + ":STOREMODE", name="_store_mode", is_setting=True, - is_status=False, + is_display=False, ) self._append( AdjustablePv, self.pvname + ":BINY", name="_binx", is_setting=True, - is_status=False, + is_display=False, ) self._append( AdjustablePv, self.pvname + ":BINY", name="_biny", is_setting=True, - is_status=False, + is_display=False, ) self._append( AdjustablePv, self.pvname + ":REGIONX_START", name="_roixmin", is_setting=True, - is_status=False, + is_display=False, ) self._append( AdjustablePv, self.pvname + ":REGIONX_END", name="_roixmax", is_setting=True, - is_status=False, + is_display=False, ) self._append( AdjustablePv, self.pvname + ":REGIONY_START", name="_roiymin", is_setting=True, - is_status=False, + is_display=False, ) self._append( AdjustablePv, self.pvname + ":REGIONY_END", name="_roiymax", is_setting=True, - is_status=False, + is_display=False, ) self._append( AdjustablePvEnum, self.pvname + ":SET_PARAM", name="_set_parameters", is_setting=True, - is_status=False, + is_display=False, ) self._append( AdjustablePvEnum, self.pvname + ":TRIGGER", name="trigger_on", is_setting=True, - is_status=True, + is_display=True, ) self._append( AdjustablePv, self.pvname + ":AMPGAIN", name="_gain", is_setting=True, - is_status=False, + is_display=False, ) self._append( AdjustablePvEnum, self.pvname + ":TRIGGERSOURCE", name="trigger_source", is_setting=True, - is_status=False, + is_display=False, ) # append_object_to_object(self,PvEnum,self.pvname+':TRIGGEREDGE',name='trigger_edge') self._append( @@ -304,7 +308,7 @@ class CameraBasler(Assembly): lambda value: self._set_params((self._exposure_time, value)), name="exposure_time", is_setting=True, - is_status=True, + is_display=True, ) self._append( AdjustableGetSet, @@ -312,7 +316,7 @@ class CameraBasler(Assembly): lambda value: self._set_params((self._gain, value)), name="gain", is_setting=True, - is_status=True, + is_display=True, ) def set_roi(roi): @@ -373,7 +377,7 @@ class CameraPCO(Assembly): AdjustablePvEnum, self.pvname + ":CAMERASTATUS", name="camera_status", - is_status=True, + is_display=True, ) self._append(AdjustablePv, self.pvname + ":BOARD", name="board_no") self._append(AdjustablePv, self.pvname + ":SERIALNR", name="serial_no") diff --git a/eco/devices_general/motors.py b/eco/devices_general/motors.py index cbac07d..64940e7 100755 --- a/eco/devices_general/motors.py +++ b/eco/devices_general/motors.py @@ -202,7 +202,7 @@ class SmaractStreamdevice(Assembly): name="offset", default_value=0, is_setting=True, - is_status=False, + is_display=False, ) else: self._append( @@ -210,7 +210,7 @@ class SmaractStreamdevice(Assembly): value=0, name="offset", is_setting=True, - is_status=False, + is_display=False, ) self._append(DetectorGet, self.get_current_value, name="readback") @@ -448,7 +448,7 @@ class MotorRecord(Assembly): self.pvname + ".STAT", name="status_flag", is_setting=False, - is_status=True, + is_display=True, ) self._append( AdjustablePvEnum, self.pvname + ".DIR", name="direction", is_setting=True @@ -459,7 +459,7 @@ class MotorRecord(Assembly): self.pvname + ".RBV", name="readback", is_setting=False, - is_status=True, + is_display=True, ) self._append( AdjustablePv, self.pvname + ".VELO", name="speed", is_setting=False @@ -469,10 +469,13 @@ class MotorRecord(Assembly): self.pvname + ".ACCL", name="acceleration_time", is_setting=False, - is_status=True, + is_display=True, ) self._append( - AdjustablePv, self.pvname + ".LLM", name="limit_low", is_setting=True, + AdjustablePv, + self.pvname + ".LLM", + name="limit_low", + is_setting=True, ) self._append( AdjustablePv, self.pvname + ".HLM", name="limit_high", is_setting=True @@ -483,7 +486,9 @@ class MotorRecord(Assembly): self._append( DetectorPvData, self.pvname + ".MSTA", name="_flags", is_setting=False ) - self._append(MotorRecordFlags, self._flags, name="flags", is_status="recursive") + self._append( + MotorRecordFlags, self._flags, name="flags", is_display="recursive" + ) self._append( AdjustablePvEnum, self.pvname + ".SPMG", @@ -535,7 +540,7 @@ class MotorRecord(Assembly): port, name="controller_settings", is_setting=True, - is_status=False, + is_display=False, ) def check_bad_limits(self, abs_set_value=2**53): @@ -767,7 +772,7 @@ class MotorRecordFlags(Assembly): [self._flags], partial(self._get_flag_name_value, flag_name=flag_name), name=flag_name, - is_status=True, + is_display=True, ) def _get_flag_name_value(self, value, flag_name=None): @@ -793,28 +798,28 @@ class MForceSettings(Assembly): self.pv_motor + ".MRES", name="motor_resolution", is_setting=True, - is_status=False, + is_display=False, ) self._append( AdjustablePv, self.pv_motor + ".ERES", name="encoder_resolution", is_setting=True, - is_status=False, + is_display=False, ) self._append( AdjustablePv, self.pv_channel + "_set", name="set_controller_command", is_setting=False, - is_status=False, + is_display=False, ) self._append( AdjustablePv, self.pv_channel + "_get", name="get_controller_command", is_setting=False, - is_status=False, + is_display=False, ) self._append( AdjustablePv, self.pv_channel + "_RC", name="run_current", is_setting=True @@ -866,7 +871,7 @@ class SmaractRecord(Assembly): self.pvname + ".STAT", name="status_flag", is_setting=False, - is_status=True, + is_display=True, ) self._append( AdjustablePvEnum, self.pvname + ".DIR", name="direction", is_setting=True @@ -888,13 +893,12 @@ class SmaractRecord(Assembly): AdjustablePv, self.pvname + ".HOMR", name="home_reverse", is_setting=True ) - self._append( DetectorPvData, self.pvname + ".RBV", name="readback", is_setting=False, - is_status=True, + is_display=True, ) self._append( AdjustablePv, self.pvname + ".VELO", name="speed", is_setting=False @@ -922,7 +926,7 @@ class SmaractRecord(Assembly): self.pvname, self._flags, name="flags", - is_status="recursive", + is_display="recursive", ) # self._append( # AdjustablePvEnum, @@ -977,13 +981,13 @@ class SmaractRecord(Assembly): name="backlash_fraction", is_setting=True, ) - + def home(self): self.home_forward(1) time.sleep(0.1) while not self.flags.is_homed.get_current_value(): time.sleep(0.1) - + def calibrate_sensor(self): self._calibrate_sensor(1) time.sleep(0.1) @@ -1214,7 +1218,7 @@ class SmaractRecordFlags(Assembly): [self._flags], partial(self._get_flag_index_value, index=i), name=flag_name, - is_status=True, + is_display=True, ) def _get_flag_index_value(self, value, index): diff --git a/eco/devices_general/powersockets.py b/eco/devices_general/powersockets.py index 45ce412..53db31b 100644 --- a/eco/devices_general/powersockets.py +++ b/eco/devices_general/powersockets.py @@ -14,21 +14,21 @@ class PowerSocket(Assembly): is_setting=True, ) self._append( - DetectorPvEnum, pvname + ":POWERONOFF-RB", name="stat", is_status=True + DetectorPvEnum, pvname + ":POWERONOFF-RB", name="stat", is_display=True ) self._append( AdjustablePvEnum, pvname + ":POWERONOFF", name="on_switch", is_setting=True, - is_status=False, + is_display=False, ) self._append( AdjustablePvString, pvname + ":POWERCYCLE", name="powercycle_for_10s", is_setting=False, - is_status=False, + is_display=False, ) def toggle(self): @@ -55,13 +55,13 @@ class GudeStrip(Assembly): self._append( PowerSocket, pvbase + f"-CH{n}", - is_status="recursive", + is_display="recursive", is_setting=True, name=f"ch{n}", ) self._append( - DetectorPvData, pvbase + ":CURRENT", is_status=True, name="current" + DetectorPvData, pvbase + ":CURRENT", is_display=True, name="current" ) self._append( - DetectorPvData, pvbase + ":VOLTAGE", is_status=True, name="voltage" + DetectorPvData, pvbase + ":VOLTAGE", is_display=True, name="voltage" ) diff --git a/eco/devices_general/wago.py b/eco/devices_general/wago.py index 014c0e4..87a0eda 100644 --- a/eco/devices_general/wago.py +++ b/eco/devices_general/wago.py @@ -8,28 +8,28 @@ class AnalogInput(Assembly): super().__init__(name=name) self.pvname = pvname self._append( - DetectorPvData, self.pvname, name="value", is_setting=False, is_status=True + DetectorPvData, self.pvname, name="value", is_setting=False, is_display=True ) self._append( AdjustablePvString, self.pvname + ".DESC", name="description", is_setting=True, - is_status=True, + is_display=True, ) self._append( AdjustablePvString, self.pvname + ".EGU", name="unit", is_setting=False, - is_status=False, + is_display=False, ) self._append( DetectorPvData, self.pvname + ".RVAL", name="raw", is_setting=False, - is_status=False, + is_display=False, ) def get_current_value(self): diff --git a/eco/dummy/bernina.py b/eco/dummy/bernina.py index 3fe97e7..98ae666 100644 --- a/eco/dummy/bernina.py +++ b/eco/dummy/bernina.py @@ -966,14 +966,14 @@ class JohannAnalyzer(Assembly): "SARES20-MF1:MOT_3", name="pitch", is_setting=True, - is_status=True, + is_display=True, ) self._append( MotorRecord, "SARES20-MF1:MOT_4", name="roll", is_setting=True, - is_status=True, + is_display=True, ) @@ -995,7 +995,7 @@ namespace.append_obj(JohannAnalyzer, name="analyzer") # self.pump_exp_delaystage, # name="pump_delay_exp", # is_setting=False, -# is_status=True, +# is_display=True, # reset_current_value_to=False, # ) # self._append(SmaractStreamdevice, "SARES23-ESB5", name="wp", is_setting=True) @@ -1010,7 +1010,7 @@ namespace.append_obj(JohannAnalyzer, name="analyzer") # self.pump_2_delaystage, # name="pump_2_delay", # is_setting=False, -# is_status=True, +# is_display=True, # reset_current_value_to=False, # ) # self._append(SmaractStreamdevice, "SARES23-ESB6", name="ratio", is_setting=True) @@ -1065,7 +1065,7 @@ namespace.append_obj(JohannAnalyzer, name="analyzer") # self.delaystage, # name="delay", # is_setting=True, -# is_status=True, +# is_display=True, # ) # self._append( # SmaractStreamdevice, @@ -1083,7 +1083,7 @@ namespace.append_obj(JohannAnalyzer, name="analyzer") # camserver_alias="tt_spatial", # pvname_zoom="SARES20-MF1:MOT_15", # is_setting=True, -# is_status="recursive", +# is_display="recursive", # name="microscope", # ) # diff --git a/eco/elements/adj_obj.py b/eco/elements/adj_obj.py index 2553c24..5289e50 100644 --- a/eco/elements/adj_obj.py +++ b/eco/elements/adj_obj.py @@ -40,9 +40,9 @@ class AdjustableObject(Assembly): call_obj=False, is_setting=False, name=ln, - is_status="recursive", + is_display="recursive", ) else: self._append( - tadj, call_obj=False, is_setting=False, is_status=True, name=ln + tadj, call_obj=False, is_setting=False, is_display=True, name=ln ) diff --git a/eco/elements/adjustable.py b/eco/elements/adjustable.py index f52d364..44b5192 100644 --- a/eco/elements/adjustable.py +++ b/eco/elements/adjustable.py @@ -12,6 +12,7 @@ from eco.devices_general.utilities import Changer from eco.utilities.keypress import KeyPress + # from .assembly import Assembly from copy import deepcopy from enum import IntEnum @@ -406,11 +407,11 @@ class AdjustableFS: # self._append( # AdjustableObject(tadj), # call_obj=False, -# is_setting=False, -# is_status="recursive", +# is_display=False, +# is_display="recursive", # ) # else: -# self._append(tadj, call_obj=False, is_setting=False, is_status=True) +# self._append(tadj, call_obj=False, is_setting=False, is_display=True) @default_representation diff --git a/eco/elements/assembly.py b/eco/elements/assembly.py index a7531db..d1c29e4 100644 --- a/eco/elements/assembly.py +++ b/eco/elements/assembly.py @@ -60,9 +60,7 @@ class Assembly: # self.settings = [] # self.status_indicators = [] self.settings_collection = Collection(name="settings_collection") - self.status_indicators_collection = Collection( - name="status_indicators_collection" - ) + self.status_collection = Collection(name="status_collection") self.display_collection = Collection(name="display_collection") self.view_toplevel_only = [] if memory.global_memory_dir: @@ -74,6 +72,7 @@ class Assembly: *args, name=None, is_setting=False, + is_display=True, is_status=True, is_alias=True, view_toplevel_only=True, @@ -89,21 +88,16 @@ class Assembly: # print(f'object {name} / {foo_obj_init} not initialized with name/parent') # self.__dict__[name] = foo_obj_init(*args, **kwargs) if is_setting: - # self.settings.append(self.__dict__[name]) self.settings_collection.append(self.__dict__[name], recursive=True) if is_status: - if is_status == "recursive": - self.status_indicators_collection.append( - self.__dict__[name], recursive=True - ) + self.status_collection.append(self.__dict__[name], recursive=True) + if is_display: + if is_display == "recursive": + self.display_collection.append(self.__dict__[name], recursive=True) else: - self.status_indicators_collection.append( - self.__dict__[name], recursive=False - ) + self.display_collection.append(self.__dict__[name], recursive=False) - # if (not is_setting) and is_status: - # self.status_indicators.append(self.__dict__[name]) if view_toplevel_only: self.view_toplevel_only.append(self.__dict__[name]) @@ -111,7 +105,7 @@ class Assembly: if base == "self": base = self settings = {} - status_indicators = {} + status = {} nodet = [] geterror = [] for ts in track( @@ -132,7 +126,7 @@ class Assembly: else: nodet.append(ts.alias.get_full_name(base=base)) for ts in track( - self.status_indicators_collection.get_list(), + self.status_collection.get_list(), transient=True, description="Reading status indicators ...", ): @@ -143,9 +137,7 @@ class Assembly: # else: if hasattr(ts, "get_current_value"): try: - status_indicators[ - ts.alias.get_full_name(base=base) - ] = ts.get_current_value() + status[ts.alias.get_full_name(base=base)] = ts.get_current_value() except: geterror.append(ts.alias.get_full_name(base=base)) else: @@ -158,16 +150,23 @@ class Assembly: "Retrieved error while running get_current_value from: " + ", ".join(geterror) ) - return {"settings": settings, "status_indicators": status_indicators} + return {"settings": settings, "status": status} def status(self, get_string=False): + stat = self.get_status() + s = tabulate([[name, value] for name, value in stat["status"].items()]) + if get_string: + return s + else: + print(s) + + def settings(self, get_string=False): stat = self.get_status() s = tabulate( [ [colorama.Style.BRIGHT + name + colorama.Style.RESET_ALL, value] for name, value in stat["settings"].items() ] - + [[name, value] for name, value in stat["status_indicators"].items()] ) if get_string: return s @@ -186,9 +185,9 @@ class Assembly: s = tabulate([[name, value] for name, value in stat_filt[stat_field].items()]) return s - def get_status_indicator_str(self): + def get_display_str(self): main_name = self.name - stats = self.status_indicators_collection() + stats = self.display_collection() # stats_dict = {} tab = [] for to in stats: @@ -206,7 +205,7 @@ class Assembly: def __repr__(self): label = self.alias.get_full_name() + " status\n" - return label + self.get_status_indicator_str() + return label + self.get_display_str() def _run_cmd(self, line): print(f"Starting following commandline silently:\n" + line) @@ -230,7 +229,7 @@ class Assembly_old: *args, name=None, is_setting=False, - is_status=True, + is_display=True, is_alias=True, view_toplevel_only=True, **kwargs, diff --git a/eco/endstations/bernina_diffractometers.py b/eco/endstations/bernina_diffractometers.py index 5cebd43..a371285 100644 --- a/eco/endstations/bernina_diffractometers.py +++ b/eco/endstations/bernina_diffractometers.py @@ -44,28 +44,28 @@ class GPS(Assembly): pvname + ":MOT_TX", name="xbase", is_setting=True, - is_status=True, + is_display=True, ) self._append( MotorRecord, pvname + ":MOT_TY", name="_ybase_deltatau", is_setting=False, - is_status=False, + is_display=False, ) self._append( MotorRecord, pvname + ":MOT_RX", name="_rxbase_deltatau", is_setting=False, - is_status=False, + is_display=False, ) self._append( MotorRecord, pvname + ":MOT_YU", name="_ybase_upstream", is_setting=True, - is_status=False, + is_display=False, backlash_definition=True, ) self._append( @@ -73,7 +73,7 @@ class GPS(Assembly): pvname + ":MOT_YD", name="_ybase_downstream", is_setting=True, - is_status=False, + is_display=False, backlash_definition=True, ) self._append( @@ -86,7 +86,7 @@ class GPS(Assembly): ], name="ybase", is_setting=False, - is_status=True, + is_display=True, unit="mm", ) self._append( @@ -100,7 +100,7 @@ class GPS(Assembly): ], name="rxbase", is_setting=False, - is_status=True, + is_display=True, unit="deg", ) @@ -112,7 +112,7 @@ class GPS(Assembly): pvname + ":MOT_NY_RY2TH", name="gamma", is_setting=False, - is_status=False, + is_display=False, ) self._append( MotorRecord, pvname + ":MOT_MY_RYTH", name="mu", is_setting=True @@ -122,7 +122,7 @@ class GPS(Assembly): pvname + ":MOT_MY_RYTH", name="alpha", is_setting=False, - is_status=False, + is_display=False, ) self.set_base_off = DeltaTauCurrOff("SARES22-GPS:asyn2.AOUT") @@ -147,7 +147,7 @@ class GPS(Assembly): name="hex", fina_angle_offset=fina_hex_angle_offset, is_setting=True, - is_status="recursive", + is_display="recursive", ) if "hlxz" in self.configuration: @@ -178,56 +178,56 @@ class GPS(Assembly): self.pvname + ":MOT_KAP_KRX", name="eta_kap", is_setting=True, - is_status=True, + is_display=True, ) self._append( MotorRecord_new, self.pvname + ":MOT_KAP_KAP", name="kappa", is_setting=True, - is_status=True, + is_display=True, ) self._append( MotorRecord_new, self.pvname + ":MOT_KAP_KPH", name="phi_kap", is_setting=True, - is_status=True, + is_display=True, ) self._append( MotorRecord_new, self.pvname + ":MOT_KAP_DTY", name="zkap", is_setting=True, - is_status=True, + is_display=True, ) self._append( MotorRecord_new, self.pvname + ":MOT_KAP_DTX", name="xkap", is_setting=True, - is_status=True, + is_display=True, ) self._append( MotorRecord_new, self.pvname + ":MOT_KAP_DTZ", name="ykap", is_setting=True, - is_status=True, + is_display=True, ) self._append( MotorRecord_new, self.pvname + ":MOT_KAP_DRX", name="rxkap", is_setting=True, - is_status=True, + is_display=True, ) self._append( MotorRecord_new, self.pvname + ":MOT_KAP_DRZ", name="rykap", is_setting=True, - is_status=True, + is_display=True, ) self.set_kappa_off = DeltaTauCurrOff(self.pvname + ":asyn1.AOUT") @@ -325,11 +325,11 @@ class GPS(Assembly): def flip_ang(ang): if 1 < abs(ang // np.pi): - return ang - np.sign(ang) * abs(ang)//(2*np.pi) * np.pi * 2 + return ang - np.sign(ang) * abs(ang) // (2 * np.pi) * np.pi * 2 else: return ang - #phi_k = flip_ang(phi_k) + # phi_k = flip_ang(phi_k) eta_k = flip_ang(eta_k) kappa = flip_ang(kappa) @@ -420,28 +420,28 @@ class XRDYou(Assembly): pvname + ":MOT_TX", name="xbase", is_setting=True, - is_status=True, + is_display=True, ) self._append( MotorRecord, pvname + ":MOT_TY", name="_ybase_deltatau", is_setting=False, - is_status=False, + is_display=False, ) self._append( MotorRecord, pvname + ":MOT_RX", name="_rxbase_deltatau", is_setting=False, - is_status=False, + is_display=False, ) self._append( MotorRecord, pvname + ":MOT_YU", name="_ybase_upstream", is_setting=True, - is_status=False, + is_display=False, backlash_definition=True, ) self._append( @@ -449,7 +449,7 @@ class XRDYou(Assembly): pvname + ":MOT_YD", name="_ybase_downstream", is_setting=True, - is_status=False, + is_display=False, backlash_definition=True, ) self._append( @@ -462,7 +462,7 @@ class XRDYou(Assembly): ], name="ybase", is_setting=False, - is_status=True, + is_display=True, unit="mm", ) self._append( @@ -476,7 +476,7 @@ class XRDYou(Assembly): ], name="rxbase", is_setting=False, - is_status=True, + is_display=True, unit="deg", ) self._append( @@ -484,7 +484,7 @@ class XRDYou(Assembly): Id + ":MOT_MY_RYTH", name="mu", is_setting=True, - is_status=True, + is_display=True, ) self.set_base_off = DeltaTauCurrOff("SARES21-XRD:asyn4.AOUT") @@ -495,14 +495,14 @@ class XRDYou(Assembly): Id + ":MOT_NY_RY2TH", name="nu", is_setting=True, - is_status=True, + is_display=True, ) self._append( MotorRecord_new, Id + ":MOT_DT_RX2TH", name="delta", is_setting=True, - is_status=True, + is_display=True, ) ### motors XRD area detector branch ### self._append( @@ -510,7 +510,7 @@ class XRDYou(Assembly): Id + ":MOT_D_T", name="tdet", is_setting=True, - is_status=True, + is_display=True, ) ### motors XRD polarisation analyzer branch ### @@ -519,7 +519,7 @@ class XRDYou(Assembly): Id + ":MOT_P_T", name="tpol", is_setting=True, - is_status=True, + is_display=True, ) # missing: slits of flight tube self.set_detarm_off = DeltaTauCurrOff("SARES21-XRD:asyn3.AOUT") @@ -531,14 +531,14 @@ class XRDYou(Assembly): Id + ":MOT_TBL_TX", name="xhl", is_setting=True, - is_status=True, + is_display=True, ) self._append( MotorRecord_new, Id + ":MOT_TBL_TZ", name="zhl", is_setting=True, - is_status=True, + is_display=True, ) self.set_phi_off = DeltaTauCurrOff("SARES21-XRD:asyn1.AOUT") if "hly" in self.configuration: @@ -547,7 +547,7 @@ class XRDYou(Assembly): Id + ":MOT_TBL_TY", name="yhl", is_setting=True, - is_status=True, + is_display=True, ) self.set_phi_off = DeltaTauCurrOff("SARES21-XRD:asyn1.AOUT") @@ -558,7 +558,7 @@ class XRDYou(Assembly): Id + ":MOT_TBL_RX", name="rxhl", is_setting=True, - is_status=True, + is_display=True, ) except: print("XRD.rxhl not found") @@ -569,7 +569,7 @@ class XRDYou(Assembly): Id + ":MOT_TBL_RY", name="rzhl", is_setting=True, - is_status=True, + is_display=True, ) except: print("XRD.rzhl not found") @@ -582,14 +582,14 @@ class XRDYou(Assembly): Id + ":MOT_HEX_TX", name="tphi", is_setting=True, - is_status=True, + is_display=True, ) self._append( MotorRecord_new, Id + ":MOT_HEX_RX", name="phi", is_setting=True, - is_status=True, + is_display=True, ) if "phi_hex" in self.configuration: @@ -643,56 +643,56 @@ class XRDYou(Assembly): self.pvname + ":MOT_KAP_KRX", name="eta_kap", is_setting=True, - is_status=True, + is_display=True, ) self._append( MotorRecord_new, self.pvname + ":MOT_KAP_KAP", name="kappa", is_setting=True, - is_status=True, + is_display=True, ) self._append( MotorRecord_new, self.pvname + ":MOT_KAP_KPH", name="phi_kap", is_setting=True, - is_status=True, + is_display=True, ) self._append( MotorRecord_new, self.pvname + ":MOT_KAP_DTY", name="zkap", is_setting=True, - is_status=True, + is_display=True, ) self._append( MotorRecord_new, self.pvname + ":MOT_KAP_DTX", name="xkap", is_setting=True, - is_status=True, + is_display=True, ) self._append( MotorRecord_new, self.pvname + ":MOT_KAP_DTZ", name="ykap", is_setting=True, - is_status=True, + is_display=True, ) self._append( MotorRecord_new, self.pvname + ":MOT_KAP_DRX", name="rxkap", is_setting=True, - is_status=True, + is_display=True, ) self._append( MotorRecord_new, self.pvname + ":MOT_KAP_DRZ", name="rykap", is_setting=True, - is_status=True, + is_display=True, ) self.set_kappa_off = DeltaTauCurrOff(self.pvname + ":asyn1.AOUT") @@ -763,7 +763,7 @@ class XRDYou(Assembly): diff_detector["jf_id"], name="det_diff", is_setting=False, - is_status=False, + is_display=False, view_toplevel_only=True, ) @@ -837,7 +837,7 @@ class XRDYou(Assembly): return ang # phi_k = flip_ang(phi_k) - phi_k = phi_k + np.pi*2 + phi_k = phi_k + np.pi * 2 eta_k = flip_ang(eta_k) kappa = flip_ang(kappa) if degrees: @@ -943,28 +943,28 @@ class XRD(Assembly): pvname + ":MOT_TX", name="xbase", is_setting=True, - is_status=True, + is_display=True, ) self._append( MotorRecord, pvname + ":MOT_TY", name="_ybase_deltatau", is_setting=False, - is_status=False, + is_display=False, ) self._append( MotorRecord, pvname + ":MOT_RX", name="_rxbase_deltatau", is_setting=False, - is_status=False, + is_display=False, ) self._append( MotorRecord, pvname + ":MOT_YU", name="_ybase_upstream", is_setting=True, - is_status=False, + is_display=False, backlash_definition=True, ) self._append( @@ -972,7 +972,7 @@ class XRD(Assembly): pvname + ":MOT_YD", name="_ybase_downstream", is_setting=True, - is_status=False, + is_display=False, backlash_definition=True, ) self._append( @@ -985,7 +985,7 @@ class XRD(Assembly): ], name="ybase", is_setting=False, - is_status=True, + is_display=True, unit="mm", ) self._append( @@ -999,7 +999,7 @@ class XRD(Assembly): ], name="rxbase", is_setting=False, - is_status=True, + is_display=True, unit="deg", ) @@ -1151,7 +1151,7 @@ class XRD(Assembly): diff_detector["jf_id"], name="det_diff", is_setting=False, - is_status=True, + is_display=True, view_toplevel_only=True, ) diff --git a/eco/endstations/bernina_rixs.py b/eco/endstations/bernina_rixs.py index b615242..2aedb2c 100644 --- a/eco/endstations/bernina_rixs.py +++ b/eco/endstations/bernina_rixs.py @@ -51,7 +51,7 @@ class Analyzer(Assembly): pvname + f":{pvmot}", name=name, is_setting=True, - is_status=True, + is_display=True, backlash_definition=True, schneider_config=(pvname + f":{pvmot}", pvname + f":{pvmot}"), ) @@ -61,7 +61,7 @@ class Analyzer(Assembly): pvname + f":{pvmot}", name=name, is_setting=True, - is_status=True, + is_display=True, backlash_definition=False, schneider_config=(pvname + f":{pvmot}", pvname + f":{pvmot}"), ) @@ -70,7 +70,7 @@ class Analyzer(Assembly): # AdjustableMemory, # name=name, # is_setting=True, - # is_status=True, + # is_display=True, # ) # print(f"Initialization of epics motor {name}: {pvname}:{pvmot} failed, replaced by dummy!") # append the detector @@ -79,7 +79,7 @@ class Analyzer(Assembly): name="det", pvname=pvname, is_setting=False, - is_status="recursive", + is_display="recursive", ) self._append( @@ -88,7 +88,7 @@ class Analyzer(Assembly): self.energy_from_motor_pos, self.motor_pos_from_energy, is_setting=False, - is_status=True, + is_display=True, name="energy", unit="eV", ) @@ -98,7 +98,7 @@ class Analyzer(Assembly): self.tth_from_motor_pos, self.motor_pos_from_tth, is_setting=False, - is_status=True, + is_display=True, name="tth", unit="deg", ) @@ -108,7 +108,7 @@ class Analyzer(Assembly): self.delta_from_motor_pos, self.motor_pos_from_delta, is_setting=False, - is_status=True, + is_display=True, name="delta", unit="deg", ) @@ -145,9 +145,11 @@ class Analyzer(Assembly): energy = xu.lam2en( self.material.planeDistance(*self.hkl) * 2 * np.sin(np.deg2rad(tth / 2)) ) - om_calc, chi_calc, phi_calc, tth_calc = self.angs_from_hkl(*self.hkl, energy=energy) - if abs(om-om_calc)>0.1: - energy=None + om_calc, chi_calc, phi_calc, tth_calc = self.angs_from_hkl( + *self.hkl, energy=energy + ) + if abs(om - om_calc) > 0.1: + energy = None return energy def rowland_intersection(self, beta, tbeta): @@ -163,7 +165,7 @@ class Analyzer(Assembly): x0 = r / 2 * np.cos(b) y0 = r / 2 * np.sin(b) p = np.cos(tb) * x0 + np.sin(tb) * y0 - d = p + np.sqrt(p ** 2 + (r / 2) ** 2 - x0 ** 2 - y0 ** 2) + d = p + np.sqrt(p**2 + (r / 2) ** 2 - x0**2 - y0**2) x, y = np.array([d * np.cos(tb), d * np.sin(tb)]) return x, y @@ -184,20 +186,22 @@ class Analyzer(Assembly): """ cfg = self.config["rowland"] a0 = np.deg2rad(cfg["alpha_lin"]) - tb = np.deg2rad(180-tth) - t_hor, det_t_hor, det_t_ver = [self.t_hor.get_current_value(), self.det.t_hor.get_current_value(), self.det.t_ver.get_current_value()] + tb = np.deg2rad(180 - tth) + t_hor, det_t_hor, det_t_ver = [ + self.t_hor.get_current_value(), + self.det.t_hor.get_current_value(), + self.det.t_ver.get_current_value(), + ] y_d_cur = np.sin(a0) * det_t_hor + np.cos(a0) * det_t_ver x_d_cur = np.cos(a0) * det_t_hor - np.sin(a0) * det_t_ver + t_hor d_cryst_det = norm(np.array([x_d_cur, y_d_cur])) - x_d = np.cos(tb)*d_cryst_det-t_hor - y_d = np.sin(tb)*d_cryst_det + x_d = np.cos(tb) * d_cryst_det - t_hor + y_d = np.sin(tb) * d_cryst_det det_t_hor = np.sin(a0) * y_d + np.cos(a0) * x_d det_t_ver = np.cos(a0) * y_d - np.sin(a0) * x_d det_rot = -(180 - tth) / 2 return t_hor, det_t_hor, det_t_ver, det_rot - - def tth_from_motor_pos(self, t_hor, det_t_hor, det_t_ver, det_rot=None): """ This function returns the current tth value calculated from the crystal and detector translations t_hor, det_t_hor, det_t_ver @@ -211,29 +215,29 @@ class Analyzer(Assembly): return 180 - tb def reset_motors_current_values_to_energy(self, energy): - targets = self.motor_pos_from_energy(energy) + targets = self.motor_pos_from_energy(energy) motors = [self.om, self.t_hor, self.det.t_hor, self.det.t_ver, self.det.rot] for mot, tar in zip(motors, targets): - print(f'Resetting {mot.name} from {mot.get_current_value():.5} to {tar:.5}') + print(f"Resetting {mot.name} from {mot.get_current_value():.5} to {tar:.5}") mot.reset_current_value_to(tar) def motor_pos_from_delta(self, delta): t_hor = self.t_hor.get_current_value() t_ver = self.t_ver.get_current_value() - t_ver = -t_ver /2.5e6*(48.1-22.5) + t_ver = -t_ver / 2.5e6 * (48.1 - 22.5) om = self.om.get_current_value() - t_ver_target = np.arctan(np.deg2rad(delta))*t_hor - om = om+(t_ver_target-t_ver)*0.0557 + t_ver_target = np.arctan(np.deg2rad(delta)) * t_hor + om = om + (t_ver_target - t_ver) * 0.0557 # t_ver moves in microsteps and the direction is wrong, we fix both here in eco: - t_ver_target = -t_ver_target*2.5e6/(48.1-22.5) + t_ver_target = -t_ver_target * 2.5e6 / (48.1 - 22.5) return om, t_ver_target def delta_from_motor_pos(self, om, t_ver): # t_ver moves in microsteps and the direction is wrong, we fix both here in eco: t_hor = self.t_hor.get_current_value() - t_ver = -t_ver/2.5e6*(48.1-22.5) - return np.rad2deg(np.arctan(t_ver/t_hor)) + t_ver = -t_ver / 2.5e6 * (48.1 - 22.5) + return np.rad2deg(np.arctan(t_ver / t_hor)) class Detector(Assembly): @@ -258,7 +262,7 @@ class Detector(Assembly): pvname + f":{pvmot}", name=name, is_setting=True, - is_status=True, + is_display=True, backlash_definition=False, ) except: @@ -266,7 +270,7 @@ class Detector(Assembly): AdjustableMemory, name=name, is_setting=True, - is_status=True, + is_display=True, ) print( f"Initialization of epics motor {name}: {pvname}:{pvmot} failed, replaced by dummy!" @@ -305,7 +309,6 @@ class RIXS(Assembly): }, } - # append an analyzer self.append_analyzer( pos=2, @@ -350,7 +353,7 @@ class RIXS(Assembly): config=self.config, pvname=pvname, is_setting=False, - is_status="recursive", + is_display="recursive", ) def gui(self, guiType="xdm"): diff --git a/eco/endstations/bernina_rixs_backup.py b/eco/endstations/bernina_rixs_backup.py index 99e6b1a..73a5043 100644 --- a/eco/endstations/bernina_rixs_backup.py +++ b/eco/endstations/bernina_rixs_backup.py @@ -53,7 +53,7 @@ class Analyzer(Assembly): pvname + f":{pvmot}", name=name, is_setting=True, - is_status=True, + is_display=True, backlash_definition=True, schneider_config=(pvname + f":{pvmot}", pvname + f":{pvmot}"), ) @@ -63,7 +63,7 @@ class Analyzer(Assembly): pvname + f":{pvmot}", name=name, is_setting=True, - is_status=True, + is_display=True, backlash_definition=False, schneider_config=(pvname + f":{pvmot}", pvname + f":{pvmot}"), ) @@ -72,7 +72,7 @@ class Analyzer(Assembly): # AdjustableMemory, # name=name, # is_setting=True, - # is_status=True, + # is_display=True, # ) # print(f"Initialization of epics motor {name}: {pvname}:{pvmot} failed, replaced by dummy!") @@ -82,7 +82,7 @@ class Analyzer(Assembly): self.energy_from_motor_pos, self.motor_pos_from_energy, is_setting=False, - is_status=True, + is_display=True, name="energy", unit="eV", ) @@ -92,7 +92,7 @@ class Analyzer(Assembly): self.tth_from_motor_pos, self.motor_pos_from_tth, is_setting=False, - is_status=True, + is_display=True, name="tth", unit="deg", ) @@ -129,9 +129,11 @@ class Analyzer(Assembly): energy = xu.lam2en( self.material.planeDistance(*self.hkl) * 2 * np.sin(np.deg2rad(tth / 2)) ) - om_calc, chi_calc, phi_calc, tth_calc = self.angs_from_hkl(*self.hkl, energy=energy) - if abs(om-om_calc)>0.1: - energy=None + om_calc, chi_calc, phi_calc, tth_calc = self.angs_from_hkl( + *self.hkl, energy=energy + ) + if abs(om - om_calc) > 0.1: + energy = None return energy def rowland_intersection(self, beta, tbeta): @@ -147,7 +149,7 @@ class Analyzer(Assembly): x0 = r / 2 * np.cos(b) y0 = r / 2 * np.sin(b) p = np.cos(tb) * x0 + np.sin(tb) * y0 - d = p + np.sqrt(p ** 2 + (r / 2) ** 2 - x0 ** 2 - y0 ** 2) + d = p + np.sqrt(p**2 + (r / 2) ** 2 - x0**2 - y0**2) x, y = np.array([d * np.cos(tb), d * np.sin(tb)]) return x, y @@ -168,20 +170,22 @@ class Analyzer(Assembly): """ cfg = self.config["rowland"] a0 = np.deg2rad(cfg["alpha_lin"]) - tb = np.deg2rad(180-tth) - t_hor, det_t_hor, det_t_ver = [self.t_hor.get_current_value(), self._det.t_hor.get_current_value(), self._det.t_ver.get_current_value()] + tb = np.deg2rad(180 - tth) + t_hor, det_t_hor, det_t_ver = [ + self.t_hor.get_current_value(), + self._det.t_hor.get_current_value(), + self._det.t_ver.get_current_value(), + ] y_d_cur = np.sin(a0) * det_t_hor + np.cos(a0) * det_t_ver x_d_cur = np.cos(a0) * det_t_hor - np.sin(a0) * det_t_ver + t_hor d_cryst_det = norm(np.array([x_d_cur, y_d_cur])) - x_d = np.cos(tb)*d_cryst_det-t_hor - y_d = np.sin(tb)*d_cryst_det + x_d = np.cos(tb) * d_cryst_det - t_hor + y_d = np.sin(tb) * d_cryst_det det_t_hor = np.sin(a0) * y_d + np.cos(a0) * x_d det_t_ver = np.cos(a0) * y_d - np.sin(a0) * x_d det_rot = -(180 - tth) / 2 return t_hor, det_t_hor, det_t_ver, det_rot - - def tth_from_motor_pos(self, t_hor, det_t_hor, det_t_ver, det_rot=None): """ This function returns the current tth value calculated from the crystal and detector translations t_hor, det_t_hor, det_t_ver @@ -195,10 +199,10 @@ class Analyzer(Assembly): return 180 - tb def reset_motors_current_values_to_energy(self, energy): - targets = self.motor_pos_from_energy(energy) + targets = self.motor_pos_from_energy(energy) motors = [self.om, self.t_hor, self._det.t_hor, self._det.t_ver, self._det.rot] for mot, tar in zip(motors, targets): - print(f'Resetting {mot.name} from {mot.get_current_value():.5} to {tar:.5}') + print(f"Resetting {mot.name} from {mot.get_current_value():.5} to {tar:.5}") mot.reset_current_value_to(tar) @@ -224,7 +228,7 @@ class Detector(Assembly): pvname + f":{pvmot}", name=name, is_setting=True, - is_status=True, + is_display=True, backlash_definition=False, ) except: @@ -232,7 +236,7 @@ class Detector(Assembly): AdjustableMemory, name=name, is_setting=True, - is_status=True, + is_display=True, ) print( f"Initialization of epics motor {name}: {pvname}:{pvmot} failed, replaced by dummy!" @@ -277,7 +281,7 @@ class RIXS(Assembly): name="det", pvname=pvname, is_setting=False, - is_status="recursive", + is_display="recursive", ) # append an analyzer self.append_analyzer( @@ -326,7 +330,7 @@ class RIXS(Assembly): det=det, pvname=pvname, is_setting=False, - is_status="recursive", + is_display="recursive", ) def gui(self, guiType="xdm"): diff --git a/eco/endstations/bernina_sample_environments.py b/eco/endstations/bernina_sample_environments.py index c716eec..e6e3e05 100644 --- a/eco/endstations/bernina_sample_environments.py +++ b/eco/endstations/bernina_sample_environments.py @@ -91,23 +91,21 @@ class High_field_thz_chamber(Assembly): ### lakeshore temperatures #### self._append( AdjustablePv, - pvsetname = 'SARES20-CRYO:TEMP.VAL', - pvreadbackname='SARES20-CRYO:TEMP_RBV', + pvsetname="SARES20-CRYO:TEMP.VAL", + pvreadbackname="SARES20-CRYO:TEMP_RBV", accuracy=0.1, - name='temp_sample', + name="temp_sample", is_setting=False, ) self._append( AdjustablePv, - pvsetname = 'SARES20-CRYO:TEMP-B', - pvreadbackname='SARES20-CRYO:TEMP-B_RBV', + pvsetname="SARES20-CRYO:TEMP-B", + pvreadbackname="SARES20-CRYO:TEMP-B_RBV", accuracy=0.1, - name='temp_coldfinger', + name="temp_coldfinger", is_setting=False, ) - - ### in vacuum smaract motors ### for name, config in self.motor_configuration.items(): if "kwargs" in config.keys(): @@ -132,34 +130,34 @@ class High_field_thz_chamber(Assembly): MotorRecord, "SARES20-EXP:MOT_RY", name="otti_nu", - is_status=True, + is_display=True, is_setting=True, ) self._append( MotorRecord, "SARES20-EXP:MOT_RZ", name="otti_del", - is_status=True, + is_display=True, is_setting=True, ) self._append( DetectorPvData, "SARES20-EXP:DET_RY.RBV", name="otti_det", - is_status=True, + is_display=True, ) self._append( AdjustablePv, "SARES20-EXP:DET_RY.OFF", name="otti_det_offset", - is_status=False, + is_display=False, is_setting=True, ) self._append( AdjustableFS, "/sf/bernina/config/eco/reference_values/otti_det_rot_offset.json", name="otti_det_rotation", - is_status=True, + is_display=True, is_setting=True, ) @@ -634,8 +632,8 @@ class Electro_optic_sampling: tt = t - t0 y = ( 0.5 - * exp(-(2 * tau * tt - w ** 2) / (2 * tau ** 2)) - * (1 - erf((-tau * tt + w ** 2) / (sqrt(2) * tau * w))) + * exp(-(2 * tau * tt - w**2) / (2 * tau**2)) + * (1 - erf((-tau * tt + w**2) / (sqrt(2) * tau * w))) ) return y @@ -784,7 +782,7 @@ class Electro_optic_sampling: th = 0.0 / 180 * np.pi t = 2.0 / (n0 + 1) geoSens = np.cos(alpha) * np.sin(2 * th) + 2 * np.sin(alpha) * np.cos(2 * th) - E = np.arcsin(DiffoverSum) * wl / (np.pi * L * r41 * n0 ** 3 * t) / geoSens + E = np.arcsin(DiffoverSum) * wl / (np.pi * L * r41 * n0**3 * t) / geoSens return E diff --git a/eco/epics/detector.py b/eco/epics/detector.py index 65edbdb..be10ee3 100644 --- a/eco/epics/detector.py +++ b/eco/epics/detector.py @@ -15,16 +15,17 @@ from eco.epics import get_from_archive # @value_property @get_from_archive class DetectorPvData(Assembly): - def __init__(self, pvname, name=None): + def __init__(self, pvname, name=None, has_fields=False): super().__init__(name=name) - self.status_indicators_collection.append(self) + self.status_collection.append(self) self.pvname = pvname self._pv = PV(pvname) self.name = name self.alias = Alias(self.name, channel=self.pvname, channeltype="CA") - self._append( - AdjustablePvString, self.pvname + ".EGU", name="unit", is_setting=False - ) + if has_fields: + self._append( + AdjustablePvString, self.pvname + ".EGU", name="unit", is_setting=False + ) def get_current_value(self): return self._pv.get() @@ -110,15 +111,16 @@ class DetectorPvString: # @value_property @get_from_archive class DetectorPvDataStream(Assembly): - def __init__(self, pvname, name=None): + def __init__(self, pvname, name=None, has_fields=False): super().__init__(name=name) self.Id = pvname self.pvname = pvname self._pv = PV(pvname) self.alias = Alias(self.name, channel=self.pvname, channeltype="CA") - self._append( - AdjustablePvString, self.pvname + ".EGU", name="unit", is_setting=False - ) + if has_fields: + self._append( + AdjustablePvString, self.pvname + ".EGU", name="unit", is_setting=False + ) # self._append( # PvString, self.pvname + ".DESC", name="description", is_setting=False # ) diff --git a/eco/fel/swissfel.py b/eco/fel/swissfel.py index 495a3b2..4f20d4d 100644 --- a/eco/fel/swissfel.py +++ b/eco/fel/swissfel.py @@ -16,33 +16,38 @@ class SwissFel(Assembly): DetectorPvData, "SARFE10-PBPG050:HAMP-INTENSITY-CAL", name="aramis_pulse_energy", - is_status=True, + is_display=True, + has_fields=True, + ) + self._append( + UndulatorK, name="aramis_photon_energy_undulators", is_display=True + ) + self._append( + EcolEnergy_new, name="aramis_electron_energy_ecol", is_display=True ) - self._append(UndulatorK, name="aramis_photon_energy_undulators", is_status=True) - self._append(EcolEnergy_new, name="aramis_electron_energy_ecol", is_status=True) self._append( DetectorPvData, "SARUN03-UIND030:FELPHOTENE", name="aramis_photon_energy_und03", - is_status=True, + is_display=True, ) # self._append( # DetectorPvData, # "SARUN:FELPHOTENE", # name="aramis_photon_energy", - # is_status=True, + # is_display=True, # ) self._append( DetectorPvData, "SWISSFEL-STATUS:Bunch-1-Appl-Freq-RB", name="aramis_rep_rate", - is_status=True, + is_display=True, ) self._append( DetectorPvData, "SAR-EVPO-010:DEACTIVATE", name="mode_monitor_inactive", - is_status=True, + is_display=True, ) # PMM disable: # 1. @@ -64,53 +69,53 @@ class SwissFel(Assembly): AdjustablePvEnum, "SAROP-ARAMIS:BEAMLINE_SP", name="aramis_beamline_switch", - is_status=True, + is_display=True, is_setting=True, ) self._append( AdjustablePvEnum, "SAROP21-ARAMIS:MODE_SP", name="bernina_beamline_mode", - is_status=True, + is_display=True, is_setting=True, ) self._append( AdjustablePvEnum, "SFB_PSICO_AR:ONOFF1", name="psico_running", - is_status=True, + is_display=True, is_setting=False, ) self._append( DetectorPvEnum, "SFB_POINTING_AR_MON:SELECT", name="pointing_feedback_monitor", - is_status=True, + is_display=True, is_setting=False, ) self._append( AdjustablePvEnum, "SFB_POINTING_AR:ONOFF1", name="pointing_feedback_running", - is_status=True, + is_display=True, is_setting=False, ) self._append( AdjustablePv, "SFB_POINTING_AR:SP1", name="pointing_feedback_setpoint_x", - is_status=True, + is_display=True, is_setting=False, ) self._append( AdjustablePv, "SFB_POINTING_AR:SP2", name="pointing_feedback_setpoint_y", - is_status=True, + is_display=True, is_setting=False, ) self._append( - MessageBoard, name="message", is_setting=True, is_status="recursive" + MessageBoard, name="message", is_setting=True, is_display="recursive" ) self._append( @@ -142,48 +147,56 @@ class SwissFel(Assembly): "SARUN03-DBPM070:X-REF-FB", name="undulator_x_orbit", is_setting=False, + is_display=False, ) self._append( DetectorBsStream, "SARUN03-DBPM070:Y-REF-FB", name="undulator_y_orbit", is_setting=False, + is_display=False, ) self._append( DetectorBsStream, "SARUN03-MQUA080:X", name="undulator_quad_mover_x", is_setting=False, + is_display=False, ) self._append( DetectorBsStream, "SARUN03-MQUA080:Y", name="undulator_quad_mover_y", is_setting=False, + is_display=False, ) self._append( DetectorBsStream, "SARUN03-UIND030:GM-X-SET", name="undulator_girder_x", is_setting=False, + is_display=False, ) self._append( DetectorBsStream, "SARUN03-UIND030:GM-Y-SET", name="undulator_girder_y", is_setting=False, + is_display=False, ) self._append( DetectorBsStream, "SARUN03-UIND030:GM-YAW-SET", name="undulator_girder_yaw", is_setting=False, + is_display=False, ) self._append( DetectorBsStream, "SARUN03-UIND030:GM-PITCH-SET", name="undulator_girder_pitch", is_setting=False, + is_display=False, ) @@ -279,7 +292,8 @@ class UndulatorK(Assembly): DetectorPvData, "SARUN:FELPHOTENE", name="aramis_undulator_photon_energy", - is_status=True, + is_display=True, + has_fields=True, ) self.ksets = [] self.gaps = [] @@ -289,7 +303,7 @@ class UndulatorK(Assembly): f"SARUN{undno:02d}-UIND030:K_SET", name=f"und{undno:02d}_Kset", is_setting=False, - is_status=False, + is_display=False, ) self.ksets.append(self.__dict__[f"und{undno:02d}_Kset"]) self._append( @@ -299,7 +313,7 @@ class UndulatorK(Assembly): accuracy=0.0002, name=f"und{undno:02d}_gap", is_setting=False, - is_status=False, + is_display=False, ) self.gaps.append(self.__dict__[f"und{undno:02d}_gap"]) self.settings_collection.append(self) @@ -310,7 +324,7 @@ class UndulatorK(Assembly): energy_start = self.aramis_undulator_photon_energy.get_current_value() K_start = [tks.get_current_value() for tks in self.ksets] return [ - (energy_start / energy_target * (tK_start ** 2 + 2) - 2) ** 0.5 + (energy_start / energy_target * (tK_start**2 + 2) - 2) ** 0.5 for tK_start in K_start ] diff --git a/eco/loptics/bernina_laser.py b/eco/loptics/bernina_laser.py index aa80ba5..37d1a4f 100644 --- a/eco/loptics/bernina_laser.py +++ b/eco/loptics/bernina_laser.py @@ -11,14 +11,14 @@ import numpy as np ureg = UnitRegistry() -class IncouplingCleanBernina(Assembly): - def __init__(self, name=None): - super().__init__(name=name) - self._append(SmaractStreamdevice,"SARES23-ESB13",name='tilt') - self._append(SmaractStreamdevice,"SARES23-ESB14",name='rotation') - self._append(SmaractStreamdevice,"SARES23-LIC15",name='transl_vertical') - self._append(MotorRecord,"SARES20-MF2:MOT_5",name='transl_horizontal') +class IncouplingCleanBernina(Assembly): + def __init__(self, name=None): + super().__init__(name=name) + self._append(SmaractStreamdevice, "SARES23-ESB13", name="tilt") + self._append(SmaractStreamdevice, "SARES23-ESB14", name="rotation") + self._append(SmaractStreamdevice, "SARES23-LIC15", name="transl_vertical") + self._append(MotorRecord, "SARES20-MF2:MOT_5", name="transl_horizontal") class LaserBernina(Assembly): @@ -41,22 +41,34 @@ class LaserBernina(Assembly): MotorRecord, self.pvname + "-M532:MOT", name="compressor", is_setting=True ) # Waveplate and Delay stage - self._append(MotorRecord, self.pvname + "-M533:MOT", name="wp_pol", is_setting=True) + self._append( + MotorRecord, self.pvname + "-M533:MOT", name="wp_pol", is_setting=True + ) self._append( MotorRecord, self.pvname + "-M534:MOT", name="wp_att", is_setting=True ) - self._append(AdjustableFS,'/photonics/home/gac-bernina/eco/configuration/wp_att_calibration',name='wp_att_calibration', is_status=False) - + self._append( + AdjustableFS, + "/photonics/home/gac-bernina/eco/configuration/wp_att_calibration", + name="wp_att_calibration", + is_display=False, + ) + def uJ2wp(uJ): direction = 1 - if np.mean(np.diff(np.asarray(self.wp_att_calibration()).T[1]))<0: + if np.mean(np.diff(np.asarray(self.wp_att_calibration()).T[1])) < 0: direction = -1 - return np.interp(uJ,*np.asarray(self.wp_att_calibration())[::direction].T[::-1]) + return np.interp( + uJ, *np.asarray(self.wp_att_calibration())[::direction].T[::-1] + ) + def wp2uJ(wp): - return np.interp(wp,*np.asarray(self.wp_att_calibration()).T) - - self._append(AdjustableVirtual,[self.wp_att],wp2uJ,uJ2wp,name='pulse_energy_pump') - + return np.interp(wp, *np.asarray(self.wp_att_calibration()).T) + + self._append( + AdjustableVirtual, [self.wp_att], wp2uJ, uJ2wp, name="pulse_energy_pump" + ) + self._append( MotorRecord, self.pvname + "-M522:MOTOR_1", @@ -66,7 +78,7 @@ class LaserBernina(Assembly): self._append( DelayTime, self.delaystage_pump, name="delay_pump", is_setting=True ) - self._append(XltEpics, name="xlt", is_setting=True, is_status="recursive") + self._append(XltEpics, name="xlt", is_setting=True, is_display="recursive") # Upstairs, Laser 1 LAM self._append( MotorRecord, @@ -87,6 +99,7 @@ class LaserBernina(Assembly): # is_setting=True, # ) + class DelayTime(AdjustableVirtual): def __init__( self, stage, direction=1, passes=2, reset_current_value_to=True, name=None diff --git a/eco/microscopes/microscopes.py b/eco/microscopes/microscopes.py index a7d74be..1e8c833 100644 --- a/eco/microscopes/microscopes.py +++ b/eco/microscopes/microscopes.py @@ -23,9 +23,9 @@ class MicroscopeMotorRecord(Assembly): CameraBasler, pvname_camera, camserver_alias=camserver_alias, - name='camera', + name="camera", is_setting=True, - is_status="recursive", + is_display="recursive", ) if pvname_zoom: pv_base = pvname_zoom.split(":")[0] @@ -36,7 +36,7 @@ class MicroscopeMotorRecord(Assembly): pvname_zoom, name="zoom", is_setting=True, - is_status=True, + is_display=True, schneider_config=(pvname_zoom, pv_base + f":{port}"), ) if pvname_focus: @@ -45,7 +45,7 @@ class MicroscopeMotorRecord(Assembly): pvname_focus, name="focus", is_setting=True, - is_status=True, + is_display=True, schneider_config=(pvname_zoom, pv_base + f":{port}"), ) @@ -65,7 +65,7 @@ class BerninaInlineMicroscope(Assembly): camserver_alias=self.alias.get_full_name() + f" ({pvname_camera})", name="camera", is_setting=True, - is_status="recursive", + is_display="recursive", ) # self._ self._append(OptoSigmaZoom, name="zoom", is_setting=[True]) diff --git a/eco/motion/smaract.py b/eco/motion/smaract.py index 484b220..8856d3d 100644 --- a/eco/motion/smaract.py +++ b/eco/motion/smaract.py @@ -13,7 +13,7 @@ class SmaractController(Assembly): f"{pvbase}{n}", name=f"stage{n}", is_setting=True, - is_status=True, + is_display=True, ) self.all_stages.append(self.__dict__[f"stage{n}"]) diff --git a/eco/timing/event_timing_new_new.py b/eco/timing/event_timing_new_new.py index 2f128af..b70d994 100644 --- a/eco/timing/event_timing_new_new.py +++ b/eco/timing/event_timing_new_new.py @@ -16,7 +16,7 @@ class TimingSystem(Assembly): def __init__(self, pv_master=None, pv_pulse_id=None, name=None): super().__init__(name=name) self._append( - MasterEventSystem, pv_master, name="event_master", is_status="recursive" + MasterEventSystem, pv_master, name="event_master", is_display="recursive" ) self._append(DetectorPvDataStream, pv_pulse_id, name="pulse_id") @@ -189,7 +189,7 @@ class MasterEventSystem(Assembly): self.pvname, slot, name=f"code{code:03d}", - is_status="recursive", + is_display="recursive", ) self.event_codes[code] = self.__dict__[f"code{code:03d}"] for code, delay in event_code_delays_fix.items(): @@ -199,7 +199,7 @@ class MasterEventSystem(Assembly): delay, "fix delay CTA sequencer code", name=f"code{code:03d}", - is_status="recursive", + is_display="recursive", ) self.event_codes[code] = self.__dict__[f"code{code:03d}"] @@ -250,7 +250,7 @@ class EvrPulser(Assembly): self._event_master = event_master self._append( - AdjustablePvString, pv_base + "-Name-I", name="description", is_status=True + AdjustablePvString, pv_base + "-Name-I", name="description", is_display=True ) self._append( AdjustablePvEnum, @@ -342,7 +342,7 @@ class EvrOutput(Assembly): self._pulsers = pulsers # self._update_connected_pulsers() self._append( - AdjustablePvString, pv_base + "-Name-I", name="description", is_status=True + AdjustablePvString, pv_base + "-Name-I", name="description", is_display=True ) self._append( AdjustablePvEnum, f"{self.pv_base}-Ena-SP", name="enable", is_setting=True @@ -522,7 +522,7 @@ class EventReceiver(Assembly): event_master, name=f"pulser{n}", is_setting=True, - is_status=False, + is_display=False, ) pulsers.append(self.__dict__[f"pulser{n}"]) self.pulsers = tuple(pulsers) @@ -534,7 +534,7 @@ class EventReceiver(Assembly): pulsers=pulsers, name=f"output_front{n}", is_setting=True, - is_status="recursive", + is_display="recursive", ) outputs.append(self.__dict__[f"output_front{n}"]) for n in range(n_output_rear): @@ -544,7 +544,7 @@ class EventReceiver(Assembly): pulsers=pulsers, name=f"output_rear{n}", is_setting=True, - is_status="recursive", + is_display="recursive", ) outputs.append(self.__dict__[f"output_rear{n}"]) # for to in outputs: diff --git a/eco/timing/lasertiming_edwin.py b/eco/timing/lasertiming_edwin.py index a146623..fb609f8 100644 --- a/eco/timing/lasertiming_edwin.py +++ b/eco/timing/lasertiming_edwin.py @@ -97,27 +97,27 @@ class XltEpics(Assembly): super().__init__(name=name) self.pvname = pvname self.settings_collection.append(self, force=True) - self.status_indicators_collection.append(self, force=True) + self.status_collection.append(self, force=True) self._append( AdjustablePvEnum, self.pvname + ":SHOTDELAY", name="oscillator_pulse_offset", is_setting=True, - is_status=True, + is_display=True, ) self._append( AdjustablePvEnum, self.pvname + ":SHOTMOFFS_ENA", name="modulo_offset_mode", is_setting=True, - is_status=True, + is_display=True, ) self._append( AdjustablePv, self.pvname + ":DELAY_Z_OFFS", name="_offset", is_setting=True, - is_status=False, + is_display=False, ) self._append( AdjustableVirtual, @@ -126,28 +126,28 @@ class XltEpics(Assembly): lambda offset: offset / 1e-12, name="offset", is_setting=False, - is_status=True, + is_display=True, ) self._append( AdjustablePv, self.pvname + ":DELAY", name="_set_user_delay_value", is_setting=False, - is_status=False, + is_display=False, ) self._append( AdjustablePv, self.pvname + ":P_RATIO", name="rep_len", is_setting=True, - is_status=True, + is_display=True, ) self._append( AdjustablePv, "SIN-TIMAST-TMA:Evt-22-Freq-SP", name="laser_frequency", is_setting=True, - is_status=True, + is_display=True, ) self._delay_dial_rb = PV("SLAAR-LGEN:DLY_OFFS2") self.alias.append( diff --git a/eco/timing/sequencer.py b/eco/timing/sequencer.py index f798a0b..a655bb6 100644 --- a/eco/timing/sequencer.py +++ b/eco/timing/sequencer.py @@ -25,7 +25,7 @@ class CtaSequencer(Assembly): f"{self.pvname}:SerMaxLen-O", name="max_length", is_setting=True, - is_status=False, + is_display=False, ) self._append( AdjustablePv, self._pvstr("Ctrl-Length-I"), name="length", is_setting=True @@ -74,7 +74,7 @@ class CtaSequencer(Assembly): element_count=self.max_length.get_current_value(), name=f"seq_code{eventcode}", is_setting=True, - is_status=False, + is_display=False, ) self.event_code_sequences[eventcode] = self.__dict__[f"seq_code{eventcode}"] diff --git a/eco/timing/timing_diag.py b/eco/timing/timing_diag.py index 6966289..285bbfe 100644 --- a/eco/timing/timing_diag.py +++ b/eco/timing/timing_diag.py @@ -51,7 +51,7 @@ class TimetoolBerninaUSD(Assembly): pvname_y="SARES20-MF2:MOT_2", pvname_z="SARES20-MF2:MOT_3", name="target_stages", - is_status="recursive", + is_display="recursive", ) self.target = self.target_stages.presets # self._append(MotorRecord, "SARES20-MF2:MOT_1", name="x_target", is_setting=True) @@ -65,7 +65,7 @@ class TimetoolBerninaUSD(Assembly): pvname_mirror, name="x_mirror_microscope", is_setting=True, - is_status=False, + is_display=False, ) self._append( AdjustableVirtual, @@ -74,26 +74,26 @@ class TimetoolBerninaUSD(Assembly): lambda v: self.mirror_in_position if v else self.mirror_out_position, name="mirror_in", is_setting=True, - is_status=True, + is_display=True, ) self._append( CameraBasler, pvname=microscope_pvname, name="camera_microscope", - camserver_alias = f"{name} ({microscope_pvname})", + camserver_alias=f"{name} ({microscope_pvname})", is_setting=True, - is_status=False, + is_display=False, ) self._append( - MotorRecord, pvname_zoom, name="zoom", is_setting=True, is_status=True + MotorRecord, pvname_zoom, name="zoom", is_setting=True, is_display=True ) self._append( CameraPCO, pvname=spectrometer_pvname, name="camera_spectrometer", - camserver_alias = f"{name} ({spectrometer_pvname})", + camserver_alias=f"{name} ({spectrometer_pvname})", is_setting=True, - is_status=False, + is_display=False, ) self._append( AdjustablePv, diff --git a/eco/utilities/config.py b/eco/utilities/config.py index 0381646..c8071d0 100644 --- a/eco/utilities/config.py +++ b/eco/utilities/config.py @@ -15,6 +15,7 @@ from importlib import import_module from lazy_object_proxy import Proxy as Proxy_orig from tabulate import tabulate from concurrent.futures import ThreadPoolExecutor +from threading import Thread from tqdm import tqdm from rich import progress from inspect import signature @@ -310,19 +311,40 @@ class Namespace(Assembly): print_summary=True, max_workers=5, N_cycles=4, + silent=True, ): - for i in range(N_cycles): - with ThreadPoolExecutor(max_workers=max_workers) as exc: - # for name in self.all_names: - # exc.submit( - # self.init_name, name, verbose=verbose, raise_errors=raise_errors - # ) + if silent: + print( + f"Initializeing all items in namespace {self.name} silently in background.\n Be aware of unrelated output!" + ) - # progress = Progress( - # SpinnerColumn(), - # *Progress.get_default_columns(), - # TimeElapsedColumn(), - # ) + def init(): + exc = ThreadPoolExecutor(max_workers=max_workers) + jobs = [ + exc.submit( + self.init_name, name, verbose=verbose, raise_errors=raise_errors + ) + for name in self.all_names + ] + exc.shutdown(wait=True) + exc = ThreadPoolExecutor(max_workers=1) + jobs = [ + exc.submit( + self.init_name, name, verbose=verbose, raise_errors=raise_errors + ) + for name in (self.all_names - self.initialized_names) + ] + exc.shutdown(wait=True) + if print_summary: + print( + f"Initialized {len(self.initialized_names)} of {len(self.all_names)}." + ) + print("Failed objects: " + ", ".join(self.lazy_names)) + + Thread(target=init).start() + else: + + with ThreadPoolExecutor(max_workers=max_workers) as exc: list( progress.track( exc.map( @@ -336,12 +358,29 @@ class Namespace(Assembly): transient=True, ) ) + print("Initializing in single thead...") + with ThreadPoolExecutor(max_workers=1) as exc: + list( + progress.track( + exc.map( + lambda name: self.init_name( + name, verbose=verbose, raise_errors=raise_errors + ), + self.all_names, + ), + description="Initializing ...", + total=len(self.all_names), + transient=True, + ) + ) + # ) + # # ) - if print_summary: - print( - f"Initialized {len(self.initialized_names)} of {len(self.all_names)}." - ) - print("Failed objects: " + ", ".join(self.lazy_names)) + if print_summary: + print( + f"Initialized {len(self.initialized_names)} of {len(self.all_names)}." + ) + print("Failed objects: " + ", ".join(self.lazy_names)) # if verbose: # print(("Configuring %s " % (name)).ljust(25), end="") @@ -396,7 +435,7 @@ class Namespace(Assembly): obj_initialized, name=name, is_setting=True, - is_status="recursive", + is_display="recursive", call_obj=False, ) if self.alias_namespace and hasattr(obj_initialized, "alias"): @@ -436,7 +475,7 @@ class Namespace(Assembly): obj, name=name, is_setting=True, - is_status="recursive", + is_display="recursive", call_obj=False, ) if self.alias_namespace and hasattr(obj, "alias"): diff --git a/eco/xdiagnostics/bsen_usd.py b/eco/xdiagnostics/bsen_usd.py index 50b132f..fe183a2 100644 --- a/eco/xdiagnostics/bsen_usd.py +++ b/eco/xdiagnostics/bsen_usd.py @@ -84,14 +84,14 @@ class Bsen(Assembly): "SARES20-PROF141-M1", name="camera_microscope", is_setting=True, - is_status=False, + is_display=False, ) self._append( CameraPCO, "SARES20-CAMS142-M5", name="camera_spectrometer", is_setting=True, - is_status=False, + is_display=False, ) self._append( AdjustablePv, diff --git a/eco/xdiagnostics/intensity_monitors.py b/eco/xdiagnostics/intensity_monitors.py index a3f464a..59722e2 100755 --- a/eco/xdiagnostics/intensity_monitors.py +++ b/eco/xdiagnostics/intensity_monitors.py @@ -17,7 +17,7 @@ class GasDetector(Assembly): DetectorPvDataStream, "SARFE10-PBPG050:HAMP-INTENSITY-CAL", name="fast_calibrated", - is_status=True, + is_display=True, ) @@ -30,14 +30,14 @@ class FeDigitiza(Assembly): pvname + "-WD-gain", name="gain", is_setting=True, - is_status=True, + is_display=True, ) self._append( AdjustablePv, pvname + "-HV_SET", name="bias", is_setting=True, - is_status=True, + is_display=True, ) # self.channels = [ @@ -70,32 +70,36 @@ class SolidTargetDetectorPBPS_assi(Assembly): pvname + ":PROBE_SP", name="target", is_setting=True, - is_status=True, + is_display=True, ) self._append( MotorRecord, pvname + ":MOTOR_X1", name="x_diodes", is_setting=True, - is_status=True, + is_display=True, ) self._append( MotorRecord, pvname + ":MOTOR_Y1", name="y_diodes", is_setting=True, - is_status=True, + is_display=True, ) self._append( MotorRecord, pvname + ":MOTOR_PROBE", name="y_targets", is_setting=True, - is_status=False, + is_display=False, ) for chdigi, tp in pvname_fedigitizerchannels.items(): self._append( - FeDigitiza, tp, name="diode_" + chdigi, is_setting=True, is_status=False + FeDigitiza, + tp, + name="diode_" + chdigi, + is_setting=True, + is_display=False, ) self._append( AdjustableVirtual, @@ -107,7 +111,7 @@ class SolidTargetDetectorPBPS_assi(Assembly): lambda x: (x, x, x, x), name="bias", is_setting=False, - is_status=True, + is_display=True, ) self._append( AdjustableVirtual, @@ -119,7 +123,7 @@ class SolidTargetDetectorPBPS_assi(Assembly): lambda x: (x, x, x, x), name="gain", is_setting=False, - is_status=True, + is_display=True, ) diff --git a/eco/xdiagnostics/profile_monitors.py b/eco/xdiagnostics/profile_monitors.py index c93929a..a5f944b 100755 --- a/eco/xdiagnostics/profile_monitors.py +++ b/eco/xdiagnostics/profile_monitors.py @@ -25,7 +25,13 @@ class Pprm(Assembly): is_setting=True, ) self.camCA = CameraCA(pvname_camera) - self._append(CameraBasler, pvname_camera, camserver_alias=f"{name} ({pvname_camera})", name="camera", is_setting=True) + self._append( + CameraBasler, + pvname_camera, + camserver_alias=f"{name} ({pvname_camera})", + name="camera", + is_setting=True, + ) self._append( AdjustablePvEnum, self.pvname + ":LED", name="led", is_setting=True ) @@ -103,7 +109,7 @@ class ProfKbBernina(Assembly): pvname_y="SARES20-MF2:MOT_2", pvname_z="SARES20-MF2:MOT_3", name="target_stages", - is_status="recursive", + is_display="recursive", ) self.target = self.target_stages.presets @@ -130,7 +136,7 @@ class ProfKbBernina(Assembly): pvname_mirror, name="x_mirror_microscope", is_setting=True, - is_status=False, + is_display=False, ) self._append( AdjustableVirtual, @@ -139,7 +145,7 @@ class ProfKbBernina(Assembly): lambda v: self.mirror_in_position if v else self.mirror_out_position, name="mirror_in", is_setting=True, - is_status=True, + is_display=True, ) # self.camCA = CameraCA(pvname_camera) self._append( @@ -148,10 +154,10 @@ class ProfKbBernina(Assembly): camserver_alias=f"{name} ({pvname_camera})", name="camera", is_setting=False, - is_status="recursive", + is_display="recursive", ) self._append( - MotorRecord, pvname_zoom, name="zoom", is_setting=True, is_status=True + MotorRecord, pvname_zoom, name="zoom", is_setting=True, is_display=True ) def movein_keep_target(self, wait=False): @@ -200,7 +206,7 @@ class Pprm_dsd(Assembly): camserver_alias=f"{name} ({pvname_camera})", name="camera", is_setting=False, - is_status="recursive", + is_display="recursive", ) self._append( MotorRecord, self.pvname + ":MOTOR_ZOOM", name="zoom", is_setting=True @@ -258,7 +264,7 @@ class Bernina_XEYE(Assembly): camserver_alias=f"{name} ({camera_pv})", name="camera", is_setting=True, - is_status="recursive", + is_display="recursive", ) except: print("X-Ray eye Cam not found") diff --git a/eco/xoptics/att_usd.py b/eco/xoptics/att_usd.py index 8d0d5ff..de24252 100644 --- a/eco/xoptics/att_usd.py +++ b/eco/xoptics/att_usd.py @@ -40,7 +40,7 @@ class att_usd_targets(Assembly): pvname=Id + config["id"], name=name, is_setting=True, - is_status=False, + is_display=False, ) Al = materials.Al @@ -163,18 +163,17 @@ class att_usd_targets(Assembly): return self.get_adjustable_positions_str() - - class Att_usd(Assembly): """This is an adjusted smaract record compatible version of the original att_usd by roman.""" + def __init__(self, name=None, Id=None, alias_namespace=None, xp=None): super().__init__(name=name) self.Id = Id self.E = None self.E_min = 1500 self._sleeptime = 1 - self._append(SmaractRecord,"SARES23:LIC10",name='transl_2', is_setting=True) - self._append(SmaractRecord,"SARES23:LIC3",name='transl_1', is_setting=True) + self._append(SmaractRecord, "SARES23:LIC10", name="transl_2", is_setting=True) + self._append(SmaractRecord, "SARES23:LIC3", name="transl_1", is_setting=True) self.motor_configuration = { "transl_2": { "id": "SARES23-LIC10", @@ -200,19 +199,92 @@ class Att_usd(Assembly): self._xp = xp self.E = None - Al2O3 = materials.Al2O3 - Si3N4 = materials.Amorphous(name='Si3N4', density=3440) - polyimide = materials.Amorphous(name='C35H28N2O7', density=1440) + Si3N4 = materials.Amorphous(name="Si3N4", density=3440) + polyimide = materials.Amorphous(name="C35H28N2O7", density=1440) self.targets_2 = { - "mat": np.array([Al2O3,Al2O3,Al2O3,Al2O3,Al2O3,Al2O3,Al2O3,Al2O3,Al2O3,Al2O3,Al2O3,Al2O3,Al2O3,polyimide, Al2O3]), - "d": np.array([2800, 2000, 1600, 1200, 800, 550, 420, 320, 240, 175, 125, 75, 30, 125, 0]), - "pos": np.array([38.3, 33.4, 27.7, 23.3, 18.8, 13. , 8. , 2.5,-2.8, -7.7, -12.8, -18. , -22. , -26.7, -35.]), + "mat": np.array( + [ + Al2O3, + Al2O3, + Al2O3, + Al2O3, + Al2O3, + Al2O3, + Al2O3, + Al2O3, + Al2O3, + Al2O3, + Al2O3, + Al2O3, + Al2O3, + polyimide, + Al2O3, + ] + ), + "d": np.array( + [ + 2800, + 2000, + 1600, + 1200, + 800, + 550, + 420, + 320, + 240, + 175, + 125, + 75, + 30, + 125, + 0, + ] + ), + "pos": np.array( + [ + 38.3, + 33.4, + 27.7, + 23.3, + 18.8, + 13.0, + 8.0, + 2.5, + -2.8, + -7.7, + -12.8, + -18.0, + -22.0, + -26.7, + -35.0, + ] + ), } self.targets_1 = { - "mat": np.array([Al2O3,Al2O3,Al2O3,Al2O3,Al2O3,Al2O3,Al2O3,Al2O3,Al2O3,polyimide,polyimide,polyimide, Al2O3]), - "d": np.array([2800, 1600, 800, 420, 240, 175, 125, 75, 30, 125, 50, 25, 0]), - "pos": np.array([-37.7, -32.6, -27.3, -23, -18, -13, -7.8, -3, 1.7, 7.4, 12.6, 17.6, 25]), + "mat": np.array( + [ + Al2O3, + Al2O3, + Al2O3, + Al2O3, + Al2O3, + Al2O3, + Al2O3, + Al2O3, + Al2O3, + polyimide, + polyimide, + polyimide, + Al2O3, + ] + ), + "d": np.array( + [2800, 1600, 800, 420, 240, 175, 125, 75, 30, 125, 50, 25, 0] + ), + "pos": np.array( + [-37.7, -32.6, -27.3, -23, -18, -13, -7.8, -3, 1.7, 7.4, 12.6, 17.6, 25] + ), } def _updateE(self, energy=None, check_once=False): @@ -244,10 +316,13 @@ class Att_usd(Assembly): ] ) self.targets_2["t"] = t2 - t_comb = ((np.expand_dims(t1, axis=0)).T*(np.expand_dims(t2, axis=0))).flatten() - pos_comb = np.array([[p1, p2] for p1 in self.targets_1['pos'] for p2 in self.targets_2['pos']]) - self.transmissions = {'t':t_comb, 'pos': pos_comb} - + t_comb = ( + (np.expand_dims(t1, axis=0)).T * (np.expand_dims(t2, axis=0)) + ).flatten() + pos_comb = np.array( + [[p1, p2] for p1 in self.targets_1["pos"] for p2 in self.targets_2["pos"]] + ) + self.transmissions = {"t": t_comb, "pos": pos_comb} def _find_nearest(self, a, a0): "Element in nd array `a` closest to the scalar value `a0`" @@ -263,7 +338,9 @@ class Att_usd(Assembly): self.transl_1.set_target_value(p1) self.transl_2.set_target_value(p2) print(f"Set transmission to {t:0.2E} | Moving to pos {[p1, p2]}") - while ((abs(p1 - self.transl_1.get_current_value()) > 0.05) or (abs(p2 - self.transl_2.get_current_value() > 0.05))): + while (abs(p1 - self.transl_1.get_current_value()) > 0.05) or ( + abs(p2 - self.transl_2.get_current_value() > 0.05) + ): sleep(0.1) print("transmission changed") self._xp.open() @@ -274,12 +351,12 @@ class Att_usd(Assembly): idx1, p1 = self._find_nearest( self.targets_1["pos"], self.transl_1.get_current_value() ) - t1 = self.targets_1["t"][idx1] + t1 = self.targets_1["t"][idx1] idx2, p2 = self._find_nearest( self.targets_2["pos"], self.transl_2.get_current_value() ) - t2 = self.targets_2["t"][idx2] - return t1*t2 + t2 = self.targets_2["t"][idx2] + return t1 * t2 def set_stage_config(self): for name, config in self.motor_configuration.items(): @@ -346,7 +423,6 @@ class Att_usd(Assembly): return self.get_adjustable_positions_str() - class att_usd(Assembly): def __init__(self, name=None, alias_namespace=None, xp=None): super().__init__(name=name) @@ -386,21 +462,95 @@ class att_usd(Assembly): pvname=config["id"], name=name, is_setting=True, - is_status=False, + is_display=False, ) Al2O3 = materials.Al2O3 - Si3N4 = materials.Amorphous(name='Si3N4', density=3440) - polyimide = materials.Amorphous(name='C35H28N2O7', density=1440) + Si3N4 = materials.Amorphous(name="Si3N4", density=3440) + polyimide = materials.Amorphous(name="C35H28N2O7", density=1440) self.targets_2 = { - "mat": np.array([Al2O3,Al2O3,Al2O3,Al2O3,Al2O3,Al2O3,Al2O3,Al2O3,Al2O3,Al2O3,Al2O3,Al2O3,Al2O3,polyimide, Al2O3]), - "d": np.array([2800, 2000, 1600, 1200, 800, 550, 420, 320, 240, 175, 125, 75, 30, 125, 0]), - "pos": np.array([38.3, 33.4, 27.7, 23.3, 18.8, 13. , 8. , 2.5,-2.8, -7.7, -12.8, -18. , -22. , -26.7, -35.]), + "mat": np.array( + [ + Al2O3, + Al2O3, + Al2O3, + Al2O3, + Al2O3, + Al2O3, + Al2O3, + Al2O3, + Al2O3, + Al2O3, + Al2O3, + Al2O3, + Al2O3, + polyimide, + Al2O3, + ] + ), + "d": np.array( + [ + 2800, + 2000, + 1600, + 1200, + 800, + 550, + 420, + 320, + 240, + 175, + 125, + 75, + 30, + 125, + 0, + ] + ), + "pos": np.array( + [ + 38.3, + 33.4, + 27.7, + 23.3, + 18.8, + 13.0, + 8.0, + 2.5, + -2.8, + -7.7, + -12.8, + -18.0, + -22.0, + -26.7, + -35.0, + ] + ), } self.targets_1 = { - "mat": np.array([Al2O3,Al2O3,Al2O3,Al2O3,Al2O3,Al2O3,Al2O3,Al2O3,Al2O3,polyimide,polyimide,polyimide, Al2O3]), - "d": np.array([2800, 1600, 800, 420, 240, 175, 125, 75, 30, 125, 50, 25, 0]), - "pos": np.array([-37.7, -32.6, -27.3, -23, -18, -13, -7.8, -3, 1.7, 7.4, 12.6, 17.6, 25]), + "mat": np.array( + [ + Al2O3, + Al2O3, + Al2O3, + Al2O3, + Al2O3, + Al2O3, + Al2O3, + Al2O3, + Al2O3, + polyimide, + polyimide, + polyimide, + Al2O3, + ] + ), + "d": np.array( + [2800, 1600, 800, 420, 240, 175, 125, 75, 30, 125, 50, 25, 0] + ), + "pos": np.array( + [-37.7, -32.6, -27.3, -23, -18, -13, -7.8, -3, 1.7, 7.4, 12.6, 17.6, 25] + ), } def _updateE(self, energy=None, check_once=False): @@ -432,10 +582,13 @@ class att_usd(Assembly): ] ) self.targets_2["t"] = t2 - t_comb = ((np.expand_dims(t1, axis=0)).T*(np.expand_dims(t2, axis=0))).flatten() - pos_comb = np.array([[p1, p2] for p1 in self.targets_1['pos'] for p2 in self.targets_2['pos']]) - self.transmissions = {'t':t_comb, 'pos': pos_comb} - + t_comb = ( + (np.expand_dims(t1, axis=0)).T * (np.expand_dims(t2, axis=0)) + ).flatten() + pos_comb = np.array( + [[p1, p2] for p1 in self.targets_1["pos"] for p2 in self.targets_2["pos"]] + ) + self.transmissions = {"t": t_comb, "pos": pos_comb} def _find_nearest(self, a, a0): "Element in nd array `a` closest to the scalar value `a0`" @@ -451,7 +604,9 @@ class att_usd(Assembly): self.transl_1.set_target_value(p1) self.transl_2.set_target_value(p2) print(f"Set transmission to {t:0.2E} | Moving to pos {[p1, p2]}") - while ((abs(p1 - self.transl_1.get_current_value()) > 0.05) or (abs(p2 - self.transl_2.get_current_value() > 0.05))): + while (abs(p1 - self.transl_1.get_current_value()) > 0.05) or ( + abs(p2 - self.transl_2.get_current_value() > 0.05) + ): sleep(0.1) print("transmission changed") self._xp.open() @@ -462,12 +617,12 @@ class att_usd(Assembly): idx1, p1 = self._find_nearest( self.targets_1["pos"], self.transl_1.get_current_value() ) - t1 = self.targets_1["t"][idx1] + t1 = self.targets_1["t"][idx1] idx2, p2 = self._find_nearest( self.targets_2["pos"], self.transl_2.get_current_value() ) - t2 = self.targets_2["t"][idx2] - return t1*t2 + t2 = self.targets_2["t"][idx2] + return t1 * t2 def set_stage_config(self): for name, config in self.motor_configuration.items(): diff --git a/eco/xoptics/attenuator_aramis.py b/eco/xoptics/attenuator_aramis.py index 280672d..ba7b17d 100755 --- a/eco/xoptics/attenuator_aramis.py +++ b/eco/xoptics/attenuator_aramis.py @@ -119,5 +119,5 @@ class AttenuatorAramisStandalone(Assembly): f"{self.pvname}:MOTOR_{n+1}", name=f"motor{n+1}", is_setting=True, - is_status=False, + is_display=False, ) diff --git a/eco/xoptics/dcm.py b/eco/xoptics/dcm.py index 1f1b439..497b1c0 100755 --- a/eco/xoptics/dcm.py +++ b/eco/xoptics/dcm.py @@ -6,7 +6,7 @@ from time import sleep import numpy as np from ..aliases import Alias, append_object_to_object from ..elements.adjustable import spec_convenience, default_representation, tweak_option -from ..epics.adjustable import AdjustablePvEnum,AdjustablePvString +from ..epics.adjustable import AdjustablePvEnum, AdjustablePvString from ..devices_general.utilities import Changer from ..elements.assembly import Assembly @@ -237,7 +237,13 @@ class EcolEnergy_new(Assembly): self._pv_val = PV(pv_val) self._pv_rb = PV(pv_rb) self._pv_diff = PV(pv_diff) - self._append(AdjustablePvString,pv_rb+'.EGU',name='unit',is_setting=False,is_status=False) + self._append( + AdjustablePvString, + pv_rb + ".EGU", + name="unit", + is_setting=False, + is_display=False, + ) def change_energy_to(self, value, tolerance=0.5): self.enable_control(0) diff --git a/eco/xoptics/kb_bernina.py b/eco/xoptics/kb_bernina.py index 1a84329..9a7f2ff 100644 --- a/eco/xoptics/kb_bernina.py +++ b/eco/xoptics/kb_bernina.py @@ -32,10 +32,10 @@ class KBMirrorBernina_new(Assembly): super().__init__(name=name) self._append( - KbVer, pvname_ver, name="ver", is_setting=True, is_status="recursive" + KbVer, pvname_ver, name="ver", is_setting=True, is_display="recursive" ) self._append( - KbHor, pvname_hor, name="hor", is_setting=True, is_status="recursive" + KbHor, pvname_hor, name="hor", is_setting=True, is_display="recursive" ) self.diffractometer = diffractometer @@ -80,10 +80,10 @@ class KBMirrorBernina_new(Assembly): c = lam / np.pi * 1e3 w0 = lambda w, z: ( - w ** 2 - (w ** 4 - (2 * c * z) ** 2) ** 0.5 + w**2 - (w**4 - (2 * c * z) ** 2) ** 0.5 ) ** 0.5 / np.sqrt(2) - w = lambda w0, z: (w0 ** 2 + (c * z / w0) ** 2) ** 0.5 - zr = lambda w0: w0 ** 2 / c + w = lambda w0, z: (w0**2 + (c * z / w0) ** 2) ** 0.5 + zr = lambda w0: w0**2 / c fwhm_z = lambda z, w0: w(w0, z) / fwhm_fac w0_hor = w0(fwhm_hor * fwhm_fac, self.d_kbhor + z_fochor) @@ -316,10 +316,10 @@ class KBMirrorBernina: c = lam / np.pi * 1e3 w0 = lambda w, z: ( - w ** 2 - (w ** 4 - (2 * c * z) ** 2) ** 0.5 + w**2 - (w**4 - (2 * c * z) ** 2) ** 0.5 ) ** 0.5 / np.sqrt(2) - w = lambda w0, z: (w0 ** 2 + (c * z / w0) ** 2) ** 0.5 - zr = lambda w0: w0 ** 2 / c + w = lambda w0, z: (w0**2 + (c * z / w0) ** 2) ** 0.5 + zr = lambda w0: w0**2 / c fwhm_z = lambda z, w0: w(w0, z) / fwhm_fac w0_hor = w0(fwhm_hor * fwhm_fac, self.d_kbhor + z_fochor) diff --git a/eco/xoptics/kb_mirrors.py b/eco/xoptics/kb_mirrors.py index 64239f2..a3e38fc 100644 --- a/eco/xoptics/kb_mirrors.py +++ b/eco/xoptics/kb_mirrors.py @@ -10,23 +10,27 @@ class KbVer(Assembly): self.pvname = pvname super().__init__(name=name) self._append( - MotorRecord, pvname + ":W_X", name="x", is_setting=False, is_status=True + MotorRecord, pvname + ":W_X", name="x", is_setting=False, is_display=True ) self._append( - MotorRecord, pvname + ":W_Y", name="y", is_setting=False, is_status=True + MotorRecord, pvname + ":W_Y", name="y", is_setting=False, is_display=True ) self._append( MotorRecord, pvname + ":W_RX", name="pitch", is_setting=False, - is_status=True, + is_display=True, ) self._append( - MotorRecord, pvname + ":W_RZ", name="roll", is_setting=False, is_status=True + MotorRecord, + pvname + ":W_RZ", + name="roll", + is_setting=False, + is_display=True, ) self._append( - MotorRecord, pvname + ":W_RY", name="yaw", is_setting=False, is_status=True + MotorRecord, pvname + ":W_RY", name="yaw", is_setting=False, is_display=True ) self._append(MotorRecord, pvname + ":BU", name="bend1", is_setting=True) self._append(MotorRecord, pvname + ":BD", name="bend2", is_setting=True) @@ -37,7 +41,7 @@ class KbVer(Assembly): lambda mn: self._get_benders_set_mean(mn), name="bender_mean", is_setting=False, - is_status=True, + is_display=True, ) self._append( AdjustableVirtual, @@ -46,7 +50,7 @@ class KbVer(Assembly): lambda mn: self._get_benders_set_diff(mn), name="bender_diff", is_setting=False, - is_status=True, + is_display=True, ) self._append( AdjustablePv, @@ -98,23 +102,27 @@ class KbHor(Assembly): self.pvname = pvname super().__init__(name=name) self._append( - MotorRecord, pvname + ":W_X", name="x", is_setting=False, is_status=True + MotorRecord, pvname + ":W_X", name="x", is_setting=False, is_display=True ) self._append( - MotorRecord, pvname + ":W_Y", name="y", is_setting=False, is_status=True + MotorRecord, pvname + ":W_Y", name="y", is_setting=False, is_display=True ) self._append( MotorRecord, pvname + ":W_RY", name="pitch", is_setting=False, - is_status=True, + is_display=True, ) self._append( - MotorRecord, pvname + ":W_RZ", name="roll", is_setting=False, is_status=True + MotorRecord, + pvname + ":W_RZ", + name="roll", + is_setting=False, + is_display=True, ) self._append( - MotorRecord, pvname + ":W_RX", name="yaw", is_setting=False, is_status=True + MotorRecord, pvname + ":W_RX", name="yaw", is_setting=False, is_display=True ) self._append(MotorRecord, pvname + ":BU", name="bend1", is_setting=True) self._append(MotorRecord, pvname + ":BD", name="bend2", is_setting=True) @@ -125,7 +133,7 @@ class KbHor(Assembly): lambda mn: self._get_benders_set_mean(mn), name="bender_mean", is_setting=False, - is_status=True, + is_display=True, ) self._append( AdjustableVirtual, @@ -134,7 +142,7 @@ class KbHor(Assembly): lambda mn: self._get_benders_set_diff(mn), name="bender_diff", is_setting=False, - is_status=True, + is_display=True, ) self._append( AdjustablePv, diff --git a/eco/xoptics/offsetMirrors_new.py b/eco/xoptics/offsetMirrors_new.py index 5bec5ac..c290d27 100644 --- a/eco/xoptics/offsetMirrors_new.py +++ b/eco/xoptics/offsetMirrors_new.py @@ -37,12 +37,12 @@ class OffsetMirrorsBernina(Assembly): "SAROP21-OOMV092", name="mirr1", is_setting=True, - is_status="recursive", + is_display="recursive", ) self._append( OffsetMirror, "SAROP21-OOMV096", name="mirr2", is_setting=True, - is_status="recursive", + is_display="recursive", ) diff --git a/eco/xoptics/slits.py b/eco/xoptics/slits.py index 117f4f5..ee89dbb 100755 --- a/eco/xoptics/slits.py +++ b/eco/xoptics/slits.py @@ -52,56 +52,56 @@ class JJSlitUnd(Assembly): MotorRecord, self.pvname + ":MOTOR_AX1", is_setting=True, - is_status=False, + is_display=False, name="_blade_ax1", ) self._append( MotorRecord, self.pvname + ":MOTOR_AX2", is_setting=True, - is_status=False, + is_display=False, name="_blade_ax2", ) self._append( MotorRecord, self.pvname + ":MOTOR_AY1", is_setting=True, - is_status=False, + is_display=False, name="_blade_ay1", ) self._append( MotorRecord, self.pvname + ":MOTOR_AY2", is_setting=True, - is_status=False, + is_display=False, name="_blade_ay2", ) self._append( MotorRecord, self.pvname + ":MOTOR_BX1", is_setting=True, - is_status=False, + is_display=False, name="_blade_bx1", ) self._append( MotorRecord, self.pvname + ":MOTOR_BX2", is_setting=True, - is_status=False, + is_display=False, name="_blade_bx2", ) self._append( MotorRecord, self.pvname + ":MOTOR_BY1", is_setting=True, - is_status=False, + is_display=False, name="_blade_by1", ) self._append( MotorRecord, self.pvname + ":MOTOR_BY2", is_setting=True, - is_status=False, + is_display=False, name="_blade_by2", ) self._append( @@ -113,7 +113,7 @@ class JJSlitUnd(Assembly): for tb in [self._blade_ax1(), self._blade_ax2()] ], is_setting=True, - is_status=False, + is_display=False, name="_pos_ax", ) self._append( @@ -125,7 +125,7 @@ class JJSlitUnd(Assembly): for tb in [self._blade_ay1(), self._blade_ay2()] ], is_setting=True, - is_status=False, + is_display=False, name="_pos_ay", ) self._append( @@ -137,7 +137,7 @@ class JJSlitUnd(Assembly): for tb in [self._blade_bx1(), self._blade_bx2()] ], is_setting=True, - is_status=False, + is_display=False, name="_pos_bx", ) self._append( @@ -149,7 +149,7 @@ class JJSlitUnd(Assembly): for tb in [self._blade_by1(), self._blade_by2()] ], is_setting=True, - is_status=False, + is_display=False, name="_pos_by", ) @@ -159,7 +159,7 @@ class JJSlitUnd(Assembly): lambda x1, x2: (x2 - x1), lambda gap: [(sign * gap / 2 + self._pos_ax()) for sign in [-1, 1]], is_setting=True, - is_status=False, + is_display=False, name="_gap_ax", ) self._append( @@ -168,7 +168,7 @@ class JJSlitUnd(Assembly): lambda x1, x2: (x2 - x1), lambda gap: [(sign * gap / 2 + self._pos_ay()) for sign in [-1, 1]], is_setting=True, - is_status=False, + is_display=False, name="_gap_ay", ) self._append( @@ -177,7 +177,7 @@ class JJSlitUnd(Assembly): lambda x1, x2: (x2 - x1), lambda gap: [(sign * gap / 2 + self._pos_bx()) for sign in [-1, 1]], is_setting=True, - is_status=False, + is_display=False, name="_gap_bx", ) self._append( @@ -186,7 +186,7 @@ class JJSlitUnd(Assembly): lambda x1, x2: (x2 - x1), lambda gap: [(sign * gap / 2 + self._pos_by()) for sign in [-1, 1]], is_setting=True, - is_status=False, + is_display=False, name="_gap_by", ) self._append( @@ -195,7 +195,7 @@ class JJSlitUnd(Assembly): lambda a, b: a, lambda v: (v, v), is_setting=False, - is_status=True, + is_display=True, name="hpos", ) self._append( @@ -204,7 +204,7 @@ class JJSlitUnd(Assembly): lambda a, b: a, lambda v: (v, v), is_setting=False, - is_status=True, + is_display=True, name="hgap", ) self._append( @@ -213,7 +213,7 @@ class JJSlitUnd(Assembly): lambda a, b: a, lambda v: (v, v), is_setting=False, - is_status=True, + is_display=True, name="vpos", ) self._append( @@ -222,7 +222,7 @@ class JJSlitUnd(Assembly): lambda a, b: a, lambda v: (v, v), is_setting=False, - is_status=True, + is_display=True, name="vgap", ) @@ -806,28 +806,28 @@ class SlitBladesGeneral(Assembly): **def_blade_up["kwargs"], name="up", is_setting=True, - is_status=False, + is_display=False, ) self._append( *def_blade_down["args"], **def_blade_down["kwargs"], name="down", is_setting=True, - is_status=False, + is_display=False, ) self._append( *def_blade_left["args"], **def_blade_left["kwargs"], name="left", is_setting=True, - is_status=False, + is_display=False, ) self._append( *def_blade_right["args"], **def_blade_right["kwargs"], name="right", is_setting=True, - is_status=False, + is_display=False, ) self.blade_motors = [self.up, self.down, self.left, self.right]