feat: guard beam steering and auto exposure #169
@@ -28,6 +28,9 @@ class BecMacros(ABC):
|
||||
@staticmethod
|
||||
@abstractmethod
|
||||
def mono_pitch_scan(plot=True): ...
|
||||
@staticmethod
|
||||
@abstractmethod
|
||||
def auto_exposure(): ...
|
||||
|
||||
|
||||
class Geometry(ABC):
|
||||
|
||||
@@ -26,6 +26,8 @@ class SimulatedBecMacros(BecMacros):
|
||||
def get_current_energy(): ...
|
||||
@staticmethod
|
||||
def mono_pitch_scan(plot=True): ...
|
||||
@staticmethod
|
||||
def auto_exposure(): ...
|
||||
|
||||
|
||||
class SimulatedDispatch(DefaultDispatch):
|
||||
|
||||
@@ -15,6 +15,9 @@ class X06daBecMacros(BecMacros):
|
||||
from pxiii_bec.macros.init_beamline import ( # pyright: ignore[reportMissingImports, reportMissingModuleSource]
|
||||
init_beamline_environment,
|
||||
)
|
||||
from pxiii_bec.macros.katscripts import (
|
||||
auto_exposure, # pyright: ignore[reportMissingImports, reportMissingModuleSource]
|
||||
)
|
||||
from pxiii_bec.macros.pxiii_energy import ( # pyright: ignore[reportMissingImports, reportMissingModuleSource]
|
||||
bl_energy,
|
||||
get_current_energy,
|
||||
@@ -31,6 +34,7 @@ class X06daBecMacros(BecMacros):
|
||||
self.bl_energy = _bl_energy
|
||||
self.get_current_energy = get_current_energy
|
||||
self.mono_pitch_scan = mono_pitch_scan
|
||||
self.auto_exposure = auto_exposure
|
||||
|
||||
@staticmethod
|
||||
def save_and_reload() -> tuple[Any, Any]: ...
|
||||
@@ -44,6 +48,8 @@ class X06daBecMacros(BecMacros):
|
||||
def get_current_energy(): ...
|
||||
@staticmethod
|
||||
def mono_pitch_scan(plot=True): ...
|
||||
@staticmethod
|
||||
def auto_exposure(): ...
|
||||
|
||||
|
||||
class X06daDispatch(DefaultDispatch):
|
||||
|
||||
@@ -8,12 +8,17 @@ from aare.beamline_dispatch.protocols import BecMacros
|
||||
|
||||
class X10SaBecMacros(BecMacros):
|
||||
def __init__(self) -> None:
|
||||
from pxii_bec.macros.build_devices import ( # type: ignore
|
||||
from pxii_bec.macros.build_devices import ( # pyright: ignore[reportMissingImports, reportMissingModuleSource]
|
||||
save_and_reload,
|
||||
save_current_position,
|
||||
)
|
||||
from pxii_bec.macros.init_beamline import init_beamline_environment # type: ignore
|
||||
from pxii_bec.macros.pxii_energy import ( # type: ignore
|
||||
from pxii_bec.macros.init_beamline import ( # pyright: ignore[reportMissingImports, reportMissingModuleSource]
|
||||
init_beamline_environment,
|
||||
)
|
||||
from pxii_bec.macros.katscripts import ( # pyright: ignore[reportMissingImports, reportMissingModuleSource]
|
||||
auto_exposure,
|
||||
)
|
||||
from pxii_bec.macros.pxii_energy import ( # pyright: ignore[reportMissingImports, reportMissingModuleSource]
|
||||
bl_energy,
|
||||
get_current_energy,
|
||||
mono_pitch_scan,
|
||||
@@ -25,6 +30,7 @@ class X10SaBecMacros(BecMacros):
|
||||
self.bl_energy = bl_energy
|
||||
self.get_current_energy = get_current_energy
|
||||
self.mono_pitch_scan = mono_pitch_scan
|
||||
self.auto_exposure = auto_exposure
|
||||
|
||||
@staticmethod
|
||||
def save_and_reload() -> tuple[Any, Any]: ...
|
||||
@@ -38,6 +44,8 @@ class X10SaBecMacros(BecMacros):
|
||||
def get_current_energy(): ...
|
||||
@staticmethod
|
||||
def mono_pitch_scan(plot=True): ...
|
||||
@staticmethod
|
||||
def auto_exposure(): ...
|
||||
|
||||
|
||||
class X10saDispatch(DefaultDispatch):
|
||||
|
||||
@@ -17,6 +17,7 @@ from aarecommon.config.logger_events import (
|
||||
sample_log_context,
|
||||
)
|
||||
from aarecommon.errors.exception_handler import (
|
||||
AareException,
|
||||
AerotechCommunicationError,
|
||||
AutoRasterSampleSkipped,
|
||||
BeamlineBusyException,
|
||||
@@ -3471,7 +3472,13 @@ class AareDAQ:
|
||||
if "beam_steering" not in self._devs.bec_worker.dev:
|
||||
raise BECCommunicationError("Beam steering device does not exist in the BEC config.")
|
||||
self._cfg.try_set_busy(timeout=360)
|
||||
|
||||
try:
|
||||
if not self.shutter:
|
||||
raise AareException(
|
||||
"Shutter not open! Please open the shutter before running beam steering."
|
||||
)
|
||||
self._dispatch.bec_macros.auto_exposure()
|
||||
if x is not None:
|
||||
self._devs.bec_worker.dev.beam_steering.sample_loc_x_px.set(x).wait()
|
||||
if y is not None:
|
||||
|
||||
Reference in New Issue
Block a user