From 91c3e63983c7aae13aed72aa6f248bb00db53664 Mon Sep 17 00:00:00 2001 From: Roman Mankowsky Date: Tue, 26 Jan 2021 14:19:13 +0100 Subject: [PATCH] reorganisation in bernina --- eco/bernina/bernina.py | 63 ++++++++++++++++++++++++++++++++++++++++- eco/utilities/config.py | 23 +++++++++++++++ 2 files changed, 85 insertions(+), 1 deletion(-) diff --git a/eco/bernina/bernina.py b/eco/bernina/bernina.py index 98f3543..0ebc280 100644 --- a/eco/bernina/bernina.py +++ b/eco/bernina/bernina.py @@ -38,14 +38,75 @@ namespace.append_obj( name="cam_south", module_name="eco.devices_general.cameras_ptz", ) + +##################################################################################################### +## more temporary devices will be outcoupled to temorary module. + +namespace.append_obj( + "AxisPTZ", + "bernina-cam-mobile", + lazy=True, + name="cam_mob", + module_name="eco.devices_general.cameras_ptz", +) + namespace.append_obj( "BerninaInlineMicroscope", pvname_camera="SARES20-CAMS142-M3", lazy=True, - name="inline_microscope", + name="samplecam_inline", module_name="eco.microscopes", ) +namespace.append_obj( + "CameraBasler", + "SARES20-CAMS142-C2", + lazy=True, + name="samplecam_sideview", + module_name="eco.devices_general.cameras_swissfel", +) + +namespace.append_obj( + "CameraBasler", + "SARES20-CAMS142-C3", + lazy=True, + name="samplecam_xrd", + module_name="eco.devices_general.cameras_swissfel", +) + +namespace.append_obj( + "PaseShifterAramis", + "SLAAR02-TSPL-EPL", + lazy=True, + name="phase_shifter", + module_name="eco.devices_general.timing", +) + +# will be split in permanent and temporary +namespace.append_obj( + "Laser_Exp", + lazy=True, + name="las", + module_name="eco.loptics.bernina_experiment", + Id="SLAAR21-LMOT", + smar_config=config_berninamesp["las_smar_config"], +) + + +# { +# "args": [], +# "name": "cams_qioptiq", +# "z_und": 142, +# "desc": "Qioptic sample viewer in Bernina hutch", +# "type": "eco.endstations.bernina_cameras:Qioptiq", +# "kwargs": { +# "bshost": "sf-daqsync-01.psi.ch", +# "bsport": 11149, +# "zoomstage_pv": config["cams_qioptiq"]["zoomstage_pv"], +# "camera_pv": config["cams_qioptiq"]["camera_pv"], +# }, +# }, + # def __getattr__(*args, **kwargs)a # print("called getattr") diff --git a/eco/utilities/config.py b/eco/utilities/config.py index 05d5574..46ee8cc 100644 --- a/eco/utilities/config.py +++ b/eco/utilities/config.py @@ -274,6 +274,29 @@ class Namespace(object): def all_names(self): return self.initialized_names | self.lazy_names + def init_all(self, verbose=True, raise_errors=False): + for name in self.all_names: + if verbose: + print(("Configuring %s " % (name)).ljust(25), end="") + sys.stdout.flush() + # if verbose: + # print(("(%s)" % (name)).ljust(25), end="") + # sys.stdout.flush() + try: + dir(self.get_obj(name)) + + if verbose: + print((_color.GREEN + "OK" + _color.RESET).rjust(5)) + sys.stdout.flush() + + except Exception as expt: + # tb = traceback.format_exc() + if verbose: + print((_color.RED + "FAILED" + _color.RESET).rjust(5)) + # print(sys.exc_info()) + if raise_errors: + raise expt + def append_obj( self, obj_factory, *args, lazy=False, name=None, module_name=None, **kwargs ):