Skip to content

Commit 3b4b5df

Browse files
authored
Merge pull request #111 from VinceBaz/master
[MNT] Import private namespaces if scipy > 1.8.0
2 parents 503d9ad + bd7bffc commit 3b4b5df

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

netneurotools/freesurfer.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@
1010
from nibabel.freesurfer import read_annot, read_geometry
1111
import numpy as np
1212
from scipy import sparse
13-
from scipy.ndimage.measurements import _stats, labeled_comprehension
13+
try: # scipy >= 1.8.0
14+
from scipy.ndimage._measurements import _stats, labeled_comprehension
15+
except ImportError: # scipy < 1.8.0
16+
from scipy.ndimage.measurements import _stats, labeled_comprehension
1417
from scipy.spatial.distance import cdist
1518

1619
from .datasets import fetch_fsaverage

netneurotools/stats.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@
99
from tqdm import tqdm
1010
from itertools import combinations
1111
from scipy import optimize, spatial, special, stats as sstats
12-
from scipy.stats.stats import _chk2_asarray
12+
try: # scipy >= 1.8.0
13+
from scipy.stats._stats_py import _chk2_asarray
14+
except ImportError: # scipy < 1.8.0
15+
from scipy.stats.stats import _chk2_asarray
1316
from sklearn.utils.validation import check_random_state
1417
from sklearn.linear_model import LinearRegression
1518

0 commit comments

Comments
 (0)