diplomat.utils.frame_store_api.FrameWriter
- class diplomat.utils.frame_store_api.FrameWriter(file: BinaryIO, header: DLFSHeader, threshold: Optional[float] = 1e-06)[source]
Bases:
ABCThe frame writer API. Allows for writing frames in the form of
TrackingDataobjects to a diplomat frame store format.- abstract __init__(file: BinaryIO, header: DLFSHeader, threshold: Optional[float] = 1e-06)[source]
Create a new frame writer.
- Parameters:
file – A binary frame object, the file to write the frames to.
header – The DLFSHeader for this frame store, contains important metadata.
threshold – The minimum threshold for keeping probabilities. If set to None, this indicates to the frame writer that the probability frames should be stored in a non-sparse way. Defaults to 1e-6.
Methods
__init__(file, header[, threshold])Create a new frame writer.
close()Close this frame writer.
Get the header of this frame writer.
Get the current frame this frame writer is on.
write_data(data)Write data to the file using this frame writer.
- abstract close()[source]
Close this frame writer. This does not close the file handler that this frame writer is utilizing, simply the frame writer itself.
- abstract get_header() DLFSHeader[source]
Get the header of this frame writer.
- Returns:
A DLFSHeader object, which contains important metadata for this frame writer.
- abstract tell_frame() int[source]
Get the current frame this frame writer is on.
- Returns:
An integer, being the index of the frame that the frame writer will be writing next.
- abstract write_data(data: TrackingData)[source]
Write data to the file using this frame writer.
- Parameters:
data – A TrackingData object, being the frames to write to the file.
- Throws:
ValueError if there is an attempt to write more frames than the total number of frames specified in the DLFSHeader passed when this frame writer was created.