Repository navigation
docs(base): fix the angle_std formula and the angle_mean and angle_wrap parameter docs - #253
Open
petercorke wants to merge 1 commit into
Open
petercorke wants to merge 1 commit into
petercorke wants to merge 1 commit into
Conversation
…ap parameter docs - angle_std: the formula had sin in both components of the mean vector, it is cos and sin; say what R is, that the result is the same as scipy.stats.circstd, and what happens as R tends to zero - angle_mean: the parameter was documented as v but is theta, and the range had a stray bracket; the result is in [-pi, pi]; say that a cancelling set of angles has no defined mean - angle_wrap: the parameter was documented as v but is theta Documentation only.
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
14 tasks
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is wrong
Documentation only, in
spatialmath/base/vectors.py:angle_stdsinin both components of the mean vector; the code (and the correct formula) iscosandsinRisangle_meanv, it istheta; the range is written[-\pi, \pi)]with a stray bracket and the result can be exactly\pitheta, range[-\pi, \pi]angle_wrapv, it isthetathetaAdded
angle_stdis the same quantity asscipy.stats.circstdwith its default arguments. I checked this on 300 random samples, the largest difference is 2e-16.angle_meanhas no defined value when the unit vectors cancel (for example0andpi; it returnspi/2because of rounding error)No code changes.
Found while checking, not changed here
angle_stdcan returnnanfor a set of identical angles. The mean resultant lengthRcan come out as1 + 2e-16, so-2 * log(R)is slightly negative and the square root fails with "invalid value encountered in sqrt". For examplenp.full(100, -2.9). I counted 33 failures in 378 combinations of angle and sample size. I will send that as a separate PR.