Skip to content

Fix vector to angles for small intensities#565

Merged
leouieda merged 1 commit intomainfrom
vec-to-angles-small-angles
May 28, 2025
Merged

Fix vector to angles for small intensities#565
leouieda merged 1 commit intomainfrom
vec-to-angles-small-angles

Conversation

@leouieda
Copy link
Member

@leouieda leouieda commented May 28, 2025

When the intensity is very small (<1e-10), the vector to angles calculation fails because of the masking that was used. It rounds these numbers to zero and returns always inc=90, dec=0. To handle this, use the arctangent instead of arcsine in the equations. This was, we can use arctan2 which is able to handle 0 in the denominator. Add tests to make sure this doesn't happen again. These small values appear in magnetic microscopy and we ran into this issue in Magali.

When the intensity is very small (<1e-10), the vector to angles
calculation fails because of the masking that was used. It rounds these
numbers to zero and returns always inc=90, dec=0. To handle this, use
the arctangent instead of arcsine in the equations. This was, we can use
arctan2 which is able to handle 0 in the denominator. Add tests to make
sure this doesn't happen again.
@leouieda leouieda merged commit 8e0c677 into main May 28, 2025
17 checks passed
@leouieda leouieda deleted the vec-to-angles-small-angles branch May 28, 2025 19:09
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.

1 participant