to_dlc_file#

movement.io.save_poses.to_dlc_file(ds, file_path, split_individuals='auto')[source]#

Save a movement dataset to DeepLabCut file(s).

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. The file extension must be either .h5 (recommended) or .csv.

  • split_individuals (bool or "auto", optional) – Whether to save individuals to separate files or to the same file (see Notes). Defaults to “auto”.

Return type:

None

Notes

If split_individuals is True, each individual will be saved to a separate file, formatted as in a single-animal DeepLabCut project (without the “individuals” column level). The individual’s name will be appended to the file path, just before the file extension, e.g. “/path/to/filename_individual1.h5”. If False, all individuals will be saved to the same file, formatted as in a multi-animal DeepLabCut project (with the “individuals” column level). The file path will not be modified. If “auto”, the argument’s value is determined based on the number of individuals in the dataset: True if there is only one, False otherwise.

See also

to_dlc_style_df

Convert dataset to DeepLabCut-style DataFrame(s).

Examples

>>> from movement.io import save_poses, load_poses
>>> ds = load_poses.from_sleap_file("/path/to/file_sleap.analysis.h5")
>>> save_poses.to_dlc_file(ds, "/path/to/file_dlc.h5")