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

Conversation

handwerkerd
Copy link
Member

For 5 echo data, I was noticing the following warning:

INFO     tedana:tedana_workflow:584 Computing T2* map
/Users/handwerkerd/code/tedana_community/me-ica/tedana/tedana/decay.py:40: RuntimeWarning: divide by zero encountered in true_divide
  temp_arr = np.exp(-echo_times / t2s)  # (E x V) array
INFO     combine:make_optcom:242 Optimally combining data with voxel-wise T2* estimates

This warning was created by #736 when it became possible to to send a t2s volume with 0's to _apply_t2s_floor The function correctly ignored voxels where t2s was zero, but only after dividing by t2s and triggering this warning

Changes proposed in this pull request:

  • Edited _apply_t2s_floor so that voxels with 0 in t2s are excluded from the denominator when dividing

@codecov
Copy link

codecov bot commented Sep 22, 2021

Codecov Report

Merging #807 (b1e1f38) into main (0f04f76) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #807   +/-   ##
=======================================
  Coverage   93.26%   93.27%           
=======================================
  Files          27       27           
  Lines        2213     2215    +2     
=======================================
+ Hits         2064     2066    +2     
  Misses        149      149           
Impacted Files Coverage Δ
tedana/decay.py 97.27% <100.00%> (+0.03%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0f04f76...b1e1f38. Read the comment docs.

tedana/decay.py Show resolved Hide resolved
Copy link
Collaborator

@jbteves jbteves left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for patching this @handwerkerd !

@jbteves
Copy link
Collaborator

jbteves commented Sep 22, 2021

@handwerkerd would you mind prepending the [FIX] tag to this PR?

@handwerkerd handwerkerd changed the title Address divide by 0 issue in decay.py [FIX] Address divide by 0 issue in decay.py Sep 22, 2021
Copy link
Member

@tsalo tsalo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks good to me too. Thanks!

@handwerkerd handwerkerd merged commit 5399ca5 into ME-ICA:main Sep 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants