devices: fix on bec det_z device
This commit is contained in:
+12
-12
@@ -41,9 +41,7 @@ class BeamlineDevices:
|
||||
self.exp_shutter = ExperimentalHutchShutter(beamline=self._beamline)
|
||||
|
||||
#faster to define the dtz object here than in functions and then use
|
||||
self.__dtz_rbk = self.bec_worker.dev.det_z.position
|
||||
self.__dtz_llm= self.bec_worker.dev.det_z.low_limit
|
||||
self.__dtz_hlm= self.bec_worker.dev.det_z.high_limit
|
||||
self.__dtz = self.bec_worker.dev.det_z
|
||||
self.dtz_mod = cfg_get('daq.detector_distance_limit_modifier', 1.0)
|
||||
#TODO convert epics pvs to BEC
|
||||
self.__sample_cam = epicsAD(f"{BEAMLINE}-ES-MS:")
|
||||
@@ -265,20 +263,20 @@ class BeamlineDevices:
|
||||
# Detector Z
|
||||
@property
|
||||
def dtz(self) -> float:
|
||||
return self.__dtz_rbk
|
||||
return self.__dtz.read()['det_z']['value']
|
||||
|
||||
@dtz.setter
|
||||
def dtz(self, value: float):
|
||||
self.set_dtz(value, wait=True)
|
||||
|
||||
def set_dtz(self, value: float, /, wait: bool = True):
|
||||
if value < self.__dtz_llm:
|
||||
if value < self.__dtz.low_limit:
|
||||
#raise ValueError(f"Detector distance cannot be less than {self.detector_distance_minimum} mm")
|
||||
logger.warning(f"Requested detector distance {value} is less than minimum: {self.__dtz_llm}, setting to minimum")
|
||||
value = self.__dtz_llm + self.dtz_mod
|
||||
if value > self.__dtz_hlm:
|
||||
logger.warning(f"Requested detector distance {value} is greater than maximum: {self.__dtz_hlm}, setting to maximum")
|
||||
value = self.__dtz_hlm - self.dtz_mod
|
||||
logger.warning(f"Requested detector distance {value} is less than minimum: {self.__dtz.low_limit}, setting to minimum")
|
||||
value = self.__dtz.low_limit + self.dtz_mod
|
||||
if value > self.__dtz.high_limit:
|
||||
logger.warning(f"Requested detector distance {value} is greater than maximum: {self.__dtz.high_limit}, setting to maximum")
|
||||
value = self.__dtz.high_limit - self.dtz_mod
|
||||
if wait:
|
||||
status = self.bec_worker.det_z(value, timeout=60)
|
||||
return status
|
||||
@@ -288,11 +286,13 @@ class BeamlineDevices:
|
||||
|
||||
@property
|
||||
def dtz_low(self) -> float:
|
||||
return self.__dtz_llm
|
||||
logger.info(f"dtz_low: {self.__dtz.low_limit}")
|
||||
return self.__dtz.low_limit
|
||||
|
||||
@property
|
||||
def dtz_high(self) -> float:
|
||||
return self.__dtz_hlm
|
||||
logger.info(f"dtz_high: {self.__dtz.high_limit}")
|
||||
return self.__dtz.high_limit
|
||||
|
||||
@property
|
||||
def aerotech_pos(self) -> AerotechCoordinate:
|
||||
|
||||
Reference in New Issue
Block a user