Skip to content

Commit

Permalink
RF: Convert nan values in bvectors to 0's
Browse files Browse the repository at this point in the history
This get's rid of warnings of the following type that currently show up
in our tests:

    ./Users/arokem/source/dipy/dipy/core/gradients.py:132: RuntimeWarning: invalid value encountered in less_equal
  bvecs_close_to_1 = abs(vector_norm(bvecs) - 1) <= atol
  • Loading branch information
arokem committed Dec 21, 2015
1 parent 32a2b01 commit c6f0d1f
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions dipy/core/gradients.py
Expand Up @@ -129,6 +129,7 @@ def gradient_table_from_bvals_bvecs(bvals, bvecs, b0_threshold=0, atol=1e-2,
"respectively, where N is the number of diffusion "
"gradients")

bvecs[np.isnan(bvecs)] = 0
bvecs_close_to_1 = abs(vector_norm(bvecs) - 1) <= atol
if bvecs.shape[1] != 3 or not np.all(bvecs_close_to_1[dwi_mask]):
raise ValueError("bvecs should be (N, 3), a set of N unit vectors")
Expand Down

0 comments on commit c6f0d1f

Please sign in to comment.