DAQ: added back PVs for beamstop, scintilator, collimator, front and back light and cryojet position. PV handling may change.
This commit is contained in:
+65
-38
@@ -16,33 +16,52 @@ from aare.common.beamline import MXBeamline
|
||||
from aare.common.coordinate import Coordinate, SmargonCoordinate
|
||||
from aare.common.models import SampleCameraSettings, StagePositionEnum
|
||||
from aare.devices import smargon, aerotech
|
||||
from aare.devices.area_detector import epicsAD
|
||||
from aare.devices.area_detector import epicsAD, AutoEnum
|
||||
from aare.devices.enum_pv import EnumPv
|
||||
from aare.devices.my_motor import MyMotor
|
||||
|
||||
class BacklightPositionEnum(Enum):
|
||||
PARK = 0
|
||||
MEASURE = 1
|
||||
from aare.devices.set_get_pv import SetGetPV
|
||||
from aare.devices.tell_client import TellClient
|
||||
|
||||
class BeamlineDevices:
|
||||
def __init__(self, beamline: MXBeamline):
|
||||
BEAMLINE = beamline.value.upper()
|
||||
|
||||
self.tell = TellClient(beamline)
|
||||
self.__aerotech = aerotech.AerotechControllerEpics(beamline)
|
||||
self.__smargon = smargon.Smargon(beamline)
|
||||
|
||||
self.__ring_current_pv = PV(f"ARS07-DPCT-0100:CURR")
|
||||
|
||||
self.__dtz = MyMotor(f"{BEAMLINE}-ES-DET:TRZ")
|
||||
|
||||
self.__sample_cam = epicsAD(f"{BEAMLINE}-SAMCAM:")
|
||||
|
||||
self.__back_light_pos = EnumPv(pv_name = f"{BEAMLINE}-ES-BL:POS-SET",
|
||||
rbv_name=f"{BEAMLINE}-ES-BL:POS-GET",
|
||||
timeout=10.0)
|
||||
self.__front_light = PV(f"{BEAMLINE}-ES-FL:SET")
|
||||
self.__back_light = PV(f"{BEAMLINE}-ES-BL:SET")
|
||||
|
||||
self.__back_light_pos = EnumPv(pv_name = f"{BEAMLINE}-ES-BL:POS-SET",
|
||||
rbv_name = f"{BEAMLINE}-ES-BL:POS-GET",
|
||||
timeout = 10.0)
|
||||
|
||||
self.__collimator_pos = PV(f"{BEAMLINE}-ES-COL:TRY") # HOW TO HANDLE!!!
|
||||
|
||||
self.__scintillator_pos = PV(f"{BEAMLINE}-ES-SCL:TRY") # how to handle!!!
|
||||
|
||||
self.__beamstop_pos = EnumPv(pv_name = f"{BEAMLINE}-ES-BS:POS-SET",
|
||||
rbv_name = f"{BEAMLINE}-ES-BS:POS-GET",
|
||||
timeout = 10.0)
|
||||
|
||||
|
||||
|
||||
self.__zoom = SetGetPV(name = f"zoom",
|
||||
setpv = f"{BEAMLINE}-ES-SAMCAM:ZOOM.VAL",
|
||||
getpv = f"{BEAMLINE}-ES-SAMCAM:ZOOM.RBV")
|
||||
|
||||
self.__cryojet_pos = EnumPv(pv_name = f"{BEAMLINE}-ES-CJ:POS-SET",
|
||||
rbv_name = f"{BEAMLINE}-ES-CJ:POS-GET",
|
||||
timeout = 10.0)
|
||||
|
||||
self.__back_light_bright= PV(f"{BEAMLINE}-ES-BL:SET")
|
||||
self.__front_light_bright = PV(f"{BEAMLINE}-ES-FL:SET")
|
||||
|
||||
self.__zoom_set = PV(f"{BEAMLINE}-ES-SAMCAM:ZOOM.VAL")
|
||||
self.__zoom_get = PV(f"{BEAMLINE}-ES-SAMCAM:ZOOM.RBV")
|
||||
self.__aerotech = aerotech.AerotechControllerEpics(beamline)
|
||||
|
||||
# Transmission
|
||||
@property
|
||||
@@ -58,62 +77,62 @@ class BeamlineDevices:
|
||||
# Lamp light
|
||||
@property
|
||||
def lamp_light(self) -> float:
|
||||
return self.__front_light_bright.get()
|
||||
return self.__front_light.get()
|
||||
|
||||
@lamp_light.setter
|
||||
def lamp_light(self, v: float):
|
||||
self.set_front_light(v, wait=False)
|
||||
|
||||
def set_front_light(self, v: float, /, wait: bool = True):
|
||||
self.__front_light_bright.put(v, wait=wait)
|
||||
self.__front_light.put(v, wait=wait)
|
||||
|
||||
# Back light
|
||||
@property
|
||||
def back_light(self) -> float:
|
||||
return self.__back_light_bright.get()
|
||||
return self.__back_light.get()
|
||||
|
||||
@back_light.setter
|
||||
def back_light(self, v: float):
|
||||
self.set_back_light(v, wait=False)
|
||||
|
||||
def set_back_light(self, v: float, /, wait: bool = True):
|
||||
self.__back_light_bright.put(v, wait=wait)
|
||||
self.__back_light.put(v, wait=wait)
|
||||
|
||||
# Zoom
|
||||
@property
|
||||
def zoom(self) -> float:
|
||||
return self.__zoom_get.get()
|
||||
return self.__zoom.value
|
||||
|
||||
@zoom.setter
|
||||
def zoom(self, value: float):
|
||||
self.set_zoom(value, wait=False)
|
||||
self.set_zoom(value, wait=True)
|
||||
|
||||
def set_zoom(self, value: float, /, wait: bool = True):
|
||||
self.__zoom_set.put(value, wait=wait)
|
||||
self.__zoom.put(value, wait=wait)
|
||||
|
||||
# Collimator
|
||||
@property
|
||||
def collimator(self) -> StagePositionEnum:
|
||||
return StagePositionEnum.DOWN
|
||||
def collimator(self) -> float:
|
||||
return self.__collimator_pos.get()
|
||||
|
||||
@collimator.setter
|
||||
def collimator(self, value: StagePositionEnum):
|
||||
def collimator(self, value: float):
|
||||
self.set_collimator(value, wait=True)
|
||||
|
||||
def set_collimator(self, value: StagePositionEnum, /, wait: bool = True):
|
||||
pass
|
||||
def set_collimator(self, value: float, /, wait: bool = True):
|
||||
self.__collimator_pos.put(value, wait=wait)
|
||||
|
||||
# Scintillator
|
||||
@property
|
||||
def scintillator(self) -> StagePositionEnum:
|
||||
return StagePositionEnum.DOWN
|
||||
def scintillator(self) -> float:
|
||||
return self.__scintillator_pos.get()
|
||||
|
||||
@scintillator.setter
|
||||
def scintillator(self, value: StagePositionEnum):
|
||||
def scintillator(self, value: float):
|
||||
self.set_scintillator(value, wait=True)
|
||||
|
||||
def set_scintillator(self, value: StagePositionEnum, /, wait: bool = True):
|
||||
pass
|
||||
def set_scintillator(self, value: float, /, wait: bool = True):
|
||||
self.__scintillator_pos.put(value, wait=wait)
|
||||
|
||||
# Reflector (backlight?)
|
||||
@property
|
||||
@@ -169,7 +188,18 @@ class BeamlineDevices:
|
||||
def anneal(self, time: float):
|
||||
pass
|
||||
|
||||
# Shutter
|
||||
@property
|
||||
def cryojet_pos(self) -> StagePositionEnum:
|
||||
return StagePositionEnum(self.__cryojet_pos.position.upper())
|
||||
|
||||
@cryojet_pos.setter
|
||||
def cryojet_pos(self, value: StagePositionEnum):
|
||||
self.cryojet_pos_setter(value, wait=True)
|
||||
|
||||
def cryojet_pos_setter(self, value: StagePositionEnum, wait:bool=False):
|
||||
self.__cryojet_pos.put(value, wait=wait)
|
||||
|
||||
# Shutter
|
||||
@property
|
||||
def shutter(self) -> bool:
|
||||
return False
|
||||
@@ -182,8 +212,8 @@ class BeamlineDevices:
|
||||
@property
|
||||
def samcam_settings(self) -> SampleCameraSettings:
|
||||
return SampleCameraSettings(
|
||||
gain=self.__sample_cam.gain.value,
|
||||
exposure=self.__sample_cam.expo.value
|
||||
gain=self.__sample_cam.gain_rbv.value,
|
||||
exposure=self.__sample_cam.expo_rbv.value
|
||||
)
|
||||
|
||||
@samcam_settings.setter
|
||||
@@ -193,11 +223,8 @@ class BeamlineDevices:
|
||||
def samcam_get_image(self, /, gray: bool = False) -> np.ndarray:
|
||||
return self.__sample_cam.get_image(gray=gray)
|
||||
|
||||
def samcam_auto(self, val: bool = False):
|
||||
if val:
|
||||
self.__sample_cam.set_auto()
|
||||
else:
|
||||
self.__sample_cam.set_manual()
|
||||
def samcam_auto(self, state: AutoEnum):
|
||||
self.__sample_cam.set_auto(state)
|
||||
|
||||
# Detector Z
|
||||
@property
|
||||
|
||||
Reference in New Issue
Block a user