Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] Address divide by 0 issue in decay.py #807

Merged
merged 1 commit into from
Sep 22, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion tedana/decay.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ def _apply_t2s_floor(t2s, echo_times):
echo_times = echo_times[:, None]

eps = np.finfo(dtype=t2s.dtype).eps # smallest value for datatype
temp_arr = np.exp(-echo_times / t2s) # (E x V) array
nonzerovox = t2s != 0
# Exclude values where t2s is 0 when dividing by t2s.
# These voxels are also excluded from bad_voxel_idx
tsalo marked this conversation as resolved.
Show resolved Hide resolved
temp_arr = np.zeros((len(echo_times), len(t2s)))
temp_arr[:, nonzerovox] = np.exp(-echo_times / t2s[nonzerovox]) # (E x V) array
bad_voxel_idx = np.any(temp_arr == 0, axis=0) & (t2s != 0)
n_bad_voxels = np.sum(bad_voxel_idx)
if n_bad_voxels > 0:
Expand Down