DiamondLightSource / DiamondLightSource/dodal

Beamsize device should take a list of signals/constants

Open
#1,729 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
5
Forks
13
Avg merge
3d 2h
Merged PRs (30d)
10

Description

The beamsize devices created for i03/i04 in https://github.com/DiamondLightSource/dodal/pull/1704 can be made generic by having a single device that takes a list of signals/constants and gives the minimum of them all. e.g. something like:
```python
class Beamsize(BeamsizeBase):
def __init__(
self,
x_signals:list[SignalR|float],
y_signals:list[SignalR|float],
):
super().__init__(name=name)

self.x_um = derived_signal_r(
self._get_beamsize_x,
x_signals=x_signals,
derived_units="µm",
)
self.y_um = derived_signal_r(
self._get_beamsize_y,
y_signals=y_signals,
derived_units="µm",
)

def _get_beamsize_x(
self,
x_signals: list[float],
) -> float:
return min(*x_signals)

def _get_beamsize_y(
self,
y_signals: list[float],
) -> float:
return min(*y_signals)
```
This won't work exactly like that because derived_signal won't play nice with lists of signals, especially where one of those things might not be a signal but a constant. We could maybe get round the constant thing by making a dummy soft signal that just has the constant value though. It may that we will need to discuss with `ophyd-async` devs the best way to do this.

## Acceptance Criteria
* There is one generic beamsize device that works for i03/i04

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.