Skip to content

Bounds on acos usages; fix a couple of links in readme#108

Merged
jcao-bdai merged 3 commits into
masterfrom
SW-559/bounds-update
Dec 5, 2023
Merged

Bounds on acos usages; fix a couple of links in readme#108
jcao-bdai merged 3 commits into
masterfrom
SW-559/bounds-update

Conversation

@jcao-bdai
Copy link
Copy Markdown
Contributor

@jcao-bdai jcao-bdai commented Dec 1, 2023

This is a first pass for the task "Bounds on acos and other functions with bounded domains", with focus on acos and asin usages.

  • All usages of math.acos, math.asin reviewed;
  • Changes included in this PR are cases with clear intention and the clampings added simply guard against floating point error (e.g. dot product of two unit quaternions should have norm <= 1).

@jcao-bdai jcao-bdai changed the title bounds update; fix a couple of links in readme Bounds on acos usages; fix a couple of links in readme Dec 1, 2023
@codecov
Copy link
Copy Markdown

codecov Bot commented Dec 1, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (a0bb12f) 76.47% compared to head (811ac8d) 77.04%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #108      +/-   ##
==========================================
+ Coverage   76.47%   77.04%   +0.56%     
==========================================
  Files          24       24              
  Lines        5136     5136              
==========================================
+ Hits         3928     3957      +29     
+ Misses       1208     1179      -29     

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

@jcao-bdai jcao-bdai marked this pull request as ready for review December 1, 2023 22:14
@jcao-bdai jcao-bdai force-pushed the SW-559/bounds-update branch from 2ecb3ed to 1b27a7b Compare December 1, 2023 22:40
more tests

more
@jcao-bdai jcao-bdai force-pushed the SW-559/bounds-update branch from 5b2207a to 62a98a9 Compare December 1, 2023 23:40
@petercorke
Copy link
Copy Markdown
Collaborator

I have a problem with the fix for log since s can be negative, so the s/|q| should be bounded in the range [-1, 1]. I think the other fixes are ok.

Comment thread spatialmath/quaternion.py
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I have a problem with the fix for log since s can be negative, so the s/|q| should be bounded in the range [-1, 1]. I think the other fixes are ok.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

thanks for pointing this out! change pushed in 2638584

Comment thread tests/test_quaternion.py
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

great to have these

Copy link
Copy Markdown
Collaborator

@petercorke petercorke left a comment

Choose a reason for hiding this comment

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

useful fixes in general.

some issue with log of Quaternion, good to have other opinions on this, but I think the bounds should be [-1, 1]. Not sure whether it's faster to use min and max or numpy's clip

@jcao-bdai jcao-bdai requested a review from petercorke December 4, 2023 14:27
Copy link
Copy Markdown
Collaborator

@myeatman-bdai myeatman-bdai left a comment

Choose a reason for hiding this comment

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

Small change.

Comment thread tests/test_quaternion.py
q1 = Quaternion([4, 3, 2, 1])
q2 = Quaternion([-1, 2, -3, 4])

self.assertTrue(isscalar(q1.log().s))
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Do we need to test isscalar and isvector twice?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

right! repetitive tests removed, in 811ac8d

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

could you please take another look? @myeatman-bdai (i can't seem to re-request review from the UI...)

Copy link
Copy Markdown
Collaborator

@myeatman-bdai myeatman-bdai left a comment

Choose a reason for hiding this comment

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

Bueno

@jcao-bdai jcao-bdai dismissed petercorke’s stale review December 5, 2023 20:49

Change implemented as requested - I am setting this to a review comment to avoid bothering Peter too much. I will take on any followups or TODO's as necessary.

@jcao-bdai jcao-bdai merged commit 423b781 into master Dec 5, 2023
@jcao-bdai jcao-bdai deleted the SW-559/bounds-update branch December 5, 2023 20:49
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.

3 participants