Skip to content

fix: use keyword bvecs= in gradient_table() calls to suppress dipy deprecation warning - #157

Merged
IvanARashid merged 1 commit into
OSIPI:mainfrom
Devguru-codes:dipy_warning
May 4, 2026
Merged

fix: use keyword bvecs= in gradient_table() calls to suppress dipy deprecation warning#157
IvanARashid merged 1 commit into
OSIPI:mainfrom
Devguru-codes:dipy_warning

Conversation

@Devguru-codes

Copy link
Copy Markdown
Contributor

This PR fixes a dipy deprecation warning in all 6 IAR_LU_ algorithms by converting bvec from a positional argument to the keyword form bvecs=bvec when calling gradient_table().

dipy 1.11.0 emits the following deprecation warning when bvec is passed positionally:

UserWarning: Pass ['bvecs'] as keyword args.
From version 2.0.0 passing these as positional arguments will result in an error.

This will become a hard error in dipy 2.0.0, breaking all 6 IAR_LU algorithms.

Changed 11 call sites across 6 files from:

gtab = gradient_table(self.bvalues, bvec, b0_threshold=0)

to:

gtab = gradient_table(self.bvalues, bvecs=bvec, b0_threshold=0)

Files Changed

File Lines Changed Location
IAR_LU_biexp.py Line 62 __init__ (2 other sites were already fixed)
IAR_LU_modified_mix.py Lines 61, 93 __init__ and ivim_fit
IAR_LU_modified_topopro.py Lines 64, 95 __init__ and ivim_fit
IAR_LU_segmented_2step.py Lines 63, 100 __init__ and ivim_fit
IAR_LU_segmented_3step.py Lines 63, 102 __init__ and ivim_fit
IAR_LU_subtracted.py Lines 61, 100 __init__ and ivim_fit

Testing

  • All 622 existing test_ivim_fit_saved tests pass (89 skipped, 11 xfailed, 4 xpassed).
  • Verified using a reproduction script (bug_2/reproduce_dipy_warning.py) that the warning is no longer emitted after the fix.
  • This is a non-breaking change — using the keyword argument produces identical behavior to positional; it only suppresses the deprecation warning and ensures forward compatibility with dipy 2.0.0.

Fixes #156

@IvanARashid
IvanARashid merged commit 69c8a86 into OSIPI:main May 4, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] dipy gradient_table deprecation - positional bvec arg will break on dipy 2.0

2 participants