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

[REF] Rename T1c to "minimum image regression" #609

Merged
merged 7 commits into from
Oct 19, 2020

Conversation

tsalo
Copy link
Member

@tsalo tsalo commented Sep 24, 2020

Closes #605.

Changes proposed in this pull request:

  • Rename function name, variables, and output files for T1c global signal regression to match new designation as "minimum image regression."
  • Change multiline string-based comments to regular comments.
  • Clean up some steps (e.g., z-scoring of arrays) in the function.

@codecov
Copy link

codecov bot commented Sep 24, 2020

Codecov Report

Merging #609 into master will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #609   +/-   ##
=======================================
  Coverage   93.53%   93.53%           
=======================================
  Files          26       26           
  Lines        1965     1965           
=======================================
  Hits         1838     1838           
  Misses        127      127           
Impacted Files Coverage Δ
tedana/gscontrol.py 100.00% <100.00%> (ø)
tedana/workflows/tedana.py 90.11% <100.00%> (ø)

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 b0b81bc...5568a28. Read the comment docs.

@tsalo tsalo requested review from dowdlelt and jbteves October 3, 2020 15:21
acc = comptable[comptable.classification == 'accepted'].index.values
ign = comptable[comptable.classification == 'ignored'].index.values
acc = comptable[comptable.classification == "accepted"].index.values
ign = comptable[comptable.classification == "ignored"].index.values
not_ign = sorted(np.setdiff1d(all_comps, ign))

optcom_masked = optcom_ts[mask, :]
optcom_mu = optcom_masked.mean(axis=-1)[:, np.newaxis]
Copy link
Collaborator

Choose a reason for hiding this comment

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

If we're naming everything based on stat names, shouldn'lt we make this optcom_mean instead of optcom_mu? I figure since we have other style changes in this PR, this would be a good one to change this for.

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.

Only one slight change requested, otherwise looks good!

bold_ts = np.dot(cbetas[:, acc], mmix[:, acc].T)
t1_map = bold_ts.min(axis=-1)
# Build BOLD time series without amplitudes, and save T1-like effect
mehk_ts = np.dot(comp_pes[:, acc], mmix[:, acc].T)
Copy link
Collaborator

Choose a reason for hiding this comment

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

It's a little counter-intuitive to me to change this from "bold_ts" to "mehk_ts" (mid-elbow, high-kappa?) but leaving the comment the same. I'd recommend either changing the comment or reverting the variable name change.

Copy link
Member Author

Choose a reason for hiding this comment

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

You're totally right. I will improve the comment. I switched to MEHK (multi-echo high kappa) because "BOLD" is so unclear when we're dealing with multi-echo data.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks, I think that helps !! On the same point : can we write out MEHK here ?

@tsalo tsalo requested a review from jbteves October 13, 2020 21:56
Copy link
Member

@emdupre emdupre left a comment

Choose a reason for hiding this comment

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

Thanks, @tsalo ! I think this looks great.
I had a few small clarifications / questions.

from scipy import stats
from scipy.special import lpmv

from tedana import io, utils

LGR = logging.getLogger(__name__)
RepLGR = logging.getLogger('REPORT')
RefLGR = logging.getLogger('REFERENCES')
RepLGR = logging.getLogger("REPORT")
Copy link
Member

Choose a reason for hiding this comment

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

Was this just for style ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I ran black and isort on the file and then only kept changes from the top of the file and the minimum_image_regression function.

Copy link
Member Author

Choose a reason for hiding this comment

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

Scratch that- I don't think I ran isort. But I did run black.

tedana/gscontrol.py Outdated Show resolved Hide resolved
bold_ts = np.dot(cbetas[:, acc], mmix[:, acc].T)
t1_map = bold_ts.min(axis=-1)
# Build BOLD time series without amplitudes, and save T1-like effect
mehk_ts = np.dot(comp_pes[:, acc], mmix[:, acc].T)
Copy link
Member

Choose a reason for hiding this comment

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

Thanks, I think that helps !! On the same point : can we write out MEHK here ?

t1_map = bold_ts.min(axis=-1)
# Build time series of just BOLD-like components (i.e., MEHK) and save T1-like effect
mehk_ts = np.dot(comp_pes[:, acc], mmix[:, acc].T)
t1_map = mehk_ts.min(axis=-1) # map of T1-like effect
Copy link
Member

Choose a reason for hiding this comment

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

I know that this is a bigger question, but if we can maybe mention in the docstring that this is how we derive the T1-like effect ? Or should we change this comment / variable to reference the "minimum image" ?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think adding to the docstring would be better, because it'll also show up in the API docs.

Copy link
Member Author

Choose a reason for hiding this comment

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

I've improved the docstring.

io.filewrite(utils.unmask(cbetas_norm[:, 2:], mask),
op.join(out_dir, 'betas_hik_OC_T1c'), ref_img)
np.savetxt(op.join(out_dir, 'meica_mix_T1c.1D'), mmixnogs)
# Find the global signal based on the T1-like effect
Copy link
Member

@emdupre emdupre Oct 14, 2020

Choose a reason for hiding this comment

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

I'm not sure why the diff is splitting like this, but just to confirm: None of the functionality is changed here, no ?

Copy link
Member

Choose a reason for hiding this comment

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

(From my look-through I'd think not, but wanted to double-check !

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, that's weird... You're correct, though, that the functionality shouldn't change.

Copy link
Collaborator

Choose a reason for hiding this comment

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

It's splitting like that because of the change from """ -> #
They're all so close together that the heuristic is counting it as big text blobs since it's multi-line.

jbteves
jbteves previously approved these changes Oct 19, 2020
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.

This looks good, thanks @tsalo !

@tsalo
Copy link
Member Author

tsalo commented Oct 19, 2020

@jbteves I hate to discard your review, but I improved the docstring and added a reference to make things clearer. I'd love to know what you and @emdupre think of the new section in Notes.

@jbteves
Copy link
Collaborator

jbteves commented Oct 19, 2020

I think it's a good addition, thanks!

jbteves
jbteves previously approved these changes Oct 19, 2020
@tsalo tsalo requested a review from emdupre October 19, 2020 15:50
emdupre
emdupre previously approved these changes Oct 19, 2020
Copy link
Member

@emdupre emdupre left a comment

Choose a reason for hiding this comment

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

This looks great !! I had one small suggestion, but it's not worth holding up this PR over. Happy to see this in 👍

Co-authored-by: Elizabeth DuPre <emd222@cornell.edu>
@tsalo tsalo dismissed stale reviews from emdupre and jbteves via 5568a28 October 19, 2020 22:32
@tsalo
Copy link
Member Author

tsalo commented Oct 19, 2020

Thanks @emdupre and @jbteves. I'll wait until the CI passes and then I'll merge. No need to re-review.

@tsalo tsalo merged commit 005e9d9 into ME-ICA:master Oct 19, 2020
@tsalo tsalo deleted the ref/mir-t1c branch October 19, 2020 22:34
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.

Rename T1c to "minimum image regression"
3 participants