fix: separate detector tilt geometry per beamline
This commit is contained in:
@@ -38,6 +38,11 @@ class Geometry(ABC):
|
||||
@abstractmethod
|
||||
def beam_centre_model(self) -> BeamCenterFromDetectorStage: ...
|
||||
|
||||
@property
|
||||
@abstractmethod
|
||||
def detector_tilt(self) -> tuple[float, float]:
|
||||
"""A tuple of PONI rot1 and rot2 in radians"""
|
||||
|
||||
|
||||
class BeamlineDispatch(ABC):
|
||||
@property
|
||||
|
||||
@@ -2,7 +2,7 @@ from typing import Any
|
||||
|
||||
from aarecommon.config.beamline import MXBeamline
|
||||
|
||||
from aare.beamline_dispatch.default.beamline_dispatch import DefaultDispatch
|
||||
from aare.beamline_dispatch.default.beamline_dispatch import DefaultDispatch, DefaultGeometry
|
||||
from aare.beamline_dispatch.protocols import BecMacros
|
||||
|
||||
|
||||
@@ -51,13 +51,18 @@ class X06daBecMacros(BecMacros):
|
||||
@staticmethod
|
||||
def auto_exposure(): ...
|
||||
|
||||
# Add to Geo
|
||||
# poni_rot1_rad=-0.001396263,
|
||||
# poni_rot2_rad=-0.003839724,
|
||||
|
||||
class X06daGeometry(DefaultGeometry):
|
||||
@property
|
||||
def detector_tilt(self) -> tuple[float, float]:
|
||||
poni_rot1_rad = -0.001396263
|
||||
poni_rot2_rad = -0.003839724
|
||||
return poni_rot1_rad, poni_rot2_rad
|
||||
|
||||
|
||||
class X06daDispatch(DefaultDispatch):
|
||||
def __init__(self, beamline: MXBeamline) -> None:
|
||||
super().__init__(beamline=beamline)
|
||||
super().__init__(beamline=beamline, geo_class=X06daGeometry)
|
||||
self._bec_macros = X06daBecMacros()
|
||||
|
||||
@property
|
||||
|
||||
@@ -96,9 +96,10 @@ class X10saGeometry(DefaultGeometry):
|
||||
@property
|
||||
def beam_centre_model(self) -> BeamCenterModel:
|
||||
return self._model
|
||||
|
||||
@property
|
||||
def deetector_tils(self) -> tuple[float, float]:
|
||||
return 0,0
|
||||
def detector_tilt(self) -> tuple[float, float]:
|
||||
return 0, 0
|
||||
|
||||
|
||||
class X10saDispatch(DefaultDispatch):
|
||||
|
||||
@@ -49,6 +49,15 @@ def test_pxii_dispatch_beam_center():
|
||||
assert np.isclose(beam_center[1][0], 2242.05, atol=1)
|
||||
|
||||
|
||||
@pytest.mark.skipif(
|
||||
importlib.util.find_spec("pxii_bec") is None, reason="run only for pxii flavour"
|
||||
)
|
||||
def test_poni_rot_is_0():
|
||||
with patch.dict("os.environ", {"BEAMLINE": "X10SA"}):
|
||||
dispatch = get_beamline_dispatch()
|
||||
assert dispatch.geo.detector_tilt == (0, 0)
|
||||
|
||||
|
||||
@pytest.mark.skipif(
|
||||
importlib.util.find_spec("pxiii_bec") is None, reason="run only for pxiii flavour"
|
||||
)
|
||||
@@ -56,3 +65,12 @@ def test_pxiii_dispatch_can_be_instantiated():
|
||||
with patch.dict("os.environ", {"BEAMLINE": "X06DA"}):
|
||||
dispatch = get_beamline_dispatch()
|
||||
assert isinstance(dispatch, X06daDispatch)
|
||||
|
||||
|
||||
@pytest.mark.skipif(
|
||||
importlib.util.find_spec("pxiii_bec") is None, reason="run only for pxiii flavour"
|
||||
)
|
||||
def test_poni_rot_is_not_0():
|
||||
with patch.dict("os.environ", {"BEAMLINE": "X06DA"}):
|
||||
dispatch = get_beamline_dispatch()
|
||||
assert dispatch.geo.detector_tilt != (0, 0)
|
||||
|
||||
Reference in New Issue
Block a user