Code indexing in gitaly is broken and leads to code not being visible to the user. We work on the issue with highest priority.

Skip to content

Add PSIComponent and custom signal class for BECMessages

appel_c requested to merge feature/custom_psi_component into main

Description

This MR introduces new custom signals (ophyd_devices.utils.psi_signals) and components (ophyd_devices.utils.psi_components). It is in preparation for an improvement for getting more explicit signals available on devices. It adds new tests and a test device that can be used to test the new components/signals ophyd_devices.sim.sim_test_devices.SimCameraWithPSIComponents. In addition, it also adds a bugfix for PSIDeviceBase.

Related Issues

closes #98 closes #95 #94

Additional Information

All new components ProgressComponent, FileEventComponent, Preview1dComponent, Preview2dComponent and DynamicSignalComponent will create a specific signal with Kind.omitted. Any kind passed through kwargs will be ignored. The idea is to subscribe to these specific signals on the device server, and automatically send the information to the correct endpoints in REDIS. Therefore, all of these components have BECMessages as return values for the specific signals that they use, i.e. ProgressSignal, FileEventSignal, etc...

In addition to the upper components, this MR also introduces 2 more that should be able to solve the uncertainties with asynchronous signals. The Async2DComponent & Async1DComponent are meant to be used to specify async signals. Data may be submitted through these signals (example at Debye: NIDAQ with EPICS emitter), or directly by a backend to REDIS (NIDAQ board for the BEC emitter). The components are DynamicDeviceComponents, and allow us to create a sub-device with various signals. Signals in that namespace can have any type of Kind that is desired. However, the sub-device created by the 1/2D async components will be Kind.omitted. Again, this means that these signals will not be read when read is called on a device, however, they will be read when read is called on the sub-device. This allows us to also use kind.hinted/normal/config on async signals to specify for instance desired plotting behavior.

To test, simply use the test device ophyd_devices.sim.sim_test_devices.SimCameraWithPSIComponents, either in IPython or directly in BEC.

test_cam:
  readoutPriority: async
  deviceClass: ophyd_devices.sim.sim_test_devices.SimCameraWithPSIComponents #ophyd_devices.SimCamera
  deviceConfig:
    device_access: true
  deviceTags:
    - detector
  enabled: true
  readOnly: false
  softwareTrigger: true

Please keep in mind that from within bec, you would have to read with cached=False to force a reading

test_cam.async_1d.read(cached=False)

Next steps

Once merged, the respective callbacks can be introduced on the device server. To start with, they would exist in parallel with the old callbacks. Once properly tested, we can discuss to deprecate the old callbacks and thereby hopefully get rid of the need to use _run_subs on the device level. We also discussed that Preview1D and Preview2D should probably be signal specific, thus, the DeviceMonitor2DMessage and DeviceMonitor1DMessage should not only have a device, but also a signal.

Definition of Done

  • Documentation is up-to-date. (pending, together with device integration)
Edited by appel_c

Merge request reports

Loading