EPICS: Allow reading partial waveforms (first N elements) - #1253
EPICS: Allow reading partial waveforms (first N elements)#1253PierreSchnizer wants to merge 33 commits into
Conversation
…ector WARNING: work in progress
|
I like the concept, but we need to make sure both CA and PVA can do this.
Would you be able to try this out for PVA as well please? |
|
Yes I will try to get it running with P4P |
|
Sorry I was detoured by other tasks. |
|
Sorry for the delay. I expected much more work to verify what Claude suggested. from p4p.client.thread import Context
pv_name = "MY:WF"
ctx = Context()
start, end = 10, 15
slice = ctx.get(f"{pv_name}.[{start}:{end}]")I have a look how it could be added. |
**Note**: p4p can only handle 2 elements or more
mocks always return the full array not part of it yet
real server if available
|
Backends p4p and aioca are tested that conistent outputs are made for methods I am not sure if set_callback should be addressed too, as it also uses the readpv: see line |
Yes please, set_callback should also be updated to do the same. Also, please could you put the tests in |
…objects must derive from Standardreadable
…d names and connect the signals
…vice, updated reference All signals in _device.Devices must be instaniaable
|
set_callback implemented and tested Moved tests to tests/system_tests/epics/core/test_epics_signal_mechanisms.py Now epics.testing._devices.EpicsTestCaDevice derives from StandardReadable. Thus this device needs to have a name when instaniated. It will not work without the name. It would be nice if StandardReadble could check for that (but I don't know how to implement it) |
works for ca but not for p4p as pvaccess needs at least 2 elements
Large EPICS waveforms (array-valued signals) are currently always transferred in full, even when only a small subset of the data is needed.
For high-rate acquisitions, data is buffered continuously but read out on trigger. In typical use, users select only a small portion of that buffer. Transferring the full array in these cases creates unnecessary network load and does not scale well.
This has a measurable impact in practice: at BESSY II, reading out all ~120 BPMs doubles measurement time due to the volume of data transferred. As a workaround, users are forced to limit the number of devices instead of using all available data sources.
This PR adds support for reading only the first N elements of a waveform (i.e. partial reads of array/spectrum data). It uses the EPICS Channel Access n_elements feature and exposes it via epics_options when defining a signal.
The implementation is currently EPICS-specific. It supports 1 or more elements for channel access and 2 or more elements for pva, as pva only supports only slices above 2 elements. PVA supports slices from start..end, which is limited to 0..end to be compliant what ca provides.
As an example use case, beam position monitors (e.g. Libera Spark, Brilliance) produce turn-by-turn data at ~1 µs intervals and store it in buffers of up to 65k samples. In many applications, only the first few samples are required, making full data transfer unnecessary.