tomoscan.framereducer.ReduceFrameSaver.ReduceFrameSaver#
- class tomoscan.framereducer.ReduceFrameSaver.ReduceFrameSaver(frames, output_urls, frames_metadata, metadata_output_urls, overwrite=False)#
Bases:
objectUtil function to save reduced frames to disk.
- __init__(frames, output_urls, frames_metadata, metadata_output_urls, overwrite=False)#
- Parameters:
frames (dict[int, numpy.ndarray]) – Frames as a dict to be saved. Key is the index of the frame, value is the frame as a 2D numpy array.
output_urls (tuple[DataUrl, ...]) –
A list of URLs specifying the locations where the frames will be saved. Each URL in the list can include specific keywords that the frame saver will dynamically replace. These keywords allow for customizable naming conventions for the saved frames. Supported keywords are:
’{index}’: This keyword will be replaced by the index of the frame.
’{index_zfill4}’: This keyword will be replaced by the index of the frame, zero-padded to four digits.
frames_metadata (ReducedFramesInfos | None) – Metadata associated to the frames (like count time).
metadata_output_urls (tuple | None) – A list of URLs specifying the locations where the metadata of the reduced frames will be saved.
overwrite (bool) – If True and if one of the output url already exists it will overwrite it. Else it will raise an Error.
Methods
__init__(frames, output_urls, ...[, overwrite])- type frames:
dict[int, numpy.ndarray]
clean_frame_group(url)For HDF5 in order to avoid file size increase we need to overwrite dataset when possible.
save()- clean_frame_group(url)#
For HDF5 in order to avoid file size increase we need to overwrite dataset when possible. But the darks / flats groups can contain other datasets and pollute this group. This function will remove unused dataset (frame index) when necessary