feat: load beam centre model from config
CI / lint (push) Skipped
CI / test (3.11) (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 38s
CI / test (3.11) (pull_request) Successful in 1m6s
CI / test (3.12) (pull_request) Successful in 1m6s
CI / test (3.13) (pull_request) Successful in 1m9s
CI / test-with-beamline-plugins (pxi_bec) (pull_request) Successful in 1m14s
CI / test-with-beamline-plugins (pxii_bec) (pull_request) Failing after 1m16s
CI / test-with-beamline-plugins (pxiii_bec) (pull_request) Failing after 1m20s
CI / test-with-coverage (pull_request) Successful in 1m35s
CI / coverage-analysis (pull_request) Failing after 3s

This commit is contained in:
2026-08-21 12:06:08 +02:00
parent 4ecb762e67
commit 2f0088fcce
@@ -1,4 +1,6 @@
import json
import os
from importlib.resources import files
from aarecommon.config.beamline import MXBeamline
from aarecommon.models.beam_centre import BeamCentre
@@ -18,11 +20,14 @@ class DefaultAuthDispatch(AuthDispatch):
class DefaultGeometry(Geometry):
def __init__(self, beamline: MXBeamline) -> None:
super().__init__()
self._model = BeamCentre
with open(files("aarecommon.config") / "beamline_configs" / "beam_centres.json") as f:
measurements = json.loads(f.read())[beamline.value.lower()]
self._model = BeamCentre.model_validate(measurements)
self._beamline = beamline
@property
def beam_centre_model(self) -> BeamCentre: ...
def beam_centre_model(self) -> BeamCentre:
return self._model
class DefaultDispatch(BeamlineDispatch):