feat: use rotation scan defaut settings from config service
CI / lint (push) Skipped
CI / test (3.12) (push) Skipped
CI / test (3.13) (push) Skipped
CI / test-with-beamline-plugins (pxi_bec) (push) Skipped
CI / test-with-beamline-plugins (pxii_bec) (push) Skipped
CI / test-with-beamline-plugins (pxiii_bec) (push) Skipped
CI / lint (pull_request) Failing after 1m6s
CI / test (3.13) (pull_request) Successful in 3m44s
CI / test-with-beamline-plugins (pxii_bec) (pull_request) Failing after 3m44s
CI / test (3.12) (pull_request) Successful in 3m46s
CI / test (3.14) (pull_request) Successful in 3m46s
CI / test-with-beamline-plugins (pxi_bec) (pull_request) Canceled after 3m49s
CI / test-with-coverage (pull_request) Successful in 3m52s
CI / test-with-beamline-plugins (pxiii_bec) (pull_request) Canceled after 3m49s
CI / coverage-analysis (pull_request) Failing after 2s
CI / lint (push) Skipped
CI / test (3.12) (push) Skipped
CI / test (3.13) (push) Skipped
CI / test-with-beamline-plugins (pxi_bec) (push) Skipped
CI / test-with-beamline-plugins (pxii_bec) (push) Skipped
CI / test-with-beamline-plugins (pxiii_bec) (push) Skipped
CI / lint (pull_request) Failing after 1m6s
CI / test (3.13) (pull_request) Successful in 3m44s
CI / test-with-beamline-plugins (pxii_bec) (pull_request) Failing after 3m44s
CI / test (3.12) (pull_request) Successful in 3m46s
CI / test (3.14) (pull_request) Successful in 3m46s
CI / test-with-beamline-plugins (pxi_bec) (pull_request) Canceled after 3m49s
CI / test-with-coverage (pull_request) Successful in 3m52s
CI / test-with-beamline-plugins (pxiii_bec) (pull_request) Canceled after 3m49s
CI / coverage-analysis (pull_request) Failing after 2s
This commit is contained in:
1 parent
b1fecd8714
commit
95fa5507ea
5 files changed
+23
-13
No files matched your search
+1
-1
@@ -33,7 +33,7 @@ dependencies = [
|
||||
"aarelcinfer-client==0.1.1a8",
|
||||
"matplotlib>=3.10.3",
|
||||
"httpx>=0.28.1",
|
||||
"aare-config>=0.1.7",
|
||||
"aare-config>=0.3.0",
|
||||
]
|
||||
|
||||
[project.optional-dependencies]
|
||||
|
||||
@@ -4,6 +4,7 @@ from abc import ABC
|
||||
from importlib.resources import files
|
||||
from typing import Any
|
||||
|
||||
from aare_config import AareConfigClient
|
||||
from aarecommon.config.beamline import MXBeamline
|
||||
from aarecommon.models.beam_centre import BeamCentre
|
||||
|
||||
@@ -46,6 +47,9 @@ class DefaultDispatch(BeamlineDispatch, ABC):
|
||||
) -> None:
|
||||
self._auth = DefaultAuthDispatch()
|
||||
self._geo = geo_class(beamline=beamline)
|
||||
self._config = AareConfigClient(
|
||||
redis_url=f"redis://mx-{beamline.value.lower()}-queue-01", key_prefix="config"
|
||||
)
|
||||
|
||||
@property
|
||||
def auth(self):
|
||||
@@ -57,7 +61,13 @@ class DefaultDispatch(BeamlineDispatch, ABC):
|
||||
|
||||
@property
|
||||
def default_rotation_parameters(self) -> dict[str, Any]:
|
||||
return {"exp_time_s": 0.04, "dtz": 110, "incr_omega_deg": 0.2}
|
||||
defaults = self._config.rotation_defaults
|
||||
return {
|
||||
"exp_time_s": defaults.exp_time_s,
|
||||
"dtz": defaults.detector_distance_mm,
|
||||
"incr_omega_deg": defaults.image_width_deg,
|
||||
"transmission": defaults.transmission_fraction,
|
||||
}
|
||||
|
||||
@property
|
||||
def default_auto_raster_parameters(self) -> dict[str, Any]:
|
||||
|
||||
@@ -109,11 +109,6 @@ class X06daDispatch(DefaultDispatch):
|
||||
def bec_macros(self) -> BecMacros:
|
||||
return self._bec_macros
|
||||
|
||||
@property
|
||||
def default_rotation_parameters(self) -> dict[str, Any]:
|
||||
default = super().default_rotation_parameters
|
||||
return default | {"transmission": 1.0}
|
||||
|
||||
@property
|
||||
def default_auto_raster_parameters(self) -> dict[str, Any]:
|
||||
return {"exp_time_s": 0.04, "transmission": 1.0, "dtz": 150}
|
||||
@@ -110,11 +110,6 @@ class X10saDispatch(DefaultDispatch):
|
||||
def bec_macros(self) -> BecMacros:
|
||||
return self._bec_macros
|
||||
|
||||
@property
|
||||
def default_rotation_parameters(self) -> dict[str, Any]:
|
||||
default = super().default_rotation_parameters
|
||||
return default | {"transmission": 0.1}
|
||||
|
||||
@property
|
||||
def default_auto_raster_parameters(self) -> dict[str, Any]:
|
||||
# Full transmission for 20 keV rastering
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import importlib.util
|
||||
from unittest.mock import patch
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
import numpy as np
|
||||
import pytest
|
||||
@@ -10,6 +10,16 @@ from aare.beamline_dispatch.x06da import X06daDispatch
|
||||
from aare.beamline_dispatch.x10sa import X10saDispatch
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def mock_config_client():
|
||||
"""Every dispatch class goes through DefaultDispatch, which builds an AareConfigClient
|
||||
pointing at the beamline redis; stub it so no test needs a live connection."""
|
||||
with patch(
|
||||
"aare.beamline_dispatch.default.beamline_dispatch.AareConfigClient", autospec=True
|
||||
) as mock_cls:
|
||||
yield mock_cls.return_value
|
||||
|
||||
|
||||
def test_dispatch_cannot_be_instantiated_without_env():
|
||||
with patch.dict("os.environ", {}, clear=True), pytest.raises(ValueError) as e:
|
||||
_ = get_beamline_dispatch()
|
||||
|
||||
Reference in new issue
Block a user