-
Notifications
You must be signed in to change notification settings - Fork 5
Description
A summary of what we have discussed with @hyperrealist.
Some plans collect data points in order that can not be easily reshaped from the acquired 1D sequence to a scientifically meaningful 2D (or higher-dimensional) representation, e.g. snake-scans, spiral scans, etc. It was decided to produce this data representation via custom endpoints, e.g. /custom/snake instead of /array/full; the associated processing code can be implemented separately and declared in the server config (see the /documents endpoint in databroker for a precedent).
A few points that still need to be clarified, which would have impact on TiledWriter.
-
Where to mark the stream (or a specific data key) as adhering to a certain scan spec. "Start" document has been proposed as the obvious solution, but I would like to explore other available options. "Descriptors" maybe?
-
How to encode the information about the scan spec in an efficient way, so we don't bloat the bluesky docs and metadata with unnecessary information. Saving the explicit order of point indices seems redundant. Perhaps, the scan spec can be parameterized, e.g. in the simplest case, by (1) enum type of scan ("snake", "spiral", etc) and (2) the number of points in a single row. This information,
{"scan_spec": {"kind": "snake", "nrows": 42}}, along with the total number of acquired points, which is known from the data shape, is enough to fully reconstruct the trajectory.
- Where to store the "scan_spec" information in Tiled. Apart from keeping it in the Start document, it seems to be useful to have this information readily available on the array node that needs to be reshaped itself, e.g. it can be stored in its metadata. In this case, the path operation function in the custom FastAPI router that processes the
/custom/snakeendpoint would already have this info in theentry's metadata and wouldn't need to traverse the bluesky container to find the start document. TiledWriter can be made responsible for placing this additional metadata at the array node.