feat: add simulated devices for endstation, fsh and ddg1
CI for csaxs_bec / test (push) Successful in 2m2s
CI for csaxs_bec / test (pull_request) Successful in 1m59s

This commit is contained in:
2026-04-21 18:00:33 +02:00
parent 2bfef84004
commit ff0442e601
4 changed files with 68 additions and 0 deletions
@@ -0,0 +1,18 @@
ddg1:
description: Main delay Generator for triggering
deviceClass: csaxs_bec.devices.sim.simulated_beamline_devices.SimulatedDDG1
enabled: true
deviceConfig:
prefix: 'X12SA-CPCL-DDG1:'
onFailure: raise
readOnly: false
readoutPriority: baseline
softwareTrigger: true
fsh:
description: Fast shutter manual control and readback
deviceClass: csaxs_bec.devices.sim.simulated_beamline_devices.cSAXSSimulatedFastShutter
deviceConfig:
prefix: 'X12SA-ES1-TTL:'
onFailure: raise
enabled: true
readoutPriority: monitored
View File
@@ -0,0 +1,50 @@
"""This module contains simulated versions of beamline devices relevant for running simulated experiments."""
from __future__ import annotations
from ophyd import Device
from ophyd_devices import StatusBase
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
class cSAXSSimulatedFastShutter(Device):
"""
Simulated version of the cSAXS Fast Shutter.
To set up initial signal to specific values, please use the example below:
fsh.shutter._read_pv.mock_data = 1 #
-> with 'shutter' being a signal of the shutter device
"""
def __new__(cls, *args, **kwargs):
with patched_device(cSAXSFastEpicsShutter, *args, **kwargs) as fsh:
# fsh.shutter._read_pv.mock_data = 1 # Set mock data if needed
return fsh
class DDG1WithPatchedStage(DDG1):
"""
Simulated version of the DDG1 with patched stage method.
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_trigger(self):
"""
We overwrite and patch the on_trigger method. This resolves immediately now and
sets the status to finished, instead of waiting for the trigger logic to complete.
"""
# Change logic if needed
status = StatusBase(obj=self)
status.set_finished()
return status
class SimulatedDDG1(Device):
def __new__(cls, *args, **kwargs):
with patched_device(DDG1, *args, **kwargs) as ddg1:
return ddg1