diff --git a/pxiii_bec/devices/A3200.py b/pxiii_bec/devices/A3200.py index d2cbfe2..2ac32a2 100644 --- a/pxiii_bec/devices/A3200.py +++ b/pxiii_bec/devices/A3200.py @@ -12,11 +12,11 @@ Standard bluesky interface: AerotechAbrStage.kickoff() AerotechAbrStage.stop() Additional bluesky functionality: - - + + Aerotech.is_homed() Aerotech.do_homing(wait=True) Aerotech.get_ready(ostart=None, orange=None, etime=None, wait=True) @@ -66,7 +66,6 @@ from bec_lib import bec_logger logger = bec_logger.logger - # pylint: disable=logging-fstring-interpolation class AerotechAbrMixin(CustomPrepare): """Configuration class for the Aerotech A3200 controller for the ABR stage""" @@ -84,7 +83,13 @@ class AerotechAbrMixin(CustomPrepare): scanargs = self.parent.scaninfo.scan_msg.info["kwargs"] scanname = self.parent.scaninfo.scan_msg.info["scan_name"] - if scanname in ("standardscan", "helicalscan", "helicalscan1", "helicalscan2", "helicalscan3"): + if scanname in ( + "standardscan", + "helicalscan", + "helicalscan1", + "helicalscan2", + "helicalscan3", + ): d["scan_command"] = AbrCmd.MEASURE_STANDARD d["var_1"] = scanargs["start"] d["var_2"] = scanargs["range"] @@ -295,9 +300,7 @@ class AerotechAbrStage(BECDeviceBase): return bool(value == 0) # Subscribe and wait for update - status = SubscriptionStatus( - self.scan_done, is_busy, timeout=timeout, settle_time=0.1 - ) + status = SubscriptionStatus(self.scan_done, is_busy, timeout=timeout, settle_time=0.1) status.wait() # return status @@ -321,9 +324,7 @@ class AerotechAbrStage(BECDeviceBase): # Subscribe and wait for update # status = SubscriptionStatus(self.task1, is_idle, timeout=timeout, settle_time=0.5) - status = SubscriptionStatus( - self.scan_done, is_idle, timeout=timeout, settle_time=0.5 - ) + status = SubscriptionStatus(self.scan_done, is_idle, timeout=timeout, settle_time=0.5) return status def reset(self, settle_time=0.1, wait_after_reload=1) -> None: diff --git a/pxiii_bec/devices/A3200utils.py b/pxiii_bec/devices/A3200utils.py index 96907cf..30072dc 100644 --- a/pxiii_bec/devices/A3200utils.py +++ b/pxiii_bec/devices/A3200utils.py @@ -90,7 +90,7 @@ class A3200Axis(PVPositioner): vmax = Component(Signal, kind=Kind.config) offset = Component(EpicsSignal, "-OFF", put_complete=True, kind=Kind.config) - #pylint: disable=too-many-arguments + # pylint: disable=too-many-arguments def __init__( self, prefix="", @@ -255,5 +255,5 @@ class A3200Axis(PVPositioner): # Automatically start an axis if directly invoked if __name__ == "__main__": - omega = A3200Axis(prefix="X06DA-ES-DF1:OMEGA", base_pv='X06DA-ES', name="omega") + omega = A3200Axis(prefix="X06DA-ES-DF1:OMEGA", base_pv="X06DA-ES", name="omega") omega.wait_for_connection() diff --git a/pxiii_bec/devices/SmarGonA.py b/pxiii_bec/devices/SmarGonA.py index f280f60..aa902d4 100644 --- a/pxiii_bec/devices/SmarGonA.py +++ b/pxiii_bec/devices/SmarGonA.py @@ -170,10 +170,10 @@ class SmarGonAxis(PVPositioner): self.__class__.__dict__["setpoint"].kwargs["high_limit"] = high_limit self.__class__.__dict__["sg_url"].kwargs["value"] = sg_url # Fine-tune HTTP connection behavior - # NOTE: SmarGon has a few failed requests every one in a while + # NOTE: SmarGon has a few failed requests every one in a while self._s = requests.Session() - retries = Retry(total=5, backoff_factor=0.05, status_forcelist=[ 500, 502, 503, 504 ]) - self._s.mount('http://', HTTPAdapter(max_retries=retries)) + retries = Retry(total=5, backoff_factor=0.05, status_forcelist=[500, 502, 503, 504]) + self._s.mount("http://", HTTPAdapter(max_retries=retries)) super().__init__( prefix=prefix, diff --git a/pxiii_bec/devices/SmarGonB.py b/pxiii_bec/devices/SmarGonB.py index 1f916fc..fc852b4 100644 --- a/pxiii_bec/devices/SmarGonB.py +++ b/pxiii_bec/devices/SmarGonB.py @@ -58,7 +58,7 @@ class LimitedSmarGonSignal(Signal): if value > hil: raise ValueError(f"Target {value} outside of limits {self.limits}") - def put(self, value, *, timestamp=None, force=False, metadata=None, **kwargs,): + def put(self, value, *, timestamp=None, force=False, metadata=None, **kwargs): """Overriden put to add communication with smargopolo""" # Validate new value and get timestamp if not force: @@ -88,6 +88,7 @@ class SmarGonAxis(PVPositioner): This class controls the SmarGon goniometer via the REST interface. All SmarGon axes share a common mutex to manage actual HW access. """ + USER_ACCESS = ["omove", "oldmove"] # Status attributes @@ -119,10 +120,10 @@ class SmarGonAxis(PVPositioner): self.__class__.__dict__["setpoint"].kwargs["high_limit"] = high_limit self.__class__.__dict__["sg_url"].kwargs["value"] = sg_url # Fine-tune HTTP connection behavior - # NOTE: SmarGon has a few failed requests every one in a while + # NOTE: SmarGon has a few failed requests every one in a while self._s = requests.Session() - retries = Retry(total=5, backoff_factor=0.05, status_forcelist=[ 500, 502, 503, 504 ]) - self._s.mount('http://', HTTPAdapter(max_retries=retries)) + retries = Retry(total=5, backoff_factor=0.05, status_forcelist=[500, 502, 503, 504]) + self._s.mount("http://", HTTPAdapter(max_retries=retries)) super().__init__( prefix=prefix, @@ -149,7 +150,7 @@ class SmarGonAxis(PVPositioner): # print(f"Readback: {rb}\tSetpoint: {sp}") # Check if they're within tolerance distance = abs(rb - sp) - done = 1 if distance OrderedDict[str, dict]: """Workaround to schema expected by the BEC""" d = super().read() diff --git a/pxiii_bec/devices/StdDaqPreview.py b/pxiii_bec/devices/StdDaqPreview.py index 232b00e..afe4559 100644 --- a/pxiii_bec/devices/StdDaqPreview.py +++ b/pxiii_bec/devices/StdDaqPreview.py @@ -51,7 +51,7 @@ class StdDaqPreviewMixin(CustomDetectorMixin): self._mon.join(timeout=1) # So also disconnect the socket try: - #pylint: disable=protected-access + # pylint: disable=protected-access self.parent._socket.disconnect(self.parent.url.get()) except zmq.error.ZMQError: # Might be already closed @@ -73,7 +73,7 @@ class StdDaqPreviewMixin(CustomDetectorMixin): break # pylint: disable=no-member - #pylint: disable=protected-access + # pylint: disable=protected-access r = self.parent._socket.recv_multipart(flags=zmq.NOBLOCK) # Length and throtling checks @@ -105,7 +105,7 @@ class StdDaqPreviewMixin(CustomDetectorMixin): # self.parent.array_data.put(data, force=True) self.parent.shaped_image.put(image, force=True) - #pylint: disable=protected-access + # pylint: disable=protected-access self.parent._last_image = image self.parent._run_subs(sub_type=self.parent.SUB_MONITOR, value=image) t_last = t_curr @@ -133,7 +133,7 @@ class StdDaqPreviewDetector(PSIDetectorBase): This was meant to provide live image stream directly from the StdDAQ but also works with other ARRAY v1 streamers, like the AreaDetector ZMQ plugin. Note that the preview stream must be already throtled in order to cope with - the incoming data and the python class might throttle it further. + the incoming data and the python class might throttle it further. NOTE: As an explicit request, it does not record the image data. @@ -185,8 +185,8 @@ class StdDaqPreviewDetector(PSIDetectorBase): self._socket.connect(self.url.get()) def savemode(self, save=False): - """ Toggle save mode for the shaped image""" - #pylint: disable=protected-access + """Toggle save mode for the shaped image""" + # pylint: disable=protected-access if save: self.shaped_image._kind = Kind.normal else: