Skip to content

Conversation

@jshanna100
Copy link

Bug from #5807. Every time a find_bads_eog/ref/ecg method was used, it reinitiated everything in ICA.labels_. Now they accumulate across multiple applications of these methods as they should.

@codecov
Copy link

codecov bot commented Feb 20, 2019

Codecov Report

Merging #5963 into master will increase coverage by 0.3%.
The diff coverage is 89.13%.

@@           Coverage Diff            @@
##           master   #5963     +/-   ##
========================================
+ Coverage   88.79%   89.1%   +0.3%     
========================================
  Files         401     401             
  Lines       72721   74210   +1489     
  Branches    12158   12619    +461     
========================================
+ Hits        64575   66126   +1551     
+ Misses       5218    5197     -21     
+ Partials     2928    2887     -41

@agramfort
Copy link
Member

good to go?

@jshanna100
Copy link
Author

Fine by me.

@agramfort
Copy link
Member

@larsoner asked for a test no?

also @jshanna100 you should not open PRs from your master branch

@jshanna100
Copy link
Author

This should work, though I can't be 100% sure at the moment. Matplotlib has suddenly decided to fail for all of the tests, and is throwing out a million errors, so it's hard to diagnose. Going on holiday tomorrow, so can't sort it out right now. My apologies for that...

@larsoner
Copy link
Member

In the first run there are PEP8 problems

https://travis-ci.org/mne-tools/mne-python/jobs

In the second run it times out because the test takes longer than 30 sec. Can you shorten the time of this test as much as possible?

@larsoner
Copy link
Member

Ideally a test for this sort of thing could be a few lines added to an existing test, adding almost no time to the run. If new ICA fitting is really required, limiting channel picks and amount of data fit helps. See how we do it in other tests

@jshanna100
Copy link
Author

Ok, though I will not be able to tend to this myself until the week after next.

Part of what needs to be tested is that the labelling for all three find_bads_ play together well, which, AFAICT, means that if it is to integrate with an already existing test it would have to be test_ica_ctf - this uses the only test dataset with EOG, ECG, and reference channels.

Including find_bads_ref means that an extra ICA fit on reference channels is unavoidable, though this adds very little time. In the case where we keep test_ica_labels as a separate test, the number of components on the main ICA fit could be significantly reduced, which may fix the timeout.

I can't figure out from the output what specifically the PEP8 problem is, and the link posted above doesn't go anywhere.

@larsoner
Copy link
Member

I'm fine just adding it to test_ica_ctf if that's the fastest way to do it.

Here is a better link, toward the bottom

https://travis-ci.org/mne-tools/mne-python/jobs/496748047#L3209

@jona-sassenhagen
Copy link
Contributor

Important fix, thanks for checking this @jshanna100 .

@jshanna100
Copy link
Author

Should be good now.

@larsoner
Copy link
Member

larsoner commented Mar 5, 2019

@jshanna100 does the test take much longer now?

@jshanna100
Copy link
Author

On a moderately fast desktop computer, it adds about 1 second.

icacomps = icarf.get_sources(raw)
# rename components so they are auto-detected by find_bads_ref
for c in icacomps.ch_names:
icacomps.rename_channels({c: 'REF_' + c})
Copy link
Member

Choose a reason for hiding this comment

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

icacomps.rename_channels({c: 'REF_' + c for c in icacomps.ch_names})

would be nicer and faster.

Copy link
Member

@agramfort agramfort left a comment

Choose a reason for hiding this comment

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

besides LGTM. Maybe a what's new update if it fixes something from 0.17 release?

@larsoner
Copy link
Member

larsoner commented Mar 5, 2019

I had a few minor nitpicks so I pushed them along with @agramfort's suggestion. ICA on ref is part of the 0.18 cycle so no need for whats_new.rst update.

Will merge once CI's come back happy (and will fix them if I broke them), thanks @jshanna100

@larsoner larsoner merged commit c3e7571 into mne-tools:master Mar 5, 2019
@larsoner
Copy link
Member

larsoner commented Mar 5, 2019

Thanks @jshanna100

jeythekey pushed a commit to jeythekey/mne-python that referenced this pull request Apr 27, 2019
* bare bones functionality for doing ICA on MEG reference channels and partially visualising these components

* bypassing topography, incomplete work on correlative functions

* woops

* ICA accepts reference channels, topography functions are skipped,
new function find_bads_ref identifies bad components that correlate with
reference channel derived components

* Solved various backwards compatibility issues.

* new private function _find_bads_ch now underlies find_bads_ecg/eog/ref

* should pass ica_test.py now

* fixed documentation formatting

* fix copy paste error in notes

* FIX: Minor fixes

* FIX: Order

* fix ICA.label_ bug

* restore individual channel info ICA.labels_

* new test for checking ICA.labels_

* rolled ICA.labels_ test into test_ica_ctf.

* ENH: Fixes for Alex
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.

4 participants