Repository navigation
Allow None in descriptor shape - #352
Conversation
None is interpreted as a dimension of unknown shape.
danielballan
left a comment
There was a problem hiding this comment.
Thanks @Tom-Willemsen! One minor suggestion.
Co-authored-by: Dan Allan <[email protected]>
|
Nice change, lgtm |
|
Just a little note since this change is also useful for me and this was discussed in the last dev meeting:
At run engine level I don't precisely know what this would imply (although I feel it would require big effort), but I suspect it's too big of a feature to implement on the fly and right now for what I need this PR is more than enough (hopefully). Just wanted to mention it for the future. |
|
As down stream consumers I'd prefer Can unknown shape be coerced into an ophyd-async e: currently my downstream Java NeXus converter has /** "The shape of the data. Empty list indicates scalar data." */
@NonNull int[] shape;which would need to either get boxed as |
|
Good question, this is worth examining.
Also, More background is covered in bluesky/tiled#801. Tiled does not yet handle ragged shapes, but we have described how it could be added. Consumers will need to be updated to either ignore ragged data; raise; pad to the largest size with zero, NaN, or another fill value; truncate to the smallest size; or handle it properly (if possible). HDF5 has no native support for ragged structures, so padding seems like a likely path there. |
Is the question about this or have I misunderstood? If so, yes, a similar PR will be needed on ophyd-async to match event-model's definitions - which I was planning to make after/if this one gets through and we've ironed out For my initial use-case, the data is 1-dimensional so |
|
One other thought - in a previous collaboration call we said: Would there be ambiguity then if we also overload the meaning of |
I would vote for
|
|
We have always required the Does anyone have a use case for an array of unknown dimension? That is hard for consumers to handle, so I would resist supporting it unless we have a compelling need. For example, HDF5 can handle a dimension of unknown/variable length but not an unknown dimensionality. Likewise, Tiled can grow the ability to represent the former, but I have no idea how I would implement the latter. Where use cases do arise, I think we can still say something more than "unknown dimensionality". For example, imagine a detector that might produce a single image or a stream of images: this could be represented like |
I can't think of a use case for it, so I would say we don't support it. To paste the table we made in a previous collab call:
I don't think we have changed anything here, although I would suggest we drop |
Description
Closes #351
Allow
Nonewithin a shape inevent-model- a dimension with extentNoneis interpreted as a dimension of unknown or variable length.Motivation and Context
One scientific motivation for this is event-mode data, common at neutron facilities, where a detector records the position and timestamp of each detection event individually. This means that event-mode detectors conceptually give an array of variable shape each time data is acquired from them, where the dimensionality corresponds to the number of detection events.
How Has This Been Tested?
Tested that the
RunEnginenow accepts emitting descriptors with a declared shape of(None, ).At the moment not all downstream consumers are able to process these events - further work will be required to support this. For example the
TiledWriterin bluesky does not currently handle this.This change should be backwards-compatible with all existing data, as it is a loosening of the schema.