sleap.io.format.sleap_analysis#
Adaptor to read and write analysis HDF5 files.
These contain location and track data, but lack other metadata included in a full SLEAP dataset file.
Note that this adaptor will use default track names and skeleton node names if these cannot be read from the HDF5 (some files have these, some don’t).
To determine whether this adaptor can read a file, we check it’s an HDF5 file
with a track_occupancy
dataset.
- class sleap.io.format.sleap_analysis.SleapAnalysisAdaptor[source]#
- property all_exts#
List of all file extensions supported by adaptor.
- can_read_file(file: sleap.io.format.filehandle.FileHandle)[source]#
Returns whether this adaptor can read this file.
- can_write_filename(filename: str)[source]#
Returns whether this adaptor can write format of this filename.
- property default_ext#
The default file extension, e.g., ‘json’ (without ‘.’).
- property handles#
Returns the type of object that can be read/written.
The Dispatch class calls this method on all registered adaptors to determine which to use for reading/writing.
- property name#
Human-reading name of the file format
- classmethod read(file: sleap.io.format.filehandle.FileHandle, video: Union[sleap.io.video.Video, str], *args, **kwargs) sleap.io.dataset.Labels [source]#
Reads the file and returns the appropriate deserialized object.
- classmethod write(filename: str, source_object: sleap.io.dataset.Labels, source_path: Optional[str] = None, video: Optional[sleap.io.video.Video] = None)[source]#
Writes analysis file for
Labels
source_object
.- Parameters
filename – The filename for the output file.
source_object – The
Labels
from which to get data from.video – The
Video
from which toget data from. If novideo
is specified, then the first video insource_object
videos list will be used. If there are noLabeled Frame`s in the `video
, then no analysis file will be written.