Skip to content

Commit 4de3559

Browse files
Bump to numpy2
gdist 2.9.2 supports it
1 parent 1fa9392 commit 4de3559

3 files changed

Lines changed: 30 additions & 21 deletions

File tree

naplib/utils/surfdist.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def load_freesurfer_label(annot_input, label_name):
2424
labels, _, names = read_annot(annot_input)
2525
names = [i.decode("utf-8") for i in names]
2626
label_value = names.index(label_name)
27-
label_nodes = np.array(np.where(np.in1d(labels, label_value)), dtype=np.int32)
27+
label_nodes = np.array(np.where(np.isin(labels, label_value)), dtype=np.int32)
2828

2929
return label_nodes
3030

@@ -81,7 +81,7 @@ def triangles_keep_cortex(triangles, cortex):
8181
# for or each face/triangle keep only those that only contain nodes within the list of cortex nodes
8282
input_shape = triangles.shape
8383
triangle_is_in_cortex = np.all(
84-
np.reshape(np.in1d(triangles.ravel(), cortex), input_shape), axis=1
84+
np.reshape(np.isin(triangles.ravel(), cortex), input_shape), axis=1
8585
)
8686

8787
cortex_triangles_old = np.array(triangles[triangle_is_in_cortex], dtype=np.int32)
@@ -100,7 +100,7 @@ def translate_src(src, cortex):
100100
"""
101101
Convert source nodes to new surface (without medial wall).
102102
"""
103-
src_new = np.array(np.where(np.in1d(cortex, src))[0], dtype=np.int32)
103+
src_new = np.array(np.where(np.isin(cortex, src))[0], dtype=np.int32)
104104

105105
return src_new
106106

requirements.txt

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,29 @@
1-
matplotlib>=3.1.0
2-
numpy>=1.15.0,<2.0 # numpy>=2.0 is incompatible with gdist, a dependency of surfdist
3-
scipy>=1.5.0
4-
pandas>=1.0.0
5-
statsmodels>=0.13.0
1+
# Core Scientific Stack (Updated for NumPy 2.0 ABI/API compatibility)
2+
numpy>=2.0.0
3+
scipy>=1.13.0
4+
pandas>=2.2.2
5+
matplotlib>=3.9.0
6+
statsmodels>=0.14.2
7+
scikit-learn>=1.5.0
8+
9+
# Data Storage & IO
10+
h5py>=3.11.0
611
hdf5storage>=0.1.1
7-
seaborn>=0.12.0
812
pyyaml
9-
TextGrid
10-
scikit-learn
11-
joblib
12-
mne
13-
h5py
14-
patsy
13+
nibabel>=5.2.1
14+
15+
# Visualization
16+
seaborn>=0.13.0
17+
plotly>=5.22.0
18+
19+
# Domain Specific & Specialized
20+
gdist>=2.9.2
21+
mne>=1.7.1
22+
scikit-spatial>=7.1.0
1523
tdt>=0.5.0
16-
packaging
17-
plotly>=5.0.0
18-
nibabel>=5.0.0
19-
scikit-spatial>=5.0.0
20-
gdist>=2.0.0
24+
TextGrid
25+
26+
# Utilities
27+
joblib>=1.4.2
28+
patsy>=0.5.6
29+
packaging>=24.0

tests/preprocessing/test_filter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def bandpower(x, fs, fmin, fmax):
1010
f, Pxx = scipy.signal.periodogram(x, fs=fs)
1111
ind_min = np.argmax(f > fmin) - 1
1212
ind_max = np.argmax(f > fmax) - 1
13-
return np.trapz(Pxx[ind_min: ind_max], f[ind_min: ind_max])
13+
return np.trapezoid(Pxx[ind_min: ind_max], f[ind_min: ind_max])
1414

1515
@pytest.fixture(scope='module')
1616
def data():

0 commit comments

Comments
 (0)