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

Update unumpy test to be compatible with numpy 2 #225

Merged
merged 1 commit into from
May 16, 2024

Conversation

wshanks
Copy link
Collaborator

@wshanks wshanks commented May 16, 2024

uncertainties defines error-propagating versions of several of the functions in the math module. Then in the unumpy code, it iterates over this same set and defines array-compatible versions of those functions using numpy.vectorize. Because before numpy 2 numpy used different names for the inverse trigonometric functions (arccos vs acos), the code needed to change the name for the numpy version. One place in the tests just checked that arccos was in the numpy module and acos was not. Since numpy 2 added the aliases for the a-named versions of the arc functions, that test fails with numpy 2. Since uncertainties does not really need to test the names of functions in numpy that check is removed.

A future update could add the acos()-style aliases to unumpy as well.

`uncertainties` defines error-propagating versions of several of the
functions in the `math` module. Then in the `unumpy` code, it iterates
over this same set and defines array-compatible versions of those
functions using `numpy.vectorize`. Because before numpy 2 numpy used
different names for the inverse trigonometric functions (`arccos` vs
`acos`), the code needed to change the name for the numpy version. One
place in the tests just checked that `arccos` was in the numpy module and
`acos` was not. Since numpy 2 added the aliases for the `a`-named
versions of the `arc` functions, that test fails with numpy 2. Since
`uncertainties` does not really need to test the names of functions in
`numpy` that check is removed.

A future update could add the `acos()`-style aliases to `unumpy` as
well.
@wshanks wshanks mentioned this pull request May 16, 2024
Copy link

codecov bot commented May 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.74%. Comparing base (3255816) to head (321436b).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #225      +/-   ##
==========================================
- Coverage   95.74%   95.74%   -0.01%     
==========================================
  Files          12       12              
  Lines        1905     1904       -1     
==========================================
- Hits         1824     1823       -1     
  Misses         81       81              

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

Copy link
Member

@newville newville left a comment

Choose a reason for hiding this comment

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

Thanks, looks good to me.

@andrewgsavage andrewgsavage merged commit 5954d5c into lmfit:master May 16, 2024
18 checks passed
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