diff --git a/eco/acquisition/scan_nd.py b/eco/acquisition/scan_nd.py new file mode 100644 index 0000000..3655e24 --- /dev/null +++ b/eco/acquisition/scan_nd.py @@ -0,0 +1,44 @@ +from .scan import Scan + + +# class Scan: +# def __init__( +# self, +# adjustables, +# values, +# counterCallers, +# fina, +# Npulses=100, +# basepath="", +# scan_info_dir="", +# checker=None, +# scan_directories=False, +# callbackStartStep=None, +# checker_sleep_time=0.2, +# return_at_end="question", +# run_table=None, +# elog=None, +# ): + + +class ScanND: + def __init__( + self, + adjustables, + arrays, + counters, + fina, + Npulses=100, + basepath="", + Npulses=100, + basepath="", + scan_info_dir="", + checker=None, + scan_directories=False, + callbackStartStep=None, + checker_sleep_time=0.2, + return_at_end="question", + run_table=None, + elog=None, + ): + pass diff --git a/eco/bernina/bernina.py b/eco/bernina/bernina.py index 3fca0c6..efd7ee3 100644 --- a/eco/bernina/bernina.py +++ b/eco/bernina/bernina.py @@ -1,5 +1,5 @@ from .config import components -from .config import config as config_bernina +from .config import config as config_berninamesp from ..utilities.config import Namespace from ..aliases import NamespaceCollection @@ -10,6 +10,9 @@ namespace = Namespace( namespace.alias_namespace.data = [] # adding all stuff from the config components the "old" way of configuring. +# whatever is added, it is available by the configured name in this module +# afterwards, and can be used immediately, e.g. as input argument for the next thing. + for tk in components: namespace.append_obj_from_config(tk, lazy=True) diff --git a/eco/devices_general/cameras_swissfel.py b/eco/devices_general/cameras_swissfel.py index 28d0d3a..288544f 100644 --- a/eco/devices_general/cameras_swissfel.py +++ b/eco/devices_general/cameras_swissfel.py @@ -89,7 +89,7 @@ class CameraBasler(Assembly): super().__init__(name=name) self.pvname = pvname if not camserver_alias: - camserver_alias = self.alias.get_full_name() + f"({pvname})" + camserver_alias = self.alias.get_full_name() + f" ({pvname})" self._append( CamserverConfig, self.pvname, diff --git a/eco/microscopes/__init__.py b/eco/microscopes/__init__.py new file mode 100644 index 0000000..c495d44 --- /dev/null +++ b/eco/microscopes/__init__.py @@ -0,0 +1 @@ +from .microscopes import * \ No newline at end of file diff --git a/eco/microscopes/microscopes.py b/eco/microscopes/microscopes.py new file mode 100644 index 0000000..0158bfd --- /dev/null +++ b/eco/microscopes/microscopes.py @@ -0,0 +1,65 @@ +from ..elements.assembly import Assembly +from ..devices_general.cameras_swissfel import CameraBasler +from ..devices_general.adjustable import PvRecord, AdjustableVirtual, spec_convenience +from epics import PV +import numpy as np + + +class BerninaInlineMicroscope(Assembly): + def __init__( + self, + pvname_camera="", + camserver_alias="inline_microscope", + # camserver_alias=None, + name="inline_microscope", + ): + super().__init__(name=name) + self._append( + CameraBasler, + pvname_camera, + camserver_alias=camserver_alias, + name="camera", + is_setting=True, + ) + self._append(OptoSigmaZoom, name="zoom", is_setting=[True]) + + # def zoom + + +@spec_convenience +class OptoSigmaZoom(Assembly): + def __init__( + self, + pv_get_position="SARES20-OPSI:MOT_RB.VAL", + pv_set_position="SARES20-OPSI:MOT_SP.VAL", + pv_commands="SARES20-OPSI:debug.VAL", + name=None, + ): + super().__init__(name=name) + self.settings.append(self) + self._append( + PvRecord, + pv_set_position, + pv_get_position, + accuracy=1, + name="zoom_raw", + is_setting=False, + ) + self.command_pv = PV(pv_commands) + self._append( + AdjustableVirtual, + [self.zoom_raw], + lambda x: abs(round(x / 4260 * 100) - 100), + lambda x: round(abs(x - 100) / 100 * 4260), + name="zoom", + is_setting=False, + ) + + def home(self): + self.command_pv.put("H:1") + + def get_current_value(self): + return self.zoom.get_current_value() + + def set_target_value(self, value, **kwargs): + return self.zoom.set_target_value(value, **kwargs)