-
Notifications
You must be signed in to change notification settings - Fork 93
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
[MAIN] add support for numpy > 2.0 #656
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
@@ -1450,7 +1450,7 @@ def _get_pvalue_spec(max_occs, min_spikes, max_spikes, min_occ, n_surr, winlen, | |||
counts, occs = np.histogram( | |||
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
.
@@ -438,6 +438,7 @@ def test_parameters_3d(self): | |||
el for el in self.elements_msip if len(el) >= self.min_neu and len( | |||
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.
@@ -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 ?
@@ -344,7 +344,7 @@ def get_f_matrix(self): | |||
self.coord_electrode[i])**2 + (self.diam[j] / 2)**2)- | |||
abs(self.coord_electrode[j] + self.coord_electrode[i]))) | |||
|
|||
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
np.testing.assert_allclose(arr_coh, anasig_coh, atol=1e-6) | ||
np.testing.assert_array_equal(arr_phi, anasig_phi) | ||
np.testing.assert_allclose(arr_coh, anasig_coh.magnitude, atol=1e-6) | ||
np.testing.assert_array_almost_equal(arr_phi, anasig_phi.magnitude) |
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.
investigate origin of difference
This pull request ensures compatibility with NumPy >2.0.
This adresses #652