Skip to content

Commit 4d51686

Browse files
authored
Merge pull request #3506 from effigies/fix/flexible_numpy
FIX: Use interpolation/method in numpy.percentile as available
2 parents eb779e6 + 188ebbd commit 4d51686

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

nipype/algorithms/confounds.py

+10-4
Original file line numberDiff line numberDiff line change
@@ -1059,10 +1059,16 @@ def compute_dvars(
10591059

10601060
# Robust standard deviation (we are using "lower" interpolation
10611061
# because this is what FSL is doing
1062-
func_sd = (
1063-
np.percentile(mfunc, 75, axis=1, method="lower")
1064-
- np.percentile(mfunc, 25, axis=1, method="lower")
1065-
) / 1.349
1062+
try:
1063+
func_sd = (
1064+
np.percentile(mfunc, 75, axis=1, method="lower")
1065+
- np.percentile(mfunc, 25, axis=1, method="lower")
1066+
) / 1.349
1067+
except TypeError: # NP < 1.22
1068+
func_sd = (
1069+
np.percentile(mfunc, 75, axis=1, interpolation="lower")
1070+
- np.percentile(mfunc, 25, axis=1, interpolation="lower")
1071+
) / 1.349
10661072

10671073
if remove_zerovariance:
10681074
zero_variance_voxels = func_sd > variance_tol

0 commit comments

Comments
 (0)