Skip to content

Commit edc7b4e

Browse files
committed
BF: fixing RS.shape + use allclose (was allzeros)
1 parent 38891ff commit edc7b4e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

nibabel/orientations.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def io_orientation(affine, tol=None):
6262
P, S, Qs = npl.svd(RS)
6363
# Threshold the singular values to determine the rank.
6464
if tol is None:
65-
tol = S.max() * max(S.shape) * np.finfo(S.dtype).eps
65+
tol = S.max() * max(RS.shape) * np.finfo(S.dtype).eps
6666
keep = (S > tol)
6767
R = np.dot(P[:, keep], Qs[keep])
6868
# the matrix R is such that np.dot(R,R.T) is projection onto the
@@ -75,7 +75,7 @@ def io_orientation(affine, tol=None):
7575
ornt = np.ones((p, 2), dtype=np.int8) * np.nan
7676
for in_ax in range(p):
7777
col = R[:, in_ax]
78-
if not np.alltrue(np.equal(col, 0)):
78+
if not np.alltrue(np.allclose(col, 0)):
7979
out_ax = np.argmax(np.abs(col))
8080
ornt[in_ax, 0] = out_ax
8181
assert col[out_ax] != 0

0 commit comments

Comments
 (0)