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

Unpinning numpy version, addressing warnings #1004

Merged

Conversation

astronomerritt
Copy link
Collaborator

@astronomerritt astronomerritt commented Aug 26, 2024

Fixes #964.

  • Unpinned Numpy version.
  • Modified code to remove new warning for Numpy 2.0 (see below).
  • Ensured fix also worked for older Numpy versions.

All tests ran successfully using Numpy v.2.0.1. However, the following new warning occurred:

tests/sorcha/test_PPLinkingFilter.py: 9 warnings
tests/sorcha/test_demo_end2end.py: 3 warnings
  /opt/miniconda3/envs/sorcha-numpy/lib/python3.10/site-packages/numpy/_core/records.py:634: DeprecationWarning: Data type alias 'a' was deprecated in NumPy 2.0. Use the 'S' alias instead.
    descr = sb.dtype(dtype)

This was a simple fix. MiniDifi uses Numpy record arrays in which the ssObjectID column was being typed as ssObjectId=f"a{nameLen}". Changed this to ssObjectId=f"S{nameLen}" in all places. This fix is backwards-compatible at least as far back as Numpy version 1.26.4 so it shouldn't break anyone's existing environments.

Review Checklist for Source Code Changes

  • Does pip install still work?
  • Have you written a unit test for any new functions?
  • Do all the units tests run successfully?
  • Does Sorcha run successfully on a test set of input files/databases?
  • Have you used black on the files you have updated to confirm python programming style guide enforcement?

Copy link

codecov bot commented Aug 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 80.78%. Comparing base (c661f54) to head (6f21950).
Report is 5 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1004   +/-   ##
=======================================
  Coverage   80.78%   80.78%           
=======================================
  Files          69       69           
  Lines        3107     3107           
=======================================
  Hits         2510     2510           
  Misses        597      597           

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

@astronomerritt astronomerritt marked this pull request as ready for review August 26, 2024 16:58
@astronomerritt astronomerritt merged commit 0b77f23 into dirac-institute:main Aug 27, 2024
9 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.

check on what changes are needed to accomodate numpy 2.0
2 participants