added inline microscope bernina

This commit is contained in:
2021-01-25 12:39:59 +01:00
parent f2496916f1
commit 780629ca11
5 changed files with 115 additions and 2 deletions
+44
View File
@@ -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
+4 -1
View File
@@ -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)
+1 -1
View File
@@ -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,
+1
View File
@@ -0,0 +1 @@
from .microscopes import *
+65
View File
@@ -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)