feat: add pxiii flux from lookup table
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) Successful in 41s
CI / test (3.12) (pull_request) Successful in 1m2s
CI / test (3.13) (pull_request) Successful in 1m4s
CI / test (3.14) (pull_request) Successful in 1m11s
CI / test-with-beamline-plugins (pxi_bec) (pull_request) Successful in 1m5s
CI / test-with-beamline-plugins (pxii_bec) (pull_request) Successful in 1m14s
CI / test-with-beamline-plugins (pxiii_bec) (pull_request) Failing after 1m24s
CI / test-with-coverage (pull_request) Successful in 1m43s
CI / coverage-analysis (pull_request) Failing after 9s
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) Successful in 41s
CI / test (3.12) (pull_request) Successful in 1m2s
CI / test (3.13) (pull_request) Successful in 1m4s
CI / test (3.14) (pull_request) Successful in 1m11s
CI / test-with-beamline-plugins (pxi_bec) (pull_request) Successful in 1m5s
CI / test-with-beamline-plugins (pxii_bec) (pull_request) Successful in 1m14s
CI / test-with-beamline-plugins (pxiii_bec) (pull_request) Failing after 1m24s
CI / test-with-coverage (pull_request) Successful in 1m43s
CI / coverage-analysis (pull_request) Failing after 9s
This commit is contained in:
@@ -24,7 +24,7 @@ class BecMacros(ABC):
|
||||
def bl_energy(energy_ev, move_gap=True, mono_scan=True, plot=True): ...
|
||||
@staticmethod
|
||||
@abstractmethod
|
||||
def get_current_energy(): ...
|
||||
def get_current_energy() -> float: ...
|
||||
@staticmethod
|
||||
@abstractmethod
|
||||
def mono_pitch_scan(plot=True): ...
|
||||
|
||||
@@ -1,10 +1,50 @@
|
||||
from typing import Any
|
||||
|
||||
import numpy as np
|
||||
from aarecommon.config.beamline import MXBeamline
|
||||
|
||||
from aare.beamline_dispatch.default.beamline_dispatch import DefaultDispatch, DefaultGeometry
|
||||
from aare.beamline_dispatch.protocols import BecMacros
|
||||
|
||||
# fmt: off
|
||||
FLUX_ENERGY_KEV = np.asarray([
|
||||
4.0, 4.1, 4.2, 4.3, 4.4, 4.5, 4.6, 4.7, 4.8, 4.9,
|
||||
5.0, 5.1, 5.2, 5.3, 5.4, 5.5, 5.6, 5.7, 5.8, 5.9,
|
||||
6.0, 6.1, 6.2, 6.3, 6.4, 6.5, 6.6, 6.7, 6.8, 6.9,
|
||||
7.0, 7.1, 7.2, 7.3, 7.4, 7.5, 7.6, 7.7, 7.8, 7.9,
|
||||
8.0, 8.1, 8.2, 8.3, 8.4, 8.5, 8.6, 8.7, 8.8, 8.9,
|
||||
9.0, 9.1, 9.2, 9.3, 9.4, 9.5, 9.6, 9.7, 9.8, 9.9,
|
||||
10.0, 10.1, 10.2, 10.3, 10.4, 10.5, 10.6, 10.7, 10.8, 10.9,
|
||||
11.0, 11.1, 11.2, 11.3, 11.4, 11.5, 11.6, 11.7, 11.8, 11.9,
|
||||
12.0, 12.1, 12.2, 12.3, 12.4, 12.5, 12.6, 12.7, 12.8, 12.9,
|
||||
13.0, 13.1, 13.2, 13.3, 13.4, 13.5, 13.6, 13.7, 13.8, 13.9,
|
||||
14.0, 14.1, 14.2, 14.3, 14.4, 14.5, 14.6, 14.7, 14.8, 14.9,
|
||||
15.0,
|
||||
], dtype=np.float64)
|
||||
|
||||
FLUX_PH_S = np.asarray([
|
||||
9.6319e+09, 1.2625e+10, 1.6152e+10, 2.0210e+10, 2.4794e+10, 2.9898e+10,
|
||||
3.5492e+10, 4.1577e+10, 4.8186e+10, 5.5296e+10, 6.2874e+10, 7.0892e+10,
|
||||
7.9292e+10, 8.8026e+10, 9.7061e+10, 1.0637e+11, 1.1587e+11, 1.2552e+11,
|
||||
1.3528e+11, 1.4509e+11, 1.5000e+11, 1.5959e+11, 1.6925e+11, 1.7890e+11,
|
||||
1.8852e+11, 1.9807e+11, 2.0754e+11, 2.1689e+11, 2.2610e+11, 2.3520e+11,
|
||||
2.4416e+11, 2.5294e+11, 2.6151e+11, 2.6986e+11, 2.7799e+11, 2.8587e+11,
|
||||
2.9352e+11, 3.0091e+11, 3.0810e+11, 3.1506e+11, 3.2177e+11, 3.2830e+11,
|
||||
3.3458e+11, 3.4061e+11, 3.4640e+11, 3.5196e+11, 3.5730e+11, 3.6243e+11,
|
||||
3.6743e+11, 3.7225e+11, 3.7690e+11, 3.8139e+11, 3.8574e+11, 3.8994e+11,
|
||||
3.9402e+11, 3.9798e+11, 4.0182e+11, 4.0554e+11, 4.0914e+11, 4.1265e+11,
|
||||
4.1598e+11, 4.1920e+11, 4.2220e+11, 4.2496e+11, 4.2743e+11, 4.2962e+11,
|
||||
4.3149e+11, 4.3304e+11, 4.3427e+11, 4.3518e+11, 4.3579e+11, 4.3613e+11,
|
||||
4.3620e+11, 4.3598e+11, 4.3551e+11, 4.3478e+11, 4.3381e+11, 4.3260e+11,
|
||||
4.3116e+11, 4.2949e+11, 4.2760e+11, 4.2549e+11, 4.2315e+11, 4.2058e+11,
|
||||
4.1780e+11, 4.1477e+11, 4.1150e+11, 4.0795e+11, 4.0413e+11, 4.0000e+11,
|
||||
3.9555e+11, 3.9075e+11, 3.8557e+11, 3.7995e+11, 3.7386e+11, 3.6722e+11,
|
||||
3.5995e+11, 3.5196e+11, 3.4312e+11, 3.3325e+11, 3.2213e+11, 3.0944e+11,
|
||||
2.9474e+11, 2.7742e+11, 2.5658e+11, 2.3096e+11, 1.9893e+11, 1.5947e+11,
|
||||
1.1576e+11, 7.7492e+10, 5.0923e+10,
|
||||
], dtype=np.float64)
|
||||
# fmt: on
|
||||
|
||||
|
||||
class X06daBecMacros(BecMacros):
|
||||
def __init__(self) -> None:
|
||||
@@ -37,7 +77,11 @@ class X06daBecMacros(BecMacros):
|
||||
self.auto_exposure = auto_exposure
|
||||
|
||||
def full_flux_ph_per_s():
|
||||
return 400_000_000_000
|
||||
current_energy_kev = self.get_current_energy() / 1000
|
||||
idx = (np.abs(FLUX_ENERGY_KEV - current_energy_kev)).argmin()
|
||||
if idx < len(FLUX_PH_S):
|
||||
return float(FLUX_PH_S[idx])
|
||||
return 0
|
||||
|
||||
self.full_flux_ph_per_s = full_flux_ph_per_s
|
||||
|
||||
@@ -50,7 +94,7 @@ class X06daBecMacros(BecMacros):
|
||||
@staticmethod
|
||||
def bl_energy(energy_ev, move_gap=True, mono_scan=True, plot=True): ...
|
||||
@staticmethod
|
||||
def get_current_energy(): ...
|
||||
def get_current_energy() -> float: ...
|
||||
@staticmethod
|
||||
def mono_pitch_scan(plot=True): ...
|
||||
@staticmethod
|
||||
|
||||
@@ -70,7 +70,7 @@ class X10SaBecMacros(BecMacros):
|
||||
@staticmethod
|
||||
def bl_energy(energy_ev, move_gap=True, mono_scan=True, plot=True): ...
|
||||
@staticmethod
|
||||
def get_current_energy(): ...
|
||||
def get_current_energy() -> float: ...
|
||||
@staticmethod
|
||||
def mono_pitch_scan(plot=True): ...
|
||||
@staticmethod
|
||||
|
||||
@@ -74,3 +74,15 @@ 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)
|
||||
|
||||
|
||||
@pytest.mark.skipif(
|
||||
importlib.util.find_spec("pxiii_bec") is None, reason="run only for pxiii flavour"
|
||||
)
|
||||
def test_flux_table():
|
||||
with patch.dict("os.environ", {"BEAMLINE": "X06DA"}):
|
||||
dispatch = get_beamline_dispatch()
|
||||
with patch.object(dispatch.bec_macros, "get_current_energy", lambda: 4100):
|
||||
assert np.isclose(dispatch.bec_macros.full_flux_ph_per_s(), 9.6319e09)
|
||||
with patch.object(dispatch.bec_macros, "get_current_energy", lambda: 15000):
|
||||
assert np.isclose(dispatch.bec_macros.full_flux_ph_per_s(), 5.0923e10)
|
||||
|
||||
Reference in New Issue
Block a user