mirror of
https://github.com/bec-project/ophyd_devices.git
synced 2026-11-03 03:33:36 +01:00
fix(signals): rename acquisition_group to correlation_group
This commit is contained in:
1 parent
6c6ed38e93
commit
b556271159
6 files changed
+51
-51
No files matched your search
+2
-2
@@ -166,7 +166,7 @@
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- **sim_waveform**: Add acquisition_group to waveform_0d component
|
||||
- **sim_waveform**: Add correlation_group to waveform_0d component
|
||||
([`42ea005`](https://github.com/bec-project/ophyd_devices/commit/42ea005769d1ce7bb2ea893b728245edbfeff17d))
|
||||
|
||||
### Documentation
|
||||
@@ -919,7 +919,7 @@ Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
||||
|
||||
### Features
|
||||
|
||||
- **bec-signals**: Add acquisition group to BECMessageSignal and SignalInfo
|
||||
- **bec-signals**: Add correlation group to BECMessageSignal and SignalInfo
|
||||
([`9b51b22`](https://github.com/bec-project/ophyd_devices/commit/9b51b22671a6ff2b78576f75834c061d6835d8af))
|
||||
|
||||
### Refactoring
|
||||
|
||||
@@ -276,7 +276,7 @@ class PandaBox(PSIDeviceBase):
|
||||
self.data_thread_run_event = threading.Event()
|
||||
|
||||
# Acquisition group of the PandaBox data.
|
||||
self._acquisition_group = "panda"
|
||||
self._correlation_group = "panda"
|
||||
|
||||
# Timeouts for wait operations in seconds
|
||||
self._stage_timeout_in_s = 3
|
||||
@@ -724,7 +724,7 @@ class PandaBox(PSIDeviceBase):
|
||||
data (FrameData): The frame data received from the PandaBox. This contains the actual data acquired from the PandaBox.
|
||||
"""
|
||||
out = self.convert_frame_data(frame_data=data)
|
||||
self.data.put(out, acquisition_group=self._acquisition_group)
|
||||
self.data.put(out, correlation_group=self._correlation_group)
|
||||
|
||||
def _get_signal_names_allowed_for_capture(self) -> list[str]:
|
||||
"""Utility method to get a list of all signal keys that CAN BE CONFIGURED for capture on the PandaBox."""
|
||||
|
||||
@@ -59,7 +59,7 @@ class SimWaveform(Device):
|
||||
ndim=0,
|
||||
max_size=1000,
|
||||
kind=Kind.hinted,
|
||||
acquisition_group="monitored",
|
||||
correlation_group="monitored",
|
||||
)
|
||||
data = Cpt(AsyncSignal, name="data", ndim=1, max_size=1000)
|
||||
# add extends the stream, add_slice assembles waveforms, replace keeps the latest waveform.
|
||||
|
||||
@@ -53,7 +53,7 @@ class BECMessageSignal(Signal):
|
||||
ndim: Literal[0, 1, 2] | None = None,
|
||||
scope: Literal["scan", "continuous"] = "scan",
|
||||
role: Literal["main", "preview", "diagnostic", "file_event", "progress"] = "main",
|
||||
acquisition_group: Literal["baseline", "monitored"] | str | None = None,
|
||||
correlation_group: Literal["baseline", "monitored"] | str | None = None,
|
||||
enabled: bool = True,
|
||||
use_alias: bool = False,
|
||||
signals: _SignalsTypes | Callable[[], _SignalsTypes] = None,
|
||||
@@ -93,7 +93,7 @@ class BECMessageSignal(Signal):
|
||||
use_alias=use_alias,
|
||||
signals=self._unify_signals(signals),
|
||||
signal_metadata=signal_metadata or {},
|
||||
acquisition_group=acquisition_group,
|
||||
correlation_group=correlation_group,
|
||||
)
|
||||
self._root_resolved_signal_key = root_resolved_signal_key
|
||||
self._register_root_resolved_signal()
|
||||
@@ -722,7 +722,7 @@ class DynamicSignal(BECMessageSignal):
|
||||
signals: list[str] | Callable[[], list[str]] | str | None = None,
|
||||
value: messages.DeviceMessage | dict | None = None,
|
||||
async_update: dict[Literal["type", "max_shape", "index"], Any] | None = None,
|
||||
acquisition_group: Literal["baseline", "monitored"] | str | None = None,
|
||||
correlation_group: Literal["baseline", "monitored"] | str | None = None,
|
||||
use_alias: bool = False,
|
||||
**kwargs,
|
||||
):
|
||||
@@ -734,7 +734,7 @@ class DynamicSignal(BECMessageSignal):
|
||||
max_size (int): The maximum number of entries in the signal group. This is required for BEC to know how much data to expect.
|
||||
signal_names (list[str] | Callable): Names of all signals. Can be a list or a callable.
|
||||
value (DeviceMessage | dict | None): The initial value of the signal. Defaults to None.
|
||||
acquisition_group (Literal["baseline", "monitored"] | str | None): The acquisition group of the signal group.
|
||||
correlation_group (Literal["baseline", "monitored"] | str | None): The correlation group of the signal group.
|
||||
use_alias (bool): Indicates whether the signal should alias an EPICS signal or list of EPICS signals. Defaults to False.
|
||||
async_update (dict | None): Additional metadata for asynchronous updates.
|
||||
There are three relevant keys "type", "max_shape" and "index".
|
||||
@@ -780,7 +780,7 @@ class DynamicSignal(BECMessageSignal):
|
||||
signals=signals,
|
||||
value=value,
|
||||
bec_message_type=kwargs.pop("bec_message_type", messages.DeviceMessage),
|
||||
acquisition_group=acquisition_group,
|
||||
correlation_group=correlation_group,
|
||||
signal_metadata={"max_size": max_size},
|
||||
**kwargs,
|
||||
)
|
||||
@@ -792,7 +792,7 @@ class DynamicSignal(BECMessageSignal):
|
||||
*,
|
||||
metadata: dict | None = None,
|
||||
async_update: dict[Literal["type", "max_shape", "index"], Any] | None = None,
|
||||
acquisition_group: Literal["baseline", "monitored"] | str | None = None,
|
||||
correlation_group: Literal["baseline", "monitored"] | str | None = None,
|
||||
**kwargs,
|
||||
) -> None:
|
||||
"""
|
||||
@@ -806,12 +806,12 @@ class DynamicSignal(BECMessageSignal):
|
||||
value (dict | DeviceMessage): The dynamic device data.
|
||||
metadata (dict | None): Additional metadata.
|
||||
async_update (dict[Literal["type", "max_shape", "index"], Any] | None): Additional metadata for asynchronous updates.
|
||||
acquisition_group (Literal["baseline", "monitored"] | str | None): The acquisition group of the signal group.
|
||||
correlation_group (Literal["baseline", "monitored"] | str | None): The correlation group of the signal group.
|
||||
"""
|
||||
if isinstance(value, messages.DeviceMessage):
|
||||
if metadata is not None or async_update is not None or acquisition_group is not None:
|
||||
if metadata is not None or async_update is not None or correlation_group is not None:
|
||||
logger.warning(
|
||||
"Ignoring metadata, async_update and acquisition_group arguments when value is a DeviceMessage."
|
||||
"Ignoring metadata, async_update and correlation_group arguments when value is a DeviceMessage."
|
||||
)
|
||||
self._check_signals(value)
|
||||
self._check_async_update(value)
|
||||
@@ -822,10 +822,10 @@ class DynamicSignal(BECMessageSignal):
|
||||
metadata["async_update"] = async_update
|
||||
elif self.async_update is not None:
|
||||
metadata["async_update"] = self.async_update
|
||||
if acquisition_group is not None:
|
||||
metadata["acquisition_group"] = acquisition_group
|
||||
elif self.signal_info.acquisition_group is not None:
|
||||
metadata["acquisition_group"] = self.signal_info.acquisition_group
|
||||
if correlation_group is not None:
|
||||
metadata["correlation_group"] = correlation_group
|
||||
elif self.signal_info.correlation_group is not None:
|
||||
metadata["correlation_group"] = self.signal_info.correlation_group
|
||||
|
||||
msg = messages.DeviceMessage(signals=value, metadata=metadata)
|
||||
except ValidationError as exc:
|
||||
@@ -909,7 +909,7 @@ class DynamicSignal(BECMessageSignal):
|
||||
*,
|
||||
metadata: dict | None = None,
|
||||
async_update: dict[Literal["type", "max_shape", "index"], Any] | None = None,
|
||||
acquisition_group: Literal["baseline", "monitored"] | str | None = None,
|
||||
correlation_group: Literal["baseline", "monitored"] | str | None = None,
|
||||
**kwargs,
|
||||
) -> DeviceStatus:
|
||||
"""
|
||||
@@ -927,7 +927,7 @@ class DynamicSignal(BECMessageSignal):
|
||||
value,
|
||||
metadata=metadata,
|
||||
async_update=async_update,
|
||||
acquisition_group=acquisition_group,
|
||||
correlation_group=correlation_group,
|
||||
**kwargs,
|
||||
)
|
||||
status = DeviceStatus(device=self)
|
||||
@@ -948,7 +948,7 @@ class AsyncMultiSignal(DynamicSignal):
|
||||
max_size: int,
|
||||
signals: list[str] | Callable[[], list[str]],
|
||||
value: messages.DeviceMessage | dict | None = None,
|
||||
acquisition_group: Literal["baseline", "monitored"] | str | None = None,
|
||||
correlation_group: Literal["baseline", "monitored"] | str | None = None,
|
||||
async_update: dict[Literal["type", "max_shape", "index"], Any] | None = None,
|
||||
use_alias: bool = False,
|
||||
**kwargs,
|
||||
@@ -962,7 +962,7 @@ class AsyncMultiSignal(DynamicSignal):
|
||||
max_size (int): The maximum size of the signal buffer. For ndim=2, this should be kept small to avoid large memory usage.
|
||||
signals (list[str] | Callable[[], list[str]]): The names of all sub-signals. Names will be prefixed with the group name.
|
||||
value (AsyncMessage | dict | None): The initial value of the signal. Defaults to None.
|
||||
acquisition_group (Literal["baseline", "monitored"] | str | None): The acquisition group of the signal group.
|
||||
correlation_group (Literal["baseline", "monitored"] | str | None): The correlation group of the signal group.
|
||||
use_alias (bool): Indicates whether the signal should alias an EPICS signal or list of EPICS signals. Defaults to False.
|
||||
async_update (dict | None): Additional metadata for asynchronous updates.
|
||||
There are three relevant keys "type", "max_shape" and "index".
|
||||
@@ -1009,7 +1009,7 @@ class AsyncMultiSignal(DynamicSignal):
|
||||
bec_message_type=messages.DeviceMessage,
|
||||
async_update=async_update,
|
||||
max_size=max_size,
|
||||
acquisition_group=acquisition_group,
|
||||
correlation_group=correlation_group,
|
||||
use_alias=use_alias,
|
||||
signals=signals,
|
||||
**kwargs,
|
||||
@@ -1028,7 +1028,7 @@ class AsyncSignal(DynamicSignal):
|
||||
ndim: Literal[0, 1, 2],
|
||||
max_size: int,
|
||||
value: messages.DeviceMessage | dict | None = None,
|
||||
acquisition_group: Literal["baseline", "monitored"] | str | None = None,
|
||||
correlation_group: Literal["baseline", "monitored"] | str | None = None,
|
||||
async_update: dict[Literal["type", "max_shape", "index"], Any] | None = None,
|
||||
use_alias: bool = False,
|
||||
**kwargs,
|
||||
@@ -1041,7 +1041,7 @@ class AsyncSignal(DynamicSignal):
|
||||
ndim (Literal[0, 1, 2]): The number of dimensions of the signals.
|
||||
max_size (int): The maximum size of the signal buffer. For ndim=2, this should be kept small to avoid large memory usage.
|
||||
value (AsyncMessage | dict | None): The initial value of the signal. Defaults to None.
|
||||
acquisition_group (Literal["baseline", "monitored"] | str | None): The acquisition group of the signal group.
|
||||
correlation_group (Literal["baseline", "monitored"] | str | None): The correlation group of the signal group.
|
||||
use_alias (bool): Indicates whether the signal should alias an EPICS signal or list of EPICS signals. Defaults to False.
|
||||
async_update (dict | None): Additional metadata for asynchronous updates.
|
||||
There are three relevant keys "type", "max_shape" and "index".
|
||||
@@ -1083,7 +1083,7 @@ class AsyncSignal(DynamicSignal):
|
||||
bec_message_type=messages.DeviceMessage,
|
||||
async_update=async_update,
|
||||
max_size=max_size,
|
||||
acquisition_group=acquisition_group,
|
||||
correlation_group=correlation_group,
|
||||
use_alias=use_alias,
|
||||
signals=None,
|
||||
**kwargs,
|
||||
@@ -1094,7 +1094,7 @@ class AsyncSignal(DynamicSignal):
|
||||
value: Any,
|
||||
timestamp: float | list[float] | None = None,
|
||||
async_update: dict[Literal["type", "max_shape", "index"], Any] | None = None,
|
||||
acquisition_group: str | None = None,
|
||||
correlation_group: str | None = None,
|
||||
**kwargs,
|
||||
) -> None:
|
||||
"""
|
||||
@@ -1104,13 +1104,13 @@ class AsyncSignal(DynamicSignal):
|
||||
value (Any): The value to put.
|
||||
timestamp (float | list[float] | None): A timestamp or per-reading timestamps. If None, the current time is used.
|
||||
async_update (dict[Literal["type", "max_shape", "index"], Any] | None): Additional metadata for asynchronous updates. Please refer to the class docstring for details.
|
||||
acquisition_group (Literal["baseline", "monitored"] | str | None): The acquisition group of the signal.
|
||||
correlation_group (Literal["baseline", "monitored"] | str | None): The correlation group of the signal.
|
||||
"""
|
||||
timestamp = time.time() if timestamp is None else timestamp
|
||||
super().put(
|
||||
value={self.name: {"value": value, "timestamp": timestamp}},
|
||||
async_update=async_update,
|
||||
acquisition_group=acquisition_group,
|
||||
correlation_group=correlation_group,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
@@ -1119,7 +1119,7 @@ class AsyncSignal(DynamicSignal):
|
||||
value: Any,
|
||||
timestamp: float | list[float] | None = None,
|
||||
async_update: dict[Literal["type", "max_shape", "index"], Any] | None = None,
|
||||
acquisition_group: str | None = None,
|
||||
correlation_group: str | None = None,
|
||||
**kwargs,
|
||||
) -> DeviceStatus:
|
||||
"""
|
||||
@@ -1129,13 +1129,13 @@ class AsyncSignal(DynamicSignal):
|
||||
value (Any): The value to put.
|
||||
timestamp (float | list[float] | None): A timestamp or per-reading timestamps. If None, the current time is used.
|
||||
async_update (dict[Literal["type", "max_shape", "index"], Any] | None): Additional metadata for asynchronous updates. Please refer to the class docstring for details.
|
||||
acquisition_group (Literal["baseline", "monitored"] | str | None): The acquisition group of the signal.
|
||||
correlation_group (Literal["baseline", "monitored"] | str | None): The correlation group of the signal.
|
||||
"""
|
||||
self.put(
|
||||
value=value,
|
||||
timestamp=timestamp,
|
||||
async_update=async_update,
|
||||
acquisition_group=acquisition_group,
|
||||
correlation_group=correlation_group,
|
||||
**kwargs,
|
||||
)
|
||||
status = DeviceStatus(device=self)
|
||||
|
||||
+3
-3
@@ -171,7 +171,7 @@ def test_panda_receive_frame_data(panda_box, _signal_aliases):
|
||||
}
|
||||
md = {
|
||||
"async_update": {"type": "add", "max_shape": [None]},
|
||||
"acquisition_group": panda_box._acquisition_group,
|
||||
"correlation_group": panda_box._correlation_group,
|
||||
}
|
||||
d = panda_box.data.read()
|
||||
assert d[panda_box.data.name]["value"].metadata == md, "Metadata mismatch"
|
||||
@@ -214,7 +214,7 @@ def test_panda_on_destroy(panda_box):
|
||||
|
||||
|
||||
def test_panda_on_stage_on_unstage(panda_box):
|
||||
"""Test that on_stage sets the acquisition group."""
|
||||
"""Test that on_stage sets the correlation group."""
|
||||
panda_box.panda_state = PandaState.DISARMED
|
||||
panda_box.stage()
|
||||
assert panda_box.data_thread_run_event.is_set(), "Data thread run event not set"
|
||||
@@ -308,7 +308,7 @@ def test_panda_get_signal_names_configured_for_capture(panda_box):
|
||||
|
||||
|
||||
def test_panda_pre_scan_status_callback(panda_box):
|
||||
"""Test that pre_scan_status_callback sets the acquisition group."""
|
||||
"""Test that pre_scan_status_callback sets the correlation group."""
|
||||
with mock.patch.object(panda_box, "_arm") as mock_arm:
|
||||
# I. Called with status that is not done, should do nothing
|
||||
status = StatusBase(obj=panda_box)
|
||||
|
||||
+16
-16
@@ -271,7 +271,7 @@ def test_utils_bec_message_signal():
|
||||
"rpc_access": False,
|
||||
"signals": [("bec_message_signal", 5)],
|
||||
"signal_metadata": {},
|
||||
"acquisition_group": None,
|
||||
"correlation_group": None,
|
||||
"use_alias": False,
|
||||
},
|
||||
}
|
||||
@@ -414,7 +414,7 @@ def test_utils_dynamic_signal():
|
||||
"rpc_access": False,
|
||||
"signals": [("sig1", 1), ("sig2", 1)],
|
||||
"signal_metadata": {"max_size": 10},
|
||||
"acquisition_group": None,
|
||||
"correlation_group": None,
|
||||
"use_alias": False,
|
||||
},
|
||||
}
|
||||
@@ -442,10 +442,10 @@ def test_utils_dynamic_signal():
|
||||
with pytest.raises(TypeCheckError):
|
||||
signal.put({"wrong_key": "wrong_value"})
|
||||
|
||||
# Set with acquisition group
|
||||
signal.put(msg, acquisition_group="fly-scan")
|
||||
# Set with correlation group
|
||||
signal.put(msg, correlation_group="fly-scan")
|
||||
reading = signal.read()
|
||||
msg.metadata["acquisition_group"] = "fly-scan"
|
||||
msg.metadata["correlation_group"] = "fly-scan"
|
||||
assert reading[signal.name]["value"] == msg
|
||||
|
||||
|
||||
@@ -467,7 +467,7 @@ def test_utils_dynamic_signal_use_alias():
|
||||
|
||||
def test_utils_dynamic_signal_with_defaults():
|
||||
"""
|
||||
Test DynamicSignal with async_update and acquisition group defaults. If only
|
||||
Test DynamicSignal with async_update and correlation group defaults. If only
|
||||
one sub-signal is provided for the dynamic signal, the name of the sub-signal
|
||||
will be used in the signals dict and a warning will be issued that the sub-signal
|
||||
name is being ignored.
|
||||
@@ -481,7 +481,7 @@ def test_utils_dynamic_signal_with_defaults():
|
||||
value=None,
|
||||
max_size=10,
|
||||
async_update={"type": "add", "max_shape": [None, 1000]},
|
||||
acquisition_group="fly-scanning",
|
||||
correlation_group="fly-scanning",
|
||||
)
|
||||
signal = create_signal(signals=["sig1", "sig2"])
|
||||
val = np.random.random(1000)
|
||||
@@ -491,11 +491,11 @@ def test_utils_dynamic_signal_with_defaults():
|
||||
reading_value = reading[signal.name]["value"].model_dump(exclude={"timestamp"})
|
||||
assert reading_value["signals"] == msg_dict
|
||||
assert reading_value["metadata"]["async_update"] == {"type": "add", "max_shape": [None, 1000]}
|
||||
assert reading_value["metadata"]["acquisition_group"] == "fly-scanning"
|
||||
assert reading_value["metadata"]["correlation_group"] == "fly-scanning"
|
||||
|
||||
signal.put(msg_dict, acquisition_group="different-group")
|
||||
signal.put(msg_dict, correlation_group="different-group")
|
||||
reading = signal.read()
|
||||
assert reading[signal.name]["value"].metadata["acquisition_group"] == "different-group"
|
||||
assert reading[signal.name]["value"].metadata["correlation_group"] == "different-group"
|
||||
|
||||
# Test init variations for single signal
|
||||
for signal in [["sig1"], "sig1", None]:
|
||||
@@ -559,7 +559,7 @@ def test_utils_async_signal():
|
||||
signal.put(
|
||||
val,
|
||||
async_update={"type": "add_slice", "max_shape": [None, 1000], "index": 1},
|
||||
acquisition_group="scan",
|
||||
correlation_group="scan",
|
||||
)
|
||||
reading = signal.read()
|
||||
reading_value = reading[signal.name]["value"].model_dump(exclude={"timestamp"})
|
||||
@@ -569,7 +569,7 @@ def test_utils_async_signal():
|
||||
"max_shape": [None, 1000],
|
||||
"index": 1,
|
||||
}
|
||||
assert reading_value["metadata"]["acquisition_group"] == "scan"
|
||||
assert reading_value["metadata"]["correlation_group"] == "scan"
|
||||
|
||||
|
||||
@pytest.mark.parametrize("timestamp", [0.0, [1.0, 2.0]])
|
||||
@@ -621,7 +621,7 @@ def test_utils_file_event_signal():
|
||||
"rpc_access": False,
|
||||
"signals": [("file_event_signal", 5)],
|
||||
"signal_metadata": {},
|
||||
"acquisition_group": None,
|
||||
"correlation_group": None,
|
||||
"use_alias": False,
|
||||
},
|
||||
}
|
||||
@@ -674,7 +674,7 @@ def test_utils_preview_1d_signal():
|
||||
"rpc_access": False,
|
||||
"signals": [("preview_1d_signal", 5)],
|
||||
"signal_metadata": {"num_rotation_90": 0, "transpose": False},
|
||||
"acquisition_group": None,
|
||||
"correlation_group": None,
|
||||
"use_alias": False,
|
||||
},
|
||||
}
|
||||
@@ -738,7 +738,7 @@ def test_utils_preview_2d_signal():
|
||||
"rpc_access": False,
|
||||
"signals": [("preview_2d_signal", 5)],
|
||||
"signal_metadata": {"num_rotation_90": 0, "transpose": False},
|
||||
"acquisition_group": None,
|
||||
"correlation_group": None,
|
||||
"use_alias": False,
|
||||
},
|
||||
}
|
||||
@@ -840,7 +840,7 @@ def test_utils_progress_signal():
|
||||
"rpc_access": False,
|
||||
"signals": [("progress_signal", 5)],
|
||||
"signal_metadata": {},
|
||||
"acquisition_group": None,
|
||||
"correlation_group": None,
|
||||
"use_alias": False,
|
||||
},
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user