to_sleap_analysis_file#
- movement.io.save_poses.to_sleap_analysis_file(ds, file_path)[source]#
Save a
movement
dataset to a SLEAP analysis file.- Parameters:
ds (xarray.Dataset) –
movement
dataset containing pose tracks, confidence scores, and associated metadata.file_path (pathlib.Path or str) – Path to the file to save the poses to. File extension must be .h5.
- Return type:
None
Notes
The output file will contain the following keys (as in SLEAP .h5 analysis files): “track_names”, “node_names”, “tracks”, “track_occupancy”, “point_scores”, “instance_scores”, “tracking_scores”, “labels_path”, “edge_names”, “edge_inds”, “video_path”, “video_ind”, “provenance” [1]. However, only “track_names”, “node_names”, “tracks”, “track_occupancy” and “point_scores” will contain data extracted from the input dataset. “labels_path” will contain the path to the input file only if the source file of the dataset is a SLEAP .slp file. Otherwise, it will be an empty string. The other attributes and data variables that are not present in the input dataset will contain default (empty) values.
References
Examples
>>> from movement.io import save_poses, load_poses >>> ds = load_poses.from_dlc_file("path/to/file.h5") >>> save_poses.to_sleap_analysis_file( ... ds, "/path/to/file_sleap.analysis.h5" ... )