Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to save multi-animal pose tracks to single-animal files #68

Closed
wants to merge 6 commits into from

Conversation

DhruvSkyy
Copy link
Collaborator

@DhruvSkyy DhruvSkyy commented Oct 13, 2023

Description

What is this PR

  • Bug fix
  • Addition of a new feature
  • Other

What does this PR do?

This PR adds the functionality to save xarrays as a dictionary of individual pandas dataframes for to_dlc_df and as multiple files for each individual for to_dlc_file. This is based on the split_individuals: bool parameter, if True it will split the data for each individual, if false it will save it as a multi-animal file.

This issue was described in Issue #39.

References

Please reference any existing issues/PRs that relate to this PR.

How has this PR been tested?

The PR was tested on a Juypter Notebook against the four scenarios, (credit to @niksirbi):

  • The xarray.Dataset has multiple (>1) individuals and the user wants to save it to a multi-animal DeepLabCut dataframe. This currently works with the existing functions.
  • The xarray.Dataset has only 1 individual but the user still wants to save it to a multi-animal DeepLabCut dataframe, including the redundant "individuals" level. This also works currently.
  • The xarray.Dataset has a single individual and the user wants to save it to single-animal DeepLabCut dataframe (without the "individuals" level). This behaviour needs to be implemented, the output will be a single file.
  • The xarray.Dataset has multiple (>1) individuals and the user wants to split them for saving into multiple single-animal files. * This is the trickiest case to implement, as the dataset would have to be split across individuals (behind the scenes) and each part is then saved to a single-animal file as in case 3. The output should be as many files as there are individuals.

Todo

Need to write tests.

Checklist:

  • The code has been tested locally
  • Tests have been added to cover all new functionality
  • The documentation has been updated to reflect any changes
  • The code has been formatted with pre-commit

@codecov
Copy link

codecov bot commented Oct 13, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (1d4aba5) 98.05% compared to head (364157a) 98.05%.

❗ Current head 364157a differs from pull request most recent head 4462312. Consider uploading reports for the commit 4462312 to get more accurate results

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #68   +/-   ##
=======================================
  Coverage   98.05%   98.05%           
=======================================
  Files           8        8           
  Lines         308      308           
=======================================
  Hits          302      302           
  Misses          6        6           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

No Coverage information No Coverage information
0.0% 0.0% Duplication

@DhruvSkyy DhruvSkyy closed this Oct 23, 2023
@niksirbi
Copy link
Member

This PR has been superseded by #71

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants