diff --git a/ophyd_devices/epics/devices/eiger9m_csaxs.py b/ophyd_devices/epics/devices/eiger9m_csaxs.py index 0b2c1aa..f2429dd 100644 --- a/ophyd_devices/epics/devices/eiger9m_csaxs.py +++ b/ophyd_devices/epics/devices/eiger9m_csaxs.py @@ -205,7 +205,7 @@ class Eiger9MSetup(CustomDetectorMixin): def prepare_data_backend(self) -> None: """Prepare the data backend for the scan""" self.parent.filepath = self.parent.filewriter.compile_full_filename( - self.parent.scaninfo.scan_number, f"{self.parent.name}.h5", 1000, 5, True + f"{self.parent.name}.h5" ) self.filepath_exists(self.parent.filepath) self.stop_detector_backend() diff --git a/ophyd_devices/epics/devices/falcon_csaxs.py b/ophyd_devices/epics/devices/falcon_csaxs.py index 5b6bc70..ddcc385 100644 --- a/ophyd_devices/epics/devices/falcon_csaxs.py +++ b/ophyd_devices/epics/devices/falcon_csaxs.py @@ -184,7 +184,7 @@ class FalconSetup(CustomDetectorMixin): def prepare_data_backend(self) -> None: """Prepare data backend for acquisition""" self.parent.filepath = self.parent.filewriter.compile_full_filename( - self.parent.scaninfo.scan_number, f"{self.parent.name}.h5", 1000, 5, True + f"{self.parent.name}.h5" ) file_path, file_name = os.path.split(self.parent.filepath) self.parent.hdf5.file_path.put(file_path) diff --git a/ophyd_devices/epics/devices/pilatus_csaxs.py b/ophyd_devices/epics/devices/pilatus_csaxs.py index fd62695..4a8ed86 100644 --- a/ophyd_devices/epics/devices/pilatus_csaxs.py +++ b/ophyd_devices/epics/devices/pilatus_csaxs.py @@ -188,9 +188,7 @@ class PilatusSetup(CustomDetectorMixin): self.stop_detector_backend() - self.parent.filepath = self.parent.filewriter.compile_full_filename( - self.parent.scaninfo.scan_number, "pilatus_2.h5", 1000, 5, True - ) + self.parent.filepath = self.parent.filewriter.compile_full_filename("pilatus_2.h5") self.parent.cam.file_path.put("/dev/shm/zmq/") self.parent.cam.file_name.put( f"{self.parent.scaninfo.username}_2_{self.parent.scaninfo.scan_number:05d}" diff --git a/ophyd_devices/epics/devices/psi_detector_base.py b/ophyd_devices/epics/devices/psi_detector_base.py index f8ee8d8..afa573e 100644 --- a/ophyd_devices/epics/devices/psi_detector_base.py +++ b/ophyd_devices/epics/devices/psi_detector_base.py @@ -2,7 +2,7 @@ import os import time from bec_lib.device import DeviceStatus -from bec_lib.file_utils import FileWriterMixin +from bec_lib.file_utils import FileWriter from ophyd import Device from ophyd.device import Staged @@ -235,7 +235,7 @@ class PSIDetectorBase(Device): def _update_filewriter(self) -> None: """Update filewriter with service config""" - self.filewriter = FileWriterMixin(self.service_cfg) + self.filewriter = FileWriter(service_config=self.service_cfg, connector=self.connector) def _update_scaninfo(self) -> None: """Update scaninfo from BecScaninfoMixing diff --git a/ophyd_devices/ophyd_base_devices/bec_protocols.py b/ophyd_devices/ophyd_base_devices/bec_protocols.py index 6343727..abd234d 100644 --- a/ophyd_devices/ophyd_base_devices/bec_protocols.py +++ b/ophyd_devices/ophyd_base_devices/bec_protocols.py @@ -18,7 +18,7 @@ Flyers in addition, also implement the BECFlyerProtocol. Similarly, positioners from typing import Protocol, runtime_checkable -from bec_lib.file_utils import FileWriterMixin +from bec_lib.file_utils import FileWriter from ophyd import Component, DeviceStatus, Kind, Staged from ophyd_devices.utils import bec_scaninfo_mixin @@ -47,11 +47,11 @@ class BECDeviceProtocol(Protocol): """kind setter""" @property - def parent(self): + def parent(self) -> object: """Property to find the parent device""" @property - def root(self): + def root(self) -> object: """Property to fint the root device""" @property @@ -169,7 +169,7 @@ class BECSignalProtocol(Protocol): bool: True if write access is allowed, False otherwise """ - def check_value(self, value: float): + def check_value(self, value: float) -> None: """Check whether value is within limits Args: @@ -230,7 +230,7 @@ class BECScanProtocol(BECDeviceProtocol, Protocol): We can further publish the file location for DAQ systems to BEC and inform BEC's file writer where data will be written to. - Stagin is not idempoent. If called twice without an unstage it should raise. + Stagin is not idempotent. If called twice without an unstage it should raise. For ophyd devices, one may used self._staged = True to check if the device is staged. Returns: @@ -246,7 +246,7 @@ class BECScanProtocol(BECDeviceProtocol, Protocol): inform BEC that the file has been succesfully written, or raise upon receiving feedback that the scan did not finish successful. - Unstaging is not idempotent. If called twice without a stage it should raise. + Unstaging is not idempotent. If called twice it should simply resolve. It is recommended to return super().unstage() in the child class, if the child class also inherits from ophyd repository. """ @@ -285,7 +285,7 @@ class BECMixinProtocol(Protocol): The stop method should set this flag to True, and i.e. stage to set it to False. """ - filewriter: FileWriterMixin + filewriter: FileWriter """ The file writer mixin main purpose is to unify and centralize the creation of file paths within BEC. Therefore, we recommend devices to use the same mixin for creation of paths. @@ -332,7 +332,7 @@ class BECPositionerProtocol(Protocol): float: Upper limit """ - def check_value(self, value: float): + def check_value(self, value: float) -> None: """Check whether value is within limits Args: diff --git a/tests/test_eiger9m_csaxs.py b/tests/test_eiger9m_csaxs.py index 7be017e..fbc77ba 100644 --- a/tests/test_eiger9m_csaxs.py +++ b/tests/test_eiger9m_csaxs.py @@ -27,9 +27,7 @@ def mock_det(): sim_mode = False dm = DMMock() with mock.patch.object(dm, "connector"): - with mock.patch( - "ophyd_devices.epics.devices.psi_detector_base.FileWriterMixin" - ), mock.patch( + with mock.patch("ophyd_devices.epics.devices.psi_detector_base.FileWriter"), mock.patch( "ophyd_devices.epics.devices.psi_detector_base.PSIDetectorBase._update_service_config" ): with mock.patch.object(ophyd, "cl") as mock_cl: @@ -50,9 +48,7 @@ def test_init(): sim_mode = False dm = DMMock() with mock.patch.object(dm, "connector"): - with mock.patch( - "ophyd_devices.epics.devices.psi_detector_base.FileWriterMixin" - ), mock.patch( + with mock.patch("ophyd_devices.epics.devices.psi_detector_base.FileWriter"), mock.patch( "ophyd_devices.epics.devices.psi_detector_base.PSIDetectorBase._update_service_config" ): with mock.patch.object(ophyd, "cl") as mock_cl: diff --git a/tests/test_falcon_csaxs.py b/tests/test_falcon_csaxs.py index 6154c77..11edea1 100644 --- a/tests/test_falcon_csaxs.py +++ b/tests/test_falcon_csaxs.py @@ -29,7 +29,7 @@ def mock_det(): dm = DMMock() with mock.patch.object(dm, "connector"): with mock.patch( - "ophyd_devices.epics.devices.psi_detector_base.FileWriterMixin" + "ophyd_devices.epics.devices.psi_detector_base.FileWriter" ) as filemixin, mock.patch( "ophyd_devices.epics.devices.psi_detector_base.PSIDetectorBase._update_service_config" ) as mock_service_config: diff --git a/tests/test_mcs_card.py b/tests/test_mcs_card.py index f519a19..f6382d9 100644 --- a/tests/test_mcs_card.py +++ b/tests/test_mcs_card.py @@ -34,7 +34,7 @@ def mock_det(): dm = DMMock() with mock.patch.object(dm, "connector"): with mock.patch( - "ophyd_devices.epics.devices.psi_detector_base.FileWriterMixin" + "ophyd_devices.epics.devices.psi_detector_base.FileWriter" ) as filemixin, mock.patch( "ophyd_devices.epics.devices.psi_detector_base.PSIDetectorBase._update_service_config" ) as mock_service_config: @@ -54,9 +54,7 @@ def test_init(): sim_mode = False dm = DMMock() with mock.patch.object(dm, "connector"): - with mock.patch( - "ophyd_devices.epics.devices.psi_detector_base.FileWriterMixin" - ), mock.patch( + with mock.patch("ophyd_devices.epics.devices.psi_detector_base.FileWriter"), mock.patch( "ophyd_devices.epics.devices.psi_detector_base.PSIDetectorBase._update_service_config" ): with mock.patch.object(ophyd, "cl") as mock_cl: diff --git a/tests/test_pilatus_csaxs.py b/tests/test_pilatus_csaxs.py index 7c8929f..1133946 100644 --- a/tests/test_pilatus_csaxs.py +++ b/tests/test_pilatus_csaxs.py @@ -28,9 +28,7 @@ def mock_det(): sim_mode = False dm = DMMock() with mock.patch.object(dm, "connector"): - with mock.patch( - "ophyd_devices.epics.devices.psi_detector_base.FileWriterMixin" - ), mock.patch( + with mock.patch("ophyd_devices.epics.devices.psi_detector_base.FileWriter"), mock.patch( "ophyd_devices.epics.devices.psi_detector_base.PSIDetectorBase._update_service_config" ): with mock.patch.object(ophyd, "cl") as mock_cl: