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

Adapt move accessor to bboxes datasets #255

Merged
merged 27 commits into from
Aug 7, 2024

Conversation

sfmig
Copy link
Contributor

@sfmig sfmig commented Aug 1, 2024

Description

What is this PR

  • Bug fix
  • Addition of a new feature
  • Other

Why is this PR needed?
This PR extends the move.validate() method to bounding boxes dataset.

What does this PR do?

  • Extends the validate method of the move accessor to consider a bounding boxes dataset.
  • Extends the current tests of the move accessor to cover the cases with bounding boxes dataset. To do so:
    • It adds fixtures for valid/invalid bounding boxes datasets.
    • It splits the invalid_poses_dataset fixture into separate fixtures. This allows us to reusue fixtures that are valid for both types of datasets (e.g., empty_dataset).
    • It parametrizes current tests, to extend them to valid and invalid bounding boxes datasets
    • It adds a test for the move.validate() method.
  • Adapts other tests to the new fixtures for invalid datasets.

I am not sure I fully understand the move accessor so feel free to suggest better implementations!

References

This came up while working on #246 - we missed the move accessor bits while implementing the bounding boxes dataset.

How has this PR been tested?

Tests pass locally and in CI.

Is this a breaking change?

No.

Does this PR require an update to the documentation?

No.

Checklist:

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

Copy link

codecov bot commented Aug 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.76%. Comparing base (1f219cb) to head (f8ce80b).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #255   +/-   ##
=======================================
  Coverage   99.76%   99.76%           
=======================================
  Files          14       14           
  Lines         854      866   +12     
=======================================
+ Hits          852      864   +12     
  Misses          2        2           

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

@sfmig sfmig marked this pull request as ready for review August 1, 2024 17:20
@sfmig sfmig requested a review from lochhh August 1, 2024 17:31
Copy link
Collaborator

@lochhh lochhh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @sfmig for the great work! Just a couple of minor comments. I also refactored the validation bit and added missing 'bboxes' description in the docstrings. The other small change is with changing function, variable names to lowercase (which were previously reported as issues)

movement/move_accessor.py Outdated Show resolved Hide resolved
movement/move_accessor.py Outdated Show resolved Hide resolved
tests/conftest.py Outdated Show resolved Hide resolved
tests/conftest.py Outdated Show resolved Hide resolved
tests/conftest.py Outdated Show resolved Hide resolved
@sfmig
Copy link
Contributor Author

sfmig commented Aug 6, 2024

thanks @lochhh! for the great points and the extra commits, super helpful 🚀

For the tests with invalid datasets that have missing dimensions / data variables, I followed your suggestion and removed the whole-string comparison - online people agreed this is best practice as it is less brittle 🌟

However, I kept the whole-string comparison for the list of missing dimensions (or data vars). This is because in the test we don't want to check if a subset of the missing dimensions is reported in the error message. Instead we want to check the full list of missing dimensions (or data vars) is exactly as expected. The easiest way is to print the list of missing dimensions in a reproducible manner, so I kept the sorted bit in for now.

Let me know if you think differently - if all good I am happy to merge

@sfmig sfmig force-pushed the smg/adapt-move-accessor-validation branch 2 times, most recently from 3acb001 to 534157b Compare August 6, 2024 10:39
Copy link
Collaborator

@lochhh lochhh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks again @sfmig for addressing all comments!
Just made a couple more changes:

  • updated docstrings in move_accessor
  • removed the wrappers around ds.rename and ds.drop_vars in conftest.py, in preference to the more familiar, one-liner xarray syntax

Think we are good to go 🚀

@lochhh lochhh force-pushed the smg/adapt-move-accessor-validation branch from 4bfb237 to f8ce80b Compare August 7, 2024 10:28
Copy link

sonarcloud bot commented Aug 7, 2024

@lochhh lochhh added this pull request to the merge queue Aug 7, 2024
Merged via the queue into main with commit 8c45183 Aug 7, 2024
17 checks passed
@lochhh lochhh deleted the smg/adapt-move-accessor-validation branch August 7, 2024 10:44
@sfmig
Copy link
Contributor Author

sfmig commented Aug 7, 2024

thanks @lochhh for the edits! always eagle-eyed 🚀 ✨ 👏

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