I don't know - I didn't put it there :-)

It would definitely cover the most typical nan case, which is when the
inputs are identical. But that case is already covered in the first lines
of this function, so I am not sure what other nan conditions might exist.

For what it's worth, commenting out those lines doesn't cause any test
failures, so at the very least we are not testing any of these other,
unknown nan conditions. Should I remove these lines?




On Tue, Mar 11, 2014 at 3:45 PM, Matthew Brett <notifications@github.com>wrote:

> In dipy/core/geometry.py:
>
> > @@ -859,8 +862,17 @@ def vec2vec_rotmat(u, v):
> >      R = np.array([[cosa, -sina, 0], [sina, cosa, 0], [0, 0, 1]])
> >      Rp = np.dot(Pt, np.dot(R, P))
> >
> > +    # Everything's fine, up to a sign reversal:
> > +    rot_back = np.dot(Rp, v)
> > +    sign_reverser = np.sign((np.sign(rot_back) == np.sign(u)) - 0.5).squeeze()
> > +
> > +    # Multiply each line by it's reverser and reassmble the matrix:
> > +    Rp = np.array([np.array(Rp[i,:]) *
> > +                   sign_reverser[i] for i in range(3)]).squeeze()
> > +
> >      # make sure that you don't return any Nans
> >      if np.sum(np.isnan(Rp)) > 0:
> >          return np.eye(3)
>
> Forgive ignorance again - but is eye(3) a reasonable default for all
> possible nan cases?
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/nipy/dipy/pull/334/files#r10498227>
> .
>