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

Fix numpy v1.24 compatibility #574

Merged
merged 1 commit into from Apr 11, 2023

Conversation

alubbock
Copy link
Member

Numpy v1.24 deprecated ragged arrays unless dtype=object is passed (numpy/numpy#22004). The SimulationResult class needs to support different length entries in tout in the case these differ across simulations. PySB shouldn't convert these to a numpy array, instead preferring to keep them as a list/iterable, which avoids causing an error with Numpy v1.24 when running the PySB test suite.

Numpy v1.24 deprecated ragged arrays unless dtype=object
is passed (numpy/numpy#22004). The SimulationResult class
needs to support different length entries in tout in the
case that these differ across simulations. PySB shouldn't
convert these to a numpy array, instead preferring to
keep them as a list/iterable.
@codecov
Copy link

codecov bot commented Mar 28, 2023

Codecov Report

Merging #574 (ee3d147) into master (8819eaa) will decrease coverage by 0.12%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #574      +/-   ##
==========================================
- Coverage   80.33%   80.22%   -0.12%     
==========================================
  Files         101      101              
  Lines       10832    10832              
==========================================
- Hits         8702     8690      -12     
- Misses       2130     2142      +12     
Flag Coverage Δ
os-macos-latest ?
os-ubuntu-latest 80.22% <100.00%> (-0.12%) ⬇️
os-windows-latest 2.89% <0.00%> (ø)
python-3.10 80.22% <100.00%> (-0.12%) ⬇️
python-3.7 79.77% <100.00%> (-0.12%) ⬇️
python-3.8 80.21% <100.00%> (-0.12%) ⬇️
python-3.9 80.21% <100.00%> (-0.12%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
pysb/simulator/base.py 89.52% <100.00%> (ø)

... and 1 file with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Contributor

@JamesPino JamesPino left a comment

Choose a reason for hiding this comment

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

Seems like an easy fix. At first I was curious what prevented tout and trajectories from being lists of different sizes, but found the checks later on. I don't see the check for observables_and_expressions. Would/could that ever occur? It's independent of this fix, but was just looking at how self.tout is used later and noticed.

@jmuhlich jmuhlich merged commit 9d3d4bc into pysb:master Apr 11, 2023
12 of 13 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.

None yet

3 participants