-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Suggestion: add dims to signal descriptor #1203
Comments
From my perspective I like this approach. It generalizes well to 2D and even 3D detectors by just changing the length of the list returned by |
I think this is a pretty cool idea. I'm interested what @coretl thinks and whether it's something that's already offered or planned in ophyd-async |
Thanks for the write-up, and for bringing this to my attention, I'd missed that you can label dims in event-model! One question on the above is why you separate the value of the axis_signal (returned in The current situation in
|
I may be wrong, but I think this question is also related to #1193 and #1178 - only talking about Ophyd v1 (this is what I work with), I propose to give some more defined description to Signal using a |
Thanks to #1194 , it is now possible to specify the shape of data (hence, dimensions if we consider
|
Summary
While many signals are scalar-valued, signals that are array-like may have a notion of axis values. This could be the spectrum from an MCA, that has energy values associated with each bin, or an imaging detector that can report pixel position, or a spectrometer that reports angle, etc.
Currently, the best way to put axis information in would be as a configuration signal, so that the axis values are read once, and then stored. However, there is no [standard] way to link the axis values to the actual data signal.
I propose modifying
Signal
to take adims
argument at instantiation that would be automatically put into the descriptor document in order to link the axis values to the data values.Detailed Rationale
Why Modify Signal?
event-model
already has a field fordims
in the event descriptor document. So given a detectorit would be possible to override
describe
in the following wayHowever, this would lead to a lot of boilerplate that also needs to be updated if any of the signals change. Some devices may have different modes that grab different axis values. (i.e, a signal that could come in as a 2-d image, or a 1-d summed histogram, depending on the device mode).
A cleaner implementation
I believe it would be easier for ophyd object-writers if
Signal
took adims
argument, so that the same class could look like:Then, the describe code in
Signal
itself could be as follows:More code would be required to check if
Signal
even has a parent, deal with missing attributes, etc. Sane default behavior is up for discussion. If nodims
is passed intoSignal
, the best behavior would be to not add anydims
key to the descriptor.For mode-switching detectors, the
data_signal.dims
attribute could be modified as necessary at any time beforedescribe()
is called.How this would be useful
Once
dims
is in the descriptor, for a devicemydet = MyDetector(...)
, the keyrun.primary.descriptors[0]['data_keys']['mydet_data_signal']['dims']
would have the valuemydet_axis_signal
.This can then be automatically followed to
run.primary.descriptors[0]['configuration']['mydet']['mydet_axis_signal']
to get the axis values, without any "hard-coding" of the relationship. The axis values for any signal following this convention could be automatically grabbed, whether for data export or plotting.Intent
I would love to get feedback on this idea, and if desired, submit a PR to add this functionality to
Signal
@tacaswell @awalter-bnl
The text was updated successfully, but these errors were encountered: