Skip to content
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

test for new error in IVIM #1683

Merged
merged 2 commits into from Dec 7, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion dipy/data/fetcher.py
Expand Up @@ -1092,7 +1092,7 @@ def read_ivim():
fbval = pjoin(folder, 'ivim.bval')
fbvec = pjoin(folder, 'ivim.bvec')
bvals, bvecs = read_bvals_bvecs(fbval, fbvec)
gtab = gradient_table(bvals, bvecs)
gtab = gradient_table(bvals, bvecs, b0_threshold=0)
img = nib.load(fraw)
return img, gtab

Expand Down
2 changes: 1 addition & 1 deletion dipy/reconst/ivim.py
Expand Up @@ -135,7 +135,7 @@ def __init__(self, gtab, split_b_D=400.0, split_b_S0=200., bounds=None,
x_scale=[1000., 0.1, 0.001, 0.0001],
options={'gtol': 1e-15, 'ftol': 1e-15,
'eps': 1e-15, 'maxiter': 1000}):
"""
r"""
Initialize an IVIM model.

The IVIM model assumes that biological tissue includes a volume
Expand Down
17 changes: 17 additions & 0 deletions dipy/reconst/tests/test_ivim.py
Expand Up @@ -202,6 +202,23 @@ def test_with_higher_S0():
assert_array_almost_equal(ivim_fit.model_params, params2)


def test_b0_threshold_greater_than0():
"""
Added test case for default b0_threshold set to 50.
Checks if error is thrown correctly.
"""
bvals_b0t = np.array([50., 10., 20., 30., 40., 60., 80., 100.,
120., 140., 160., 180., 200., 300., 400.,
500., 600., 700., 800., 900., 1000.])
N = len(bvals_b0t)
bvecs = generate_bvecs(N)
gtab = gradient_table(bvals_b0t, bvecs.T)
with assert_raises(ValueError) as vae:
_ = IvimModel(gtab)
b0_s = "The IVIM model requires a measurement at b==0. As of "
assert b0_s in vae.exception


def test_bounds_x0():
"""
Test to check if setting bounds for signal where initial value is
Expand Down