feat: extend beamline dispatch with geo class
This commit is contained in:
@@ -13,7 +13,7 @@ def get_beamline_dispatch() -> BeamlineDispatch:
|
||||
case MXBeamline.X06DA:
|
||||
from .x06da import X06daDispatch
|
||||
|
||||
return X06daDispatch()
|
||||
return X06daDispatch(MXBeamline.X06DA)
|
||||
case MXBeamline.X06SA:
|
||||
from .x06sa import X06saDispatch
|
||||
|
||||
@@ -21,4 +21,4 @@ def get_beamline_dispatch() -> BeamlineDispatch:
|
||||
case MXBeamline.X10SA:
|
||||
from .x10sa import X10saDispatch
|
||||
|
||||
return X10saDispatch()
|
||||
return X10saDispatch(MXBeamline.X10SA)
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
import os
|
||||
|
||||
from aare.beamline_dispatch.protocols import AuthDispatch, BeamlineDispatch
|
||||
from aarecommon.config.beamline import MXBeamline
|
||||
from aarecommon.models.beam_centre import BeamCentre
|
||||
|
||||
from aare.beamline_dispatch.protocols import AuthDispatch, BeamlineDispatch, Geometry
|
||||
|
||||
|
||||
class DefaultAuthDispatch(AuthDispatch):
|
||||
@@ -12,13 +15,28 @@ class DefaultAuthDispatch(AuthDispatch):
|
||||
return key
|
||||
|
||||
|
||||
class DefaultGeometry(Geometry):
|
||||
def __init__(self, beamline: MXBeamline) -> None:
|
||||
super().__init__()
|
||||
self._model = BeamCentre
|
||||
self._beamline = beamline
|
||||
|
||||
@property
|
||||
def beam_centre_model(self) -> BeamCentre: ...
|
||||
|
||||
|
||||
class DefaultDispatch(BeamlineDispatch):
|
||||
"""Default implementation for anything which can vary between beamlines and/or simulation.
|
||||
Should be safe and fail rather than assuming anything."""
|
||||
|
||||
def __init__(self) -> None:
|
||||
def __init__(self, beamline: MXBeamline) -> None:
|
||||
self._auth = DefaultAuthDispatch()
|
||||
self._geo = DefaultGeometry(beamline=beamline)
|
||||
|
||||
@property
|
||||
def auth(self):
|
||||
return self._auth
|
||||
|
||||
@property
|
||||
def geo(self):
|
||||
return self._geo
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
from abc import ABC, abstractmethod
|
||||
from typing import Any
|
||||
|
||||
from aarecommon.models.beam_centre import BeamCentre
|
||||
|
||||
|
||||
class AuthDispatch(ABC):
|
||||
@abstractmethod
|
||||
@@ -28,6 +30,12 @@ class BecMacros(ABC):
|
||||
def mono_pitch_scan(plot=True): ...
|
||||
|
||||
|
||||
class Geometry(ABC):
|
||||
@property
|
||||
@abstractmethod
|
||||
def beam_centre_model(self) -> BeamCentre: ...
|
||||
|
||||
|
||||
class BeamlineDispatch(ABC):
|
||||
@property
|
||||
@abstractmethod
|
||||
@@ -35,3 +43,6 @@ class BeamlineDispatch(ABC):
|
||||
@property
|
||||
@abstractmethod
|
||||
def bec_macros(self) -> BecMacros: ...
|
||||
@property
|
||||
@abstractmethod
|
||||
def geo(self) -> Geometry: ...
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
from typing import Any
|
||||
|
||||
from aarecommon.config.beamline import MXBeamline
|
||||
|
||||
from aare.beamline_dispatch.default.beamline_dispatch import DefaultDispatch
|
||||
from aare.beamline_dispatch.protocols import BecMacros
|
||||
|
||||
@@ -45,8 +47,8 @@ class X06daBecMacros(BecMacros):
|
||||
|
||||
|
||||
class X06daDispatch(DefaultDispatch):
|
||||
def __init__(self) -> None:
|
||||
super().__init__()
|
||||
def __init__(self, beamline: MXBeamline) -> None:
|
||||
super().__init__(beamline=beamline)
|
||||
self._bec_macros = X06daBecMacros()
|
||||
|
||||
@property
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
from typing import Any
|
||||
|
||||
from aarecommon.config.beamline import MXBeamline
|
||||
|
||||
from aare.beamline_dispatch.default.beamline_dispatch import DefaultDispatch
|
||||
from aare.beamline_dispatch.protocols import BecMacros
|
||||
|
||||
@@ -39,8 +41,8 @@ class X10SaBecMacros(BecMacros):
|
||||
|
||||
|
||||
class X10saDispatch(DefaultDispatch):
|
||||
def __init__(self) -> None:
|
||||
super().__init__()
|
||||
def __init__(self, beamline: MXBeamline) -> None:
|
||||
super().__init__(beamline=beamline)
|
||||
self._bec_macros = X10SaBecMacros()
|
||||
|
||||
@property
|
||||
|
||||
Reference in New Issue
Block a user