-
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?
Changes from all commits
23f8193
49e7ed4
3991ca6
23047b9
e2980f6
f001e25
e7fc540
6d04d2a
bfa4540
c21c279
6672bb2
60d701b
309003a
7ba256e
38595b8
e120952
240dabc
62cf1b0
aa99fab
6cbe9dc
0a1df94
4012dbe
1b47f79
c545d6b
a9daa14
42b6ee2
ceafbf1
5b44b3a
e1b1b68
873f89f
7659dd4
d63996a
36d4410
569f899
00b99ac
8bfb6d0
389f538
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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)) | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. max_occs_size_dur is |
||
| occs = occs[:-1].astype(np.uint16) | ||
| pvalues = np.cumsum(counts[::-1])[::-1] / n_surr | ||
| for occ_id, occ in enumerate(occs): | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -404,7 +404,7 @@ def test_spade_msip_3d(self): | |
| assert_equal(lags_msip, self.lags_msip) | ||
|
|
||
| # test under different configuration of parameters than the default one | ||
| def test_parameters_3d(self): | ||
| def test_parameters_3d_min_spikes(self): | ||
| # test min_spikes parameter | ||
| output_msip_min_spikes = spade.spade( | ||
| self.msip, | ||
|
|
@@ -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 | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. split test in two tests to be more precise when debugging. |
||
| output_msip_min_occ = spade.spade( | ||
| self.msip, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -87,25 +87,26 @@ def test_total_spiking_probability_edges(self): | |
| "ER10/new_sim0_100.mat", | ||
| "ER15/new_sim0_100.mat", | ||
| ] | ||
| repo_base_path = 'unittest/functional_connectivity/' \ | ||
| 'total_spiking_probability_edges/data/' | ||
|
|
||
| for datafile in files: | ||
| repo_base_path = 'unittest/functional_connectivity/' \ | ||
| 'total_spiking_probability_edges/data/' | ||
| downloaded_dataset_path = download_datasets(repo_base_path + | ||
| datafile) | ||
| with self.subTest(datafile=datafile): | ||
| downloaded_dataset_path = download_datasets(repo_base_path + | ||
| datafile) | ||
|
|
||
| spiketrains, original_data = load_spike_train_simulated( | ||
| downloaded_dataset_path) | ||
| spiketrains, original_data = load_spike_train_simulated( | ||
| downloaded_dataset_path) | ||
|
|
||
| connectivity_matrix, delay_matrix = \ | ||
| total_spiking_probability_edges(spiketrains) | ||
| connectivity_matrix, delay_matrix = \ | ||
| total_spiking_probability_edges(spiketrains) | ||
|
|
||
| # Remove self-connections | ||
| np.fill_diagonal(connectivity_matrix, 0) | ||
| # Remove self-connections | ||
| np.fill_diagonal(connectivity_matrix, 0) | ||
|
|
||
| _, _, _, auc = roc_curve(connectivity_matrix, original_data) | ||
| _, _, _, auc = roc_curve(connectivity_matrix, original_data) | ||
|
|
||
| self.assertGreater(auc, 0.95) | ||
| self.assertGreater(auc, 0.95) | ||
|
|
||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
| # ====== HELPER FUNCTIONS ====== | ||
|
|
||
|
|
@@ -173,7 +174,7 @@ def roc_curve(estimate, original): | |
| tpr_list.append(sensitivity(*conf_matrix)) | ||
| fpr_list.append(fall_out(*conf_matrix)) | ||
|
|
||
| auc = np.trapz(tpr_list, fpr_list) | ||
| auc = np.trapezoid(tpr_list, fpr_list) | ||
|
|
||
| return tpr_list, fpr_list, thresholds, auc | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| neo>=0.10.0 | ||
| numpy>=1.19.5, <2 | ||
| numpy>=2.0.0 | ||
| quantities>=0.14.1 | ||
| scipy>=1.10.0 | ||
| six>=1.10.0 | ||
|
|
||
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