diplomat.utils.frame_store_fmt.DLFSWriter

class diplomat.utils.frame_store_fmt.DLFSWriter(file: BinaryIO, header: DLFSHeader, threshold: Optional[float] = 1e-06, compression_level: int = 6)[source]

Bases: FrameWriter

A DeepLabCut Frame Store Writer. Allows for writing “.dlfs” files.

__init__(file: BinaryIO, header: DLFSHeader, threshold: Optional[float] = 1e-06, compression_level: int = 6)[source]

Create a new DeepLabCut Frame Store Writer.

Parameters
  • file – The file to write to, a file opened in ‘wb’ mode.

  • header – The DLFSHeader, with all properties filled out.

  • threshold – A float between 0 and 1, the threshold at which to filter out any probabilities which fall below it. The default value is 1e-6, and it can be set to None to force all frames to be stored in the non-sparse format.

  • compression_level – The compression of the data. 0 is no compression, 9 is max compression but is slow. The default is 6.

Methods

__init__(file, header[, threshold, ...])

Create a new DeepLabCut Frame Store Writer.

close()

Close this frame writer, cleaning up any resources used during writing to the file.

get_header()

Get the header of this DLFSWriter.

tell_frame()

Get the current frame the frame writer is on.

write_data(data)

Write the following frames to the file.

close()[source]

Close this frame writer, cleaning up any resources used during writing to the file. Does not close the passed file handle!

get_header() DLFSHeader[source]

Get the header of this DLFSWriter.

Returns

The DLFSHeader of the frame store writer, which contains file metadata.

tell_frame() int[source]

Get the current frame the frame writer is on.

Returns

An integer, being the current frame the DLFSWriter will write out next.

write_data(data: TrackingData)[source]

Write the following frames to the file.

Parameters

data – A TrackingData object, which contains frame data.