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

[MAIN] add support for numpy > 2.0 #656

Open
wants to merge 31 commits into
base: master
Choose a base branch
from

Conversation

Moritz-Alexander-Kern
Copy link
Member

This pull request ensures compatibility with NumPy >2.0.

This adresses #652

@@ -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))
Copy link
Member Author

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
Copy link
Member Author

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)

Copy link
Member Author

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.

@coveralls
Copy link
Collaborator

coveralls commented Feb 13, 2025

Coverage Status

coverage: 88.303%. remained the same
when pulling 240dabc on INM-6:support_numpy_2
into be33aa4 on NeuralEnsemble:master.

@@ -1,5 +1,5 @@
neo>=0.10.0
numpy>=1.19.5, <2
numpy>=1.19.5
Copy link
Member Author

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
Copy link
Member Author

Choose a reason for hiding this comment

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

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)
Copy link
Member Author

Choose a reason for hiding this comment

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

investigate origin of difference

@Moritz-Alexander-Kern Moritz-Alexander-Kern added this to the v1.2.0 milestone Mar 4, 2025
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