Skip to content

FIX: Use interpolation/method in numpy.percentile as available #3506

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

Merged
merged 1 commit into from
Sep 20, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions nipype/algorithms/confounds.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down