neuroinformatics-unit / movement

Python tools for analysing body movements across space and time
http://movement.neuroinformatics.dev
BSD 3-Clause "New" or "Revised" License
96 stars 8 forks source link

Compute Forward Vector #276

Open b-peri opened 1 month ago

b-peri commented 1 month ago

Description (Edited 24/09/2024)

This PR adds compute_forward_vector() - a new kinematic function for computing a forward/rostral-facing vector given two keypoints - to movement. As described in #238, this function takes two left-right symmetrical keypoints (i.e. symmetrical across the animal's mid-saggital plane) and computes the vector perpendicular to the line connecting them. The result is an xr.DataArray of vectors pointing in the animal's rostral direction at each timepoint. As we expect this function to be commonly used for the computation of head direction vectors, this PR also adds compute_head_direction_vector(), a convenient alias for compute_forward_vector() whose docstring more explicitly refers to points on the head (rather than on the body, more generically).

What is this PR

References

Checklist:

codecov[bot] commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 99.77%. Comparing base (9c80786) to head (b2de46a).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #276 +/- ## ======================================= Coverage 99.77% 99.77% ======================================= Files 15 15 Lines 887 909 +22 ======================================= + Hits 885 907 +22 Misses 2 2 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

lochhh commented 2 weeks ago

Quality Gate Passed Quality Gate passed

Issues 3 New issues 0 Accepted issues

Measures 0 Security Hotspots 0.0% Coverage on New Code 0.0% Duplication on New Code

See analysis details on SonarCloud

Hey @b-peri , just a note to also remove any uppercase letters in function names.

b-peri commented 2 weeks ago

Quality Gate Passed Quality Gate passed

Issues 3 New issues 0 Accepted issues Measures 0 Security Hotspots 0.0% Coverage on New Code 0.0% Duplication on New Code See analysis details on SonarCloud

Hey @b-peri , just a note to also remove any uppercase letters in function names.

Hi @lochhh, thanks for the heads-up, that's my bad! The function names are fixed now!

sonarcloud[bot] commented 1 week ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud