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

Plotting wrappers: Head Trajectory #394

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open

Conversation

stellaprins
Copy link
Contributor

@stellaprins stellaprins commented Jan 28, 2025

Description

What is this PR

  • Bug fix
  • Addition of a new feature
  • Other

Why is this PR needed?
To conveniently plot results with a single line of code.

What does this PR do?
Introduces a plot module with a trajectory function.

References

#387

How has this PR been tested?

Checked the updated documentation locally.

Is this a breaking change?

No.

Does this PR require an update to the documentation?

Yes. I've updated the first part of the Express 2D vectors in polar coordinates example.

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

Copy link

codecov bot commented Jan 28, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.81%. Comparing base (df4b4b1) to head (15dccd0).
Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #394   +/-   ##
=======================================
  Coverage   99.80%   99.81%           
=======================================
  Files          14       16    +2     
  Lines        1025     1080   +55     
=======================================
+ Hits         1023     1078   +55     
  Misses          2        2           

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

Copy link
Contributor

@willGraham01 willGraham01 left a comment

Choose a reason for hiding this comment

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

Some stylistic comments here from me.

As for testing, I'll copy what I put in our chat here so it's visible for everyone:

You can't really test "images" per se, so I'd follow the advice of the StackOverflow hive mind like in this article here: use trajectory to create a figure on some (small) custom dataset, then examine the data stored in the returned Figure object.

Maybe make a DataArray with 3 keypoints (left, centre, and right) that all move in parallel lines, with centre being the midpoint of the other two.
Then you can check that if you pass the left and right keypoints, the figure contains data that matches the centre points? Likewise you can also check that if you only pass one of the keypoints, the data in the returned plot matches the raw data for that keypoint?

movement/plot.py Outdated Show resolved Hide resolved
movement/plot.py Outdated Show resolved Hide resolved
movement/plot.py Show resolved Hide resolved
movement/plot.py Outdated Show resolved Hide resolved
@stellaprins
Copy link
Contributor Author

Maybe make a DataArray with 3 keypoints (left, centre, and right) that all move in parallel lines, with centre being the midpoint of the other two. Then you can check that if you pass the left and right keypoints, the figure contains data that matches the centre points? Likewise you can also check that if you only pass one of the keypoints, the data in the returned plot matches the raw data for that keypoint?

May be able to use some of the valid_poses_dataset_ fixtures that have left, right, and centroid keypoints.

@willGraham01
Copy link
Contributor

May be able to use some of the valid_poses_dataset_ fixtures that have left, right, and centroid keypoints.

Possibly, if they're simple enough to compute and work with then definitely re-use them.

My original idea was something like 3 "parallel lines" for the keypoints:

left: (-1,0) -> (-1,1) -> (-1,2) -> (-1,3) -> (-1,4)
centre: (0,0) -> (0,1) -> (0,2) -> (0,3) -> (0,4)
right: (1,0) -> (1,1) -> (1,2) -> (1,3) -> (1,4)

but if something like this already exists then go with that!

stellaprins and others added 4 commits January 30, 2025 14:22
Co-authored-by: Will Graham <willGraham01@users.noreply.github.com>
Co-authored-by: Will Graham <willGraham01@users.noreply.github.com>
Co-authored-by: Will Graham <willGraham01@users.noreply.github.com>

This comment was marked as resolved.

@stellaprins stellaprins marked this pull request as ready for review January 31, 2025 12:13
@stellaprins stellaprins requested a review from niksirbi January 31, 2025 12:14
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