-
Notifications
You must be signed in to change notification settings - Fork 95
[MAIN] add support for numpy > 2.0 #656
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
base: master
Are you sure you want to change the base?
[MAIN] add support for numpy > 2.0 #656
Conversation
…ge to signed int to avoid this
| max_occs_size_dur, | ||
| bins=np.arange(min_occ, | ||
| np.max(max_occs_size_dur) + 2)) | ||
| np.max(max_occs_size_dur).astype(np.int16) + 2)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
max_occs_size_dur is uint which will cause an overflow in arange.
| el) >= self.min_spikes]) | ||
|
|
||
| def test_parameters_3d_min_occ(self): | ||
| # test min_occ parameter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
split test in two tests to be more precise when debugging.
|
|
||
| self.assertGreater(auc, 0.95) | ||
| self.assertGreater(auc, 0.95) | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use sub tests to ensure garbage collection is carried out in between. Otherwise excessive amounts of memory are used.
requirements/requirements.txt
Outdated
| @@ -1,5 +1,5 @@ | |||
| neo>=0.10.0 | |||
| numpy>=1.19.5, <2 | |||
| numpy>=1.19.5 | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
numpy>2.0 ?
|
|
||
| f_matrix /= (2 * self.sigma) | ||
| f_matrix = f_matrix / (2 * self.sigma) | ||
| return f_matrix |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See also : python-quantities/python-quantities#254
|
A comment regarding the changes, as several are due to the change in the string representation of NumPy types (obtained by the built-in We can also wrap the A third option would be to reconfigure Sphinx and DocTest instantiation to include the formatter in the initialization. The |
…sts with Pytest. The configuration sets the correct NumPy formatter when running doctests.
|
The last changes fix the doctests to work with NumPy 2.0 while keeping the old-style NumPy formatting in the docstrings (NumPy 1.25). The solution was to create a This solution was chosen as |
This pull request ensures compatibility with NumPy >2.0.
This adresses #652