-
Notifications
You must be signed in to change notification settings - Fork 12
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
Simplify and expand kinematic tests for bboxes #265
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #265 +/- ##
=======================================
Coverage 99.77% 99.77%
=======================================
Files 14 14
Lines 883 883
=======================================
Hits 881 881
Misses 2 2 ☔ View full report in Codecov by Sentry. |
Cool! I wasn't aware of result = data.differentiate("time") vs. result = xr.apply_ufunc(
np.gradient,
data,
data.coords["time"].values,
kwargs={"axis": 0},
)
result = result.reindex_like(data) And in both cases, we no longer need to assume equidistant time-spacing. (Opened #268 for this) |
b0c42a7
to
963d423
Compare
5ba43ba
to
9ba34a9
Compare
thanks for the review @lochhh. A summary of the main changes below. In the tests:
In the docstrings of the kinematics functions:
Will re request review now |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks so much for this @sfmig ! ❤️ the restructured tests! I'm happy to have the additional notes in the Notes section - I guess people can read or ignore. Mostly minor comments and suggestions, feel free to take or leave. I also tried to avoid multiple assertions in a for loop where possible, as this makes the code inefficient to debug - the test will fail and terminate on the first failure and we'd need to re-run the test to uncover issues one-by-one.
Co-authored-by: Chang Huan Lo <[email protected]>
Co-authored-by: Chang Huan Lo <[email protected]>
Co-authored-by: Chang Huan Lo <[email protected]>
Co-authored-by: Chang Huan Lo <[email protected]>
Quality Gate passedIssues Measures |
Description
What is this PR
Why is this PR needed?
To ensure our existing kinematics methods play nicely with bboxes datasets.
What does this PR do?
_compute_approximate_derivative
--->_compute_approximate_time_derivative
xarray
's method differentiate are distinct. Withdifferentiate
you can compute the derivative along any single-coordinate dimension, not necessarilytime
.Question
differentiate
in our kinematics wrappers?I am not sure if it existed or we were aware of it when we implemented these methods. If we decide to use it, we may need to change the tests, so that we continue to compute the expected kinematic variables with an 'independent' method.
The simplest way would be to check the kinematic variables for a very simple motion case, for which the velocity, acceleration and displacement are very easy to infer / derive by hand. In a way this is similar to the tests we currently have, except that we can more easily infer which values are expected. I added an example test like that called
test_kinematics_uniform_linear_motion
for reference, but right now it takes only the valid bboxes dataset.References
Overflow from #246
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?
I updated the docstrings for the kinematics module so that the API reference is no longer specific to poses datasets.
Checklist: