From 188ebbd0d95eb0bb173eb8115789b2fdccdb028c Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Wed, 14 Sep 2022 16:57:59 -0400 Subject: [PATCH] FIX: Use interpolation/method in numpy.percentile as available --- nipype/algorithms/confounds.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/nipype/algorithms/confounds.py b/nipype/algorithms/confounds.py index 63dc3def2a..d28de35845 100644 --- a/nipype/algorithms/confounds.py +++ b/nipype/algorithms/confounds.py @@ -1059,10 +1059,16 @@ def compute_dvars( # Robust standard deviation (we are using "lower" interpolation # because this is what FSL is doing - func_sd = ( - np.percentile(mfunc, 75, axis=1, method="lower") - - np.percentile(mfunc, 25, axis=1, method="lower") - ) / 1.349 + try: + func_sd = ( + np.percentile(mfunc, 75, axis=1, method="lower") + - np.percentile(mfunc, 25, axis=1, method="lower") + ) / 1.349 + except TypeError: # NP < 1.22 + func_sd = ( + np.percentile(mfunc, 75, axis=1, interpolation="lower") + - np.percentile(mfunc, 25, axis=1, interpolation="lower") + ) / 1.349 if remove_zerovariance: zero_variance_voxels = func_sd > variance_tol