DiamondLightSource / DiamondLightSource/fastcs-odin
Handle unknown number of frames when generating VDS
- Dominant language
- Python
- Stars
- 1
- Forks
- 2
- PR merge metrics
- No merged PRs in 30d
Description
Some beamlines set `:OD:FP:Frames` to 0, meaning that Odin does not know how many frames it will need to write and will write until `:OD:FP:StopWriting` is triggered. However, currently, the virtual dataset generation function requires the total number of frames as an input.
Total frames should only be required if `blocks_per_file` is not 0, because then without knowing the total frames, there could be an infinite number of files. However if blocks_per_file` is 0, meaning a file writer will always write into the same file, then we should be able to handle it using infinite slices (see https://docs.h5py.org/en/latest/vds.html#creating-virtual-datasets-in-h5py).
Therefore
- If `blocks_per_file == 0` we can always write the vds at `start_writing`
- If `frames != 0` we can always write the vds at `start_writing`
- If `blocks_per_file` != 0 and `frames == 0` we have to write the vds at `stop_writing`, using `frames_written` for the total number of frames.
The vds generation logic should be updated to match the above. This also means extra logic in `start_writing` and `stop_writing` to determine whether vds generation should be done at that point.
## Acceptance Criteria
- VDS generation works even if `:OD:FP:Frames` is 0.
- VDS generation occurs either at `start_writing` or `stop_writing` depending on `blocks_per_file` and `frames`.
Contributor guide
Assessment
This issue has not been assessed yet.