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
Kernel param for apply inverse #6609
Conversation
Signed-off-by: Dirk Gütlin <dirk.guetlin@stud.sbg.ac.at>
- Added test to check the full_data param Signed-off-by: Dirk Gütlin <dirk.guetlin@stud.sbg.ac.at>
Signed-off-by: Dirk Gütlin <dirk.guetlin@stud.sbg.ac.at>
Codecov Report
@@ Coverage Diff @@
## master #6609 +/- ##
==========================================
+ Coverage 89.48% 89.48% +<.01%
==========================================
Files 420 420
Lines 75601 75621 +20
Branches 12382 12385 +3
==========================================
+ Hits 67654 67673 +19
Misses 5139 5139
- Partials 2808 2809 +1 |
Signed-off-by: Dirk Gütlin <dirk.guetlin@stud.sbg.ac.at>
Oops, sure! Sorry, I forgot to switch it... |
-switched True/False of delayed param Signed-off-by: Dirk Gütlin <dirk.guetlin@stud.sbg.ac.at>
cd mne
git grep ":class:"
yes I sure you can be more explicit in the docstring.
… |
OK, thanks a lot! |
OK, i didn't find any class that links directly to the SourceEstimate data |
Signed-off-by: Dirk Gütlin <dirk.guetlin@stud.sbg.ac.at>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you check / test somewhere that pick_ori must be normal if delayed=True?
Co-Authored-By: Alexandre Gramfort <alexandre.gramfort@m4x.org>
Co-Authored-By: Alexandre Gramfort <alexandre.gramfort@m4x.org>
Well technically |
...from get_epochs to epochs Signed-off-by: Dirk Gütlin <dirk.guetlin@stud.sbg.ac.at>
Signed-off-by: Dirk Gütlin <dirk.guetlin@stud.sbg.ac.at>
Signed-off-by: Dirk Gütlin <dirk.guetlin@stud.sbg.ac.at>
- implemented computing of delayed for vector oris - changed docstring accordingly - enhanced tests to vector repr. Signed-off-by: Dirk Gütlin <dirk.guetlin@stud.sbg.ac.at>
merged/adapted to current master
mne/source_estimate.py
Outdated
tstep=tstep, subject=subject) | ||
else: | ||
return Klass(data=data, vertices=vertices, tmin=tmin, tstep=tstep, | ||
subject=subject) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's not how it works.
There should be a single return.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh sry, I did it because of
#6609 (comment)
But now I see what you mean. I'll change that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I already wrote it for you here #6609 (comment)
But I think that e41236f is even cleaner.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I already wrote it for you here #6609 (comment)
Yes, it just seemed to me that you'd be most in favor of:
+ stc = VectorSourceEstimate( + data=(data_rot, sens_data), vertices=vertices, tmin=tmin, + tstep=tstep, subject=subject + ) + else: + stc = VectorSourceEstimate( + data=data_rot, vertices=vertices, tmin=tmin, + tstep=tstep, subject=subject + )
But anyhow, I like your solution with the sentinel (tbh I didn't know about that practice). But it gets rid of that is_kernel
bool and it's compact. So, for me, that's fine!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code is meant to read by people (machines executing it is secondary), and usually, the flow is: look at the definition, look at the return check whatever else afterward. If you have 2 returns or you construct the return in 2 different places (which is the same thing) I need to understand what's in the middle of the function. Most of the time when you read a function it is not for debugging purposes I just want to skim through it and get a good grasp of whats going on.
If I have a single place that returns Klass
and does something at data
and this is in the return, I need no further reading. This function is a factory. Based on whatever, chooses which class to construct and modifies the data accordingly.
@DiGyt this is a nice read on sentinel https://treyhunner.com/2019/03/unique-and-sentinel-values-in-python/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@massich thanks for the review. I adressed your problem. |
This is meant to simplify mne-tools#6609
Moving the milestone for this to 0.21 |
Closed: See Issue #6290 |
Reference issue
This is one step for the GSoC TFR in Source Space Project (See: Issue #6290 ).
What does this implement/fix?
This change will allow the user to decide which data fields are returned from
apply_inverse_epochs
.An according if statement was already implemented, but previously assigned to an impossible if case.
If
full_data=True
, the full data field will be returned (as usual). Iffull_data=False
, the stc data will instead be returned as a tuple of (kernel, sensor_data). The real data is then automatically created when callingstc.data
.Additional information
Unfortunately, this only works for fixed orientations. For free orientations, this causes problems, since data is reshaped and multiplied with
noise_nn
in_make_stc
, steps that else need to be added when calling stc.data .