fix: Add logs for simulated DDG
This commit was merged in pull request #197.
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from bec_lib.logger import bec_logger
|
||||
from ophyd import Device
|
||||
from ophyd_devices import StatusBase
|
||||
from ophyd_devices.tests.utils import patched_device
|
||||
@@ -9,6 +10,8 @@ from ophyd_devices.tests.utils import patched_device
|
||||
from csaxs_bec.devices.epics.delay_generator_csaxs.ddg_1 import DDG1
|
||||
from csaxs_bec.devices.epics.fast_shutter import cSAXSFastEpicsShutter
|
||||
|
||||
logger = bec_logger.logger
|
||||
|
||||
|
||||
class cSAXSSimulatedFastShutter(Device):
|
||||
"""
|
||||
@@ -32,6 +35,12 @@ class DDG1WithPatchedStage(DDG1):
|
||||
We inherit here to be able to overwrite the on_stage method if needed, without compromising the rest of the device's functionality.
|
||||
"""
|
||||
|
||||
def on_stage(self):
|
||||
logger.warning(
|
||||
f"Staging of {self.name}. This is a simulated device of {self.__class__.__name__}."
|
||||
)
|
||||
super().on_stage()
|
||||
|
||||
def on_trigger(self):
|
||||
"""
|
||||
We overwrite and patch the on_trigger method. This resolves immediately now and
|
||||
@@ -46,5 +55,5 @@ class DDG1WithPatchedStage(DDG1):
|
||||
class SimulatedDDG1(Device):
|
||||
|
||||
def __new__(cls, *args, **kwargs):
|
||||
with patched_device(DDG1, *args, **kwargs) as ddg1:
|
||||
with patched_device(DDG1WithPatchedStage, *args, **kwargs) as ddg1:
|
||||
return ddg1
|
||||
|
||||
Reference in New Issue
Block a user