refactor: fixed formatter for aerotech

This commit is contained in:
wakonig_k 2024-03-12 16:30:13 +01:00
parent 75360a9636
commit 573da8a20b
2 changed files with 161 additions and 145 deletions

View File

@ -40,5 +40,12 @@ from .aerotech.AerotechAutomation1 import (
) )
from .SpmBase import SpmBase from .SpmBase import SpmBase
from .aerotech.AerotechAutomation1 import aa1Controller, aa1Tasks, aa1GlobalVariables, aa1GlobalVariableBindings, aa1AxisPsoDistance, aa1AxisDriveDataCollection, EpicsMotorX from .aerotech.AerotechAutomation1 import (
aa1Controller,
aa1Tasks,
aa1GlobalVariables,
aa1GlobalVariableBindings,
aa1AxisPsoDistance,
aa1AxisDriveDataCollection,
EpicsMotorX,
)

View File

@ -38,8 +38,7 @@ from collections import OrderedDict
class EpicsMotorX(EpicsMotor): class EpicsMotorX(EpicsMotor):
""" Special motor class that provides flyer interface and progress bar. """Special motor class that provides flyer interface and progress bar."""
"""
SUB_PROGRESS = "progress" SUB_PROGRESS = "progress"
@ -88,7 +87,10 @@ class EpicsMotorX(EpicsMotor):
"""Progress update on the scan""" """Progress update on the scan"""
if (self._startPosition is None) or (self._targetPosition is None) or (not self.moving): if (self._startPosition is None) or (self._targetPosition is None) or (not self.moving):
self._run_subs( self._run_subs(
sub_type=self.SUB_PROGRESS, value=1, max_value=1, done=1, sub_type=self.SUB_PROGRESS,
value=1,
max_value=1,
done=1,
) )
return return
@ -105,8 +107,7 @@ class EpicsMotorX(EpicsMotor):
class EpicsPassiveRO(EpicsSignalRO): class EpicsPassiveRO(EpicsSignalRO):
""" Small helper class to read PVs that need to be processed first. """Small helper class to read PVs that need to be processed first."""
"""
def __init__(self, read_pv, *, string=False, name=None, **kwargs): def __init__(self, read_pv, *, string=False, name=None, **kwargs):
super().__init__(read_pv, string=string, name=name, **kwargs) super().__init__(read_pv, string=string, name=name, **kwargs)
@ -237,7 +238,10 @@ class aa1Tasks(Device):
"""Progress update on the scan""" """Progress update on the scan"""
value = self.progress() value = self.progress()
self._run_subs( self._run_subs(
sub_type=self.SUB_PROGRESS, value=value, max_value=1, done=1, sub_type=self.SUB_PROGRESS,
value=value,
max_value=1,
done=1,
) )
def _progress(self) -> None: def _progress(self) -> None:
@ -288,8 +292,7 @@ class aa1Tasks(Device):
return raw return raw
def configure(self, d: dict = {}) -> tuple: def configure(self, d: dict = {}) -> tuple:
""" Configuration interface for flying """Configuration interface for flying"""
"""
# Unrolling the configuration dict # Unrolling the configuration dict
text = str(d["text"]) if "text" in d else None text = str(d["text"]) if "text" in d else None
filename = str(d["filename"]) if "filename" in d else None filename = str(d["filename"]) if "filename" in d else None
@ -1028,7 +1031,10 @@ class aa1AxisPsoDistance(aa1AxisPsoBase):
if self.dstArrayDepleted.value: if self.dstArrayDepleted.value:
print("PSO array depleted") print("PSO array depleted")
self._run_subs( self._run_subs(
sub_type=self.SUB_PROGRESS, value=1, max_value=1, done=1, sub_type=self.SUB_PROGRESS,
value=1,
max_value=1,
done=1,
) )
return return
@ -1393,7 +1399,10 @@ class aa1AxisDriveDataCollection(Device):
"""Progress update on the scan""" """Progress update on the scan"""
if self.state.value not in (2, "Acquiring"): if self.state.value not in (2, "Acquiring"):
self._run_subs( self._run_subs(
sub_type=self.SUB_PROGRESS, value=1, max_value=1, done=1, sub_type=self.SUB_PROGRESS,
value=1,
max_value=1,
done=1,
) )
return return