Skip to content

Commit e6dfe7d

Browse files
committed
ensure s is defined, support NaN failure mode with empty mask
1 parent fa64907 commit e6dfe7d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

nipype/algorithms/confounds.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1299,9 +1299,10 @@ def compute_noise_components(imgseries, mask_images, components_criterion=0.5,
12991299
# principal components using a singular value decomposition."
13001300
try:
13011301
u, s, _ = fallback_svd(M, full_matrices=False)
1302-
except np.linalg.LinAlgError:
1302+
except (np.linalg.LinAlgError, ValueError):
13031303
if failure_mode == 'error':
13041304
raise
1305+
s = np.full(M.shape[0], np.nan, dtype=np.float32)
13051306
if components_criterion >= 1:
13061307
u = np.full((M.shape[0], components_criterion),
13071308
np.nan, dtype=np.float32)

0 commit comments

Comments
 (0)