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

Resolve numpy warning in sunline srukf test #275

Merged
merged 5 commits into from
Jun 21, 2024

Conversation

patkenneally
Copy link
Collaborator

@patkenneally patkenneally commented Jun 20, 2024

  • Tickets addressed: 983
  • Review: By commit
  • Merge strategy: Merge (no squash)

Description

This PR resolves a numpy deprecation warning in the test_sunlineSRuKF test. Specifically: Only ndim-0 arrays are treated as scalars. NumPy used to treat all arrays of size 1 (e.g., np.array([3.14])) as scalars. In the future, this will be limited to arrays of ndim 0 (e.g., np.array(3.14)).

The PR performs a few clean up operations in the first four commits. The warning is resolved in the final commit.

Verification

CI to run successfully.

Documentation

NA

Future work

NA

The show plot controls are better kept outside the plotting functions. The
plotting functions now have a single responsibility which is to produce and
return a plot. It is then left to the calling code to decide with to show() the
plot, save the plot as an image, etc.
@patkenneally patkenneally requested a review from thibaudteil June 20, 2024 22:53
@patkenneally patkenneally self-assigned this Jun 20, 2024
@patkenneally patkenneally force-pushed the feature/fix-numpy-warning-sunline-srukf-test branch 2 times, most recently from 0da32bd to 7f5f589 Compare June 20, 2024 22:59
Show plots is not a test parameter. It is passed in by the
pytest framework. For functions that need a default value,
that value should be set as a defaulted function parameter.
This warned of numpy 1.25.0 deprecated behavior where a list or dim-0
arrays are treated as scalars. Instead one must index specifically into
the array/list.
@patkenneally patkenneally force-pushed the feature/fix-numpy-warning-sunline-srukf-test branch from 7f5f589 to 2a2b154 Compare June 20, 2024 23:02
@patkenneally patkenneally changed the title Resolve numpy warning ine sunline srukf test Resolve numpy warning in sunline srukf test Jun 21, 2024
Copy link
Collaborator

@thibaudteil thibaudteil left a comment

Choose a reason for hiding this comment

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

I'll poach the show plot changes you made

@patkenneally patkenneally merged commit 001f4b4 into develop Jun 21, 2024
3 checks passed
@patkenneally patkenneally deleted the feature/fix-numpy-warning-sunline-srukf-test branch June 21, 2024 15:12
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