WIP feat: reintegrate fluo
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 (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
This commit is contained in:
+17
-2
@@ -121,6 +121,7 @@ from aare.daq.operations.rotation.service import RotationService
|
||||
from aare.daq.operations.screenshot.service import ScreenshotService
|
||||
from aare.devices.area_detector import AutoEnum
|
||||
from aare.devices.jfjoch import JFJochWrapper
|
||||
import numpy as np
|
||||
|
||||
logger = setup_logger("aareDAQ")
|
||||
|
||||
@@ -3491,6 +3492,10 @@ class AareDAQ:
|
||||
finally:
|
||||
self._cfg.state_busy = False
|
||||
|
||||
@staticmethod
|
||||
def _linear_fluo_energies(offset, slope, num = 2408):
|
||||
return np.linspace(offset, slope*num + offset, 2048).tolist()
|
||||
|
||||
def fluorimeter_take_spectrum(
|
||||
self, fm: FluorescenceSpectrumParameterModel
|
||||
) -> FluorescenceSpectrumOutputModel:
|
||||
@@ -3502,11 +3507,21 @@ class AareDAQ:
|
||||
if fm.transmission is not None:
|
||||
self._devs.transmission = fm.transmission
|
||||
|
||||
# TODO: Fill
|
||||
if self._beamline != MXBeamline.X06DA:
|
||||
raise NotImplementedError("Only enabled for PXIII right now")
|
||||
|
||||
fluo = self._devs.bec_worker.dev.fluorimeter
|
||||
background = fluo.background.get().tolist()
|
||||
spectrum = fluo.mca.get().tolist()
|
||||
offset = fluo.calibration_offset.get()
|
||||
slope = fluo.calibration_slope.get()
|
||||
energies_ev = self._linear_fluo_energies(offset, slope)
|
||||
adt = fluo.average_dead_time.get() / 100
|
||||
out = FluorescenceSpectrumOutputModel(bkg=background, spectrum=spectrum, energy_eV=energies_ev, average_dead_time=adt)
|
||||
|
||||
self._set_state(BeamlineStateEnum.SampleAlignment)
|
||||
self._cfg.state_busy = False
|
||||
return None
|
||||
return out
|
||||
except Exception:
|
||||
self._set_state(BeamlineStateEnum.SampleAlignment)
|
||||
self._cfg.state_busy = False
|
||||
|
||||
@@ -1435,7 +1435,7 @@ async def robot_sample_exchange(token: str = Depends(oauth2_scheme)):
|
||||
@app.post("/state/xray_fluorescence")
|
||||
async def xray_fluorescence(token: str = Depends(oauth2_scheme)):
|
||||
"""
|
||||
Transition beamline state to SampleAlignment.
|
||||
Transition beamline state to XrayFluorescence.
|
||||
|
||||
Args:
|
||||
token: OAuth2 access token.
|
||||
|
||||
@@ -179,7 +179,7 @@ def dc2sa(devs: BeamlineDevices, cfg: BeamlineConfig):
|
||||
def sa2xrf(devs: BeamlineDevices, cfg: BeamlineConfig):
|
||||
"""sample alignment to XrfCollection"""
|
||||
devs.samcam_auto(AutoEnum.AUTO)
|
||||
devs.bec_worker.move_to(BeamlineState.FLUX_MEASUREMENT)
|
||||
devs.bec_worker.move_to(BeamlineState.DC_XRF)
|
||||
devs.samcam_auto(AutoEnum.ONCE)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user