deepof.visuals.animate_skeleton
- deepof.visuals.animate_skeleton(coordinates: deepof_coordinates, experiment_id: str, embeddings: deepof_table_dict | None = None, soft_counts: deepof_table_dict | None = None, bin_size: int | str | None = None, bin_index: int | str | None = None, precomputed_bins: ndarray | None = None, samples_max: int = 20000, roi_number: int | None = None, animals_in_roi: str | Sequence[str] | None = None, in_roi_criterion: str | Sequence[str] = 'Center', animal_id: str | Sequence[str] | None = None, center: str | bool = 'arena', align: str | None = None, sampling_rate: float | None = None, min_confidence: float = 0.0, min_bout_duration: int | None = None, selected_cluster: ndarray | None = None, display_arena: bool = True, legend: bool = True, save: bool | str | None = None, dpi: int = 100)
Render a FuncAnimation object with embeddings and/or motion trajectories over time.
- Parameters:
coordinates (coordinates) – deepof Coordinates object.
experiment_id (str) – Name of the experiment to display.
embeddings (table_dict) – UMAP or latent embedding for each experiment. If not None, a second animation shows the embedding, colored by cluster if available.
soft_counts (table_dict) – soft cluster assignments for all instances in data. If provided together with selected_cluster, only instances of the specified
bin_size (component are rendered. Defaults to None.) – bin size for time filtering.
bin_index (Union[int, str, None]) – index of the bin of size bin_size to select along the time dimension. Denotes exact start position in the time domain if given as string.
precomputed_bins (np.ndarray, optional) – precomputed time bins. If provided, bin_size and bin_index are ignored.
samples_max (int) – Maximum number of samples taken for plotting to avoid excessive computation times. If the number of rows in a data set exceeds this number the data is downsampled accordingly.
roi_number (int, optional) – Number of the ROI that should be used for the plot (all behavior that occurs outside of the ROI gets excluded).
animals_in_roi (str or list of str, optional) – IDs of animals that need to be inside the active ROI. All frames in which any of the given animals are not inside the ROI get excluded.
in_roi_criterion (str or list of str) – Criterion for in-roi check: a single bodypart, a list of bodyparts or “all” bodyparts of a mouse.
animal_id (str or list of str, optional) – ID list of animals to display. If None (default) it shows all animals.
center (str or bool) – Name of the body part to which the positions will be centered. If False, the raw data is returned; if ‘arena’ (default), coordinates are centered in the pitch.
align (str, optional) – Body part to which later processes will align the frames.
sampling_rate (float, optional) – Sampling rate for the video. If None is given, the same one as in the video recordings will be used.
min_confidence (float) – Minimum confidence threshold to render a cluster assignment bout.
min_bout_duration (int, optional) – Minimum number of frames to render a cluster assignment bout.
selected_cluster (np.ndarray, optional) – Cluster to filter.
display_arena (bool) – Whether to plot a dashed line with an overlying arena perimeter.
legend (bool) – Whether to add a color-coded legend to multi-animal plots.
save (bool or str, optional) – If not None, save the animation. If a string is provided, it is added as a suffix in the auto-generated file name.
dpi (int) – Dots per inch of the figure to create.