From d2c33605c0a61efbcfe4b8c41d8b43866190d64f Mon Sep 17 00:00:00 2001 From: Filip Leonarski Date: Mon, 19 May 2025 15:45:07 +0200 Subject: [PATCH] Fixes --- common/src/aaredaqlib/models.py | 4 ++-- common/src/aaredaqlib/sample_geometry.py | 2 +- daq/src/aaredaq/daq.py | 7 ++++--- daq/src/aaredaq/devices.py | 23 ++++++++++++++--------- 4 files changed, 21 insertions(+), 15 deletions(-) diff --git a/common/src/aaredaqlib/models.py b/common/src/aaredaqlib/models.py index fdca1c25..dd2594b0 100644 --- a/common/src/aaredaqlib/models.py +++ b/common/src/aaredaqlib/models.py @@ -3,8 +3,8 @@ from typing import Annotated, Literal, Tuple, List, Optional from pydantic import BaseModel, Field -from aaredaqlib import Coordinate -from aaredaqlib import SampleGeometryModel +from aaredaqlib.coordinate import Coordinate +from aaredaqlib.sample_geometry import SampleGeometryModel class TokenData(BaseModel): sub: str # Username diff --git a/common/src/aaredaqlib/sample_geometry.py b/common/src/aaredaqlib/sample_geometry.py index 55e63664..35f9c414 100644 --- a/common/src/aaredaqlib/sample_geometry.py +++ b/common/src/aaredaqlib/sample_geometry.py @@ -3,7 +3,7 @@ from typing import Annotated import numpy as np from pydantic import BaseModel, Field, AfterValidator -from aaredaqlib import Coordinate, SmargonCoordinate, positive_coords +from aaredaqlib.coordinate import Coordinate, SmargonCoordinate, positive_coords class SampleGeometryModel(BaseModel): diff --git a/daq/src/aaredaq/daq.py b/daq/src/aaredaq/daq.py index 374ca3e9..38003d78 100644 --- a/daq/src/aaredaq/daq.py +++ b/daq/src/aaredaq/daq.py @@ -707,11 +707,12 @@ class AareDAQ: @property def beamline_status(self) -> BeamlineStatus: return BeamlineStatus( - energy_keV=self.__devs, - detector_distnace_mm=self.__devs.dtz.value, + energy_keV=self.__devs.energy_kev, + dtz_mm=self.__devs.dtz.value, ring_current_mA=self.__devs.ring_current, light=self.light, - cryojet_K=self.__devs.cryojet_temp + cryojet_K=self.__devs.cryojet_temp, + shutter_open=self.__devs.shutter ) @property diff --git a/daq/src/aaredaq/devices.py b/daq/src/aaredaq/devices.py index 273cafa4..a2d22670 100644 --- a/daq/src/aaredaq/devices.py +++ b/daq/src/aaredaq/devices.py @@ -23,7 +23,7 @@ class BeamlineDevices: #self.__bec_dev = client.device_manager.devices #self.__bec_scans = client.scans - self.aare = AareWrapper(beamline) + # self.aare = AareWrapper(beamline) BEAMLINE = beamline.value.upper() @@ -102,14 +102,8 @@ class BeamlineDevices: stoppv=(f"{BEAMLINE}-ES-SAMCAM:ZOOM.STOP", 1), ) - # shutter = EnumPv( - # { - # "name": "ExposureBoxShutter", - # "pv": f"{BEAMLINE}-MOCK-PH1:SET", - # "readback": f"{BEAMLINE}-MOCK-PH1:SET", - # "states": {"closed": "closed", "opened": "opened"}, - # } - # ) + self.__shutter_rbv = PV(f"{BEAMLINE}-ES-PH1:GET") + self.__shutter = PV(f"{BEAMLINE}-ES-PH1:SET") # xrf_stage = EnumPv( # { @@ -232,3 +226,14 @@ class BeamlineDevices: def disable_motors(self): self.aerotech.lock() + + @property + def shutter(self) -> bool: + return self.__shutter_rbv.value == 1 + + @shutter.setter + def shutter(self, opened: bool): + if opened: + self.__shutter.put(1) + else: + self.__shutter.put(0)