Skip to content

test_orientation is failing with new Numpy's pre-release #499

@MarcCote

Description

@MarcCote

In the next Numpy's release, boolean index must match indexed array along specified dimension.
See https://travis-ci.org/nipy/nibabel/jobs/186167556#L1230

From https://github.com/nipy/nibabel/blob/master/nibabel/orientations.py#L71

    P, S, Qs = npl.svd(RS)
    # Threshold the singular values to determine the rank.
    if tol is None:
        tol = S.max() * max(RS.shape) * np.finfo(S.dtype).eps
    keep = (S > tol)
    R = np.dot(P[:, keep], Qs[keep])

When RS is not square, keep will have a dimension less than either P's columns or Qs' rows, therefore indexing using keep will raise an error. I haven't examine the code but maybe we could use full_matrices=False when calling npl.svd() (see https://docs.scipy.org/doc/numpy/reference/generated/numpy.linalg.svd.html)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions