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

WIP: STC baseline correction #8452

Merged
merged 12 commits into from Nov 5, 2020

Conversation

olafhauk
Copy link
Contributor

Thanks for contributing a pull request! Please make sure you have read the
contribution guidelines
before submitting.

Please be aware that we are a loose team of volunteers so patience is
necessary. Assistance handling other issues is very welcome. We value
all user contributions, no matter how minor they are. If we are slow to
review, either the pull request needs some benchmarking, tinkering,
convincing, etc. or more likely the reviewers are simply busy. In either
case, we ask for your understanding during the review process.

Again, thanks for contributing!

Reference issue

#8232

What does this implement/fix?

Baseline-correction for source estimates is recommended/necessary for some processing steps. For example, for unsigned source estimates, differences in noise levels may result in differences in intensities (e.g. for conditions with very different numbers of trials). This can be compenstated for by baseline-correction.
I will add a method appy_baseline() to source_estimate.py, analogous to evoked.py. I will add documentation to highlight the caveats of baseline correction for source estimates.

Additional information

Any additional information you think is important.


times = stc.times

for baseline in baselines:
Copy link
Contributor

Choose a reason for hiding this comment

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

I would do

Suggested change
for baseline in baselines:
for (start, stop) in baselines:

# test on different source estimates
stcs = []
stcs.append(read_source_estimate(fname_stc))
stcs.append(read_source_estimate(fname_vol, 'sample'))
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
stcs.append(read_source_estimate(fname_vol, 'sample'))
stcs = [read_source_estimate(fname_stc), read_source_estimate(fname_vol, 'sample')]

if baseline[1] is None:
t1 = stc.times[-1]
else:
t1 = baseline[1]
Copy link
Contributor

Choose a reason for hiding this comment

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

I would do t1 = baseline or stc.times[-1]

else:
t1 = baseline[1]

# indec for baseline interval (include boundary latencies)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
# indec for baseline interval (include boundary latencies)
# index for baseline interval (include boundary latencies)

@olafhauk
Copy link
Contributor Author

olafhauk commented Nov 2, 2020

@jona-sassenhagen Thanks a lot - I hope I managed to implement all your suggestions.

I cannot make sense of the following build_docs complaints:

/home/circleci/project/mne/source_estimate.py:docstring of mne.MixedSourceEstimate.apply_baseline:31: WARNING: Explicit markup ends without a blank line; unexpected unindent.
/home/circleci/project/mne/source_estimate.py:docstring of mne.MixedVectorSourceEstimate.apply_baseline:31: WARNING: Explicit markup ends without a blank line; unexpected unindent.
/home/circleci/project/mne/source_estimate.py:docstring of mne.SourceEstimate.apply_baseline:31: WARNING: Explicit markup ends without a blank line; unexpected unindent.
/home/circleci/project/mne/source_estimate.py:docstring of mne.VectorSourceEstimate.apply_baseline:31: WARNING: Explicit markup ends without a blank line; unexpected unindent.
/home/circleci/project/mne/source_estimate.py:docstring of mne.VolSourceEstimate.apply_baseline:31: WARNING: Explicit markup ends without a blank line; unexpected unindent.
/home/circleci/project/mne/source_estimate.py:docstring of mne.VolVectorSourceEstimate.apply_baseline:31: WARNING: Explicit markup ends without a blank line; unexpected unindent.

@olafhauk
Copy link
Contributor Author

olafhauk commented Nov 3, 2020

I don't think the remaining errors have anything to do with me - please let me know.

@GuillaumeFavelier
Copy link
Contributor

I restarted Azure and it's green now.

@hoechenberger
Copy link
Member

@olafhauk You need to mark this PR as ready for review so it can be merged

@olafhauk olafhauk marked this pull request as ready for review November 3, 2020 12:40
@hoechenberger
Copy link
Member

@jona-sassenhagen Merge if you're happy

@jona-sassenhagen jona-sassenhagen merged commit 9e15df7 into mne-tools:master Nov 5, 2020
5 checks passed
@agramfort
Copy link
Member

was missing a what's new entry...

@olafhauk can you make a PR to get credit for this work?

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.

None yet

5 participants