Repository navigation
FIX: CTF Projector comp - #5125
Conversation
|
A more general approach would be to modify |
| exclude='bads') | ||
| else: | ||
| picks = pick_types(my_info, meg=True, eeg=True, eog=True, ref_meg=False, | ||
| exclude='bads') |
There was a problem hiding this comment.
you can just do ref_meg = len(my_info['comps']) > 0; picks = pick_types(..., ref_meg=ref_meg).
Then we'll need a test that 1) proj can actually be calculated for CTF data (this should fail on master), and 2) that the proj do not contain ref channels.
|
For the test do you know anything about the files in MNE-testing-data/CTF?
Some of them (testdata_ctf.ds for example) have some eeg channels but I
don't know if any of them EOG or ECG.
…On Thu, Apr 12, 2018 at 10:40 AM Eric Larson ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In mne/preprocessing/ssp.py
<#5125 (comment)>:
> @@ -183,8 +183,14 @@ def _compute_exg_proj(mode, raw, raw_event, tmin, tmax,
_safe_del_key(flat, 'eog')
# exclude bad channels from projection
- picks = pick_types(my_info, meg=True, eeg=True, eog=True, ref_meg=False,
- exclude='bads')
+ if len(my_info['comps']) > 0:
+ # Keep reference channels if compensation channels are present
+ picks = pick_types(my_info, meg=True, eeg=True, eog=True, ref_meg=True,
+ exclude='bads')
+ else:
+ picks = pick_types(my_info, meg=True, eeg=True, eog=True, ref_meg=False,
+ exclude='bads')
you can just do ref_meg = len(my_info['comps']) > 0; picks =
pick_types(..., ref_meg=ref_meg).
Then we'll need a test that 1) proj can actually be calculated for CTF
data (this should fail on master), and 2) that the proj do not contain
ref channels.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#5125 (review)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AFU7nfmulhPm5Bh542m78_Ak0HUxJaPZks5tn2dcgaJpZM4TRxn2>
.
|
|
I don't know if there are ECG or EOG, but you can use any MEG/EEG channel as a surrogate if necessary (should be an option in the proj computation function). It doesn't matter if the projectors are correct here, just that they can be computed. |
Codecov Report
@@ Coverage Diff @@
## master #5125 +/- ##
==========================================
+ Coverage 88.06% 88.15% +0.08%
==========================================
Files 356 357 +1
Lines 65303 65805 +502
Branches 11128 11198 +70
==========================================
+ Hits 57511 58008 +497
+ Misses 4963 4959 -4
- Partials 2829 2838 +9 |
|
In writing the test I've bumped into something I think is strange. on master I only get this exception when I use Don't actually call |
|
That sounds like a bug. Perhaps the |
|
What is your advice for this PR? |
|
Sure, fixing one bug at a time can simplify things a bit |
| assert_array_almost_equal(projs, projs_2, 10) | ||
|
|
||
|
|
||
| def test_compute_proj_ctf(): |
There was a problem hiding this comment.
don't forget the @testing.requires_testing_data decorator here
| l_freq=None, h_freq=None, | ||
| reject=None, tmax=dur_use, | ||
| filter_length=6000) | ||
| assert_true(len(projs) == (5 + n_projs_init)) |
There was a problem hiding this comment.
With pytest it's better to do now assert len(projs) == ... directly, it gives nicer error messages than assert_true
|
|
||
|
|
||
| def test_compute_proj_ctf(): | ||
| """Trivial Test to show that projector code completes on CTF data""" |
There was a problem hiding this comment.
For consistency "Test to show that ..."
| l_freq=None, h_freq=None, | ||
| reject=None, tmax=dur_use, | ||
| filter_length=6000) | ||
| assert len(projs) == (4 + n_projs_init) |
There was a problem hiding this comment.
Can you check that none of the compensation channels are in the projs?
|
I added a check, although I think the best way would be would be something like with _bad_chans_comp from #5133 Once this is merged I'll add an additional check to that PR. |
|
Thanks @bloyl |
* FIX: keep meg_ref channels if comp channels exist * STYLE: more compact Code * ENH: added test for ssp computation on CTF data. * resp to review * FIX: PEP8 * FIX: check ctf projs are the correct channels
Closes #5124
When computing ssp projection operators, include the meg_ref channels for data objects that include compensation channels (i.e CTF data), otherwise creating epochs raises an exception.