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

[MRG] fixed bugs in preproc.py #22

Merged
merged 12 commits into from
Sep 13, 2018
Merged

[MRG] fixed bugs in preproc.py #22

merged 12 commits into from
Sep 13, 2018

Conversation

annapasca
Copy link
Contributor

  • added ref_meg='auto'
  • insert try for plot_psd

insert try for plot_psd
@codecov
Copy link

codecov bot commented Sep 10, 2018

Codecov Report

Merging #22 into master will increase coverage by 7.64%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #22      +/-   ##
==========================================
+ Coverage   21.55%   29.19%   +7.64%     
==========================================
  Files          18       19       +1     
  Lines        1429     1459      +30     
==========================================
+ Hits          308      426     +118     
+ Misses       1121     1033      -88
Impacted Files Coverage Δ
ephypype/preproc.py 41.5% <100%> (+37.04%) ⬆️
ephypype/tests/test_preproc.py 100% <100%> (ø)

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 e618877...b2af514. Read the comment docs.

@annapasca annapasca mentioned this pull request Sep 10, 2018

report.add_figs_to_section(figs=psds, captions=captions_psd,
section='ICA - muscles')
except: # noqa
Copy link
Contributor

Choose a reason for hiding this comment

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

it's not a good idea to put try-except clause in your repo. It's better to do it with an if-else ... and raise an appropriate warning

Copy link
Contributor Author

Choose a reason for hiding this comment

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

plot_psd raises an error. Looking at the MNE code it seems due to the fact that now to plot the PSD of 1 ICA component we have to use directly psd_multipaper. @dmalt do you have time to ckeck this?
@jasmainak the try was a temporary fix :)

@annapasca
Copy link
Contributor Author

@dmalt @jasmainak I removed the try and substitute the plot_psd with psd_multipaper + plot

@annapasca
Copy link
Contributor Author

I added some unit test...could they be ok?

@annapasca
Copy link
Contributor Author

@jasmainak it seems we need scikit-learn

psds.append(fig)
# fig = ica_src.plot_psd(tmax=60, picks=[i_ic], fmax=140, show=False)
# fig.set_figheight(3)
# fig.set_figwidth(5)
Copy link
Contributor

Choose a reason for hiding this comment

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

remove these comments when you are ready to merge

Copy link
Contributor

Choose a reason for hiding this comment

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

and set PR to [MRG] when you are ready :)

Copy link
Contributor

Choose a reason for hiding this comment

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

@annapasca you forgot to address this. But I'll do it for you now

@jasmainak
Copy link
Contributor

@annapasca you will need to update .travis.yml and appveyor.yml. Feel free to update them so that scikit-learn is installed.

@jasmainak
Copy link
Contributor

Thanks @annapasca for adding tests. That is awesome !! 🎉

@jasmainak jasmainak mentioned this pull request Sep 11, 2018
@annapasca
Copy link
Contributor Author

the error in appveyor it seems due to some download problem of MNE, is it? How can I start again appveyor?

@jasmainak
Copy link
Contributor

@annapasca you may want to add a tiny commit or amend the last commit and force push. I don't think there is a way to restart the build like in Travis ...

@annapasca
Copy link
Contributor Author

@jasmainak can I restart travis? It says the build has terminated but no error specified

@jasmainak
Copy link
Contributor

@annapasca sure feel free to restart Travis if you need. But this error is specific. It says:

No output has been received in the last 10m0s, this potentially indicates a stalled build or something wrong with the build itself.

Your tests should ideally be fast so that the screen is updating all the time. 10 minutes is the upper limit ...

@annapasca
Copy link
Contributor Author

Your tests should ideally be fast so that the screen is updating all the time. 10 minutes is the upper limit ...

@jasmainak thks! I understood now! I tried to make the test faster

@annapasca annapasca changed the title fixed bugs in preproc.py [MRG] fixed bugs in preproc.py Sep 13, 2018
Copy link
Contributor

@jasmainak jasmainak left a comment

Choose a reason for hiding this comment

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

Otherwise, LGTM. I'll fix them myself and merge so that we feel like we're making progress :)

psds.append(fig)
# fig = ica_src.plot_psd(tmax=60, picks=[i_ic], fmax=140, show=False)
# fig.set_figheight(3)
# fig.set_figwidth(5)
Copy link
Contributor

Choose a reason for hiding this comment

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

@annapasca you forgot to address this. But I'll do it for you now

def test_compute_ica():
"""Test compute ICA on raw data."""
ECG_ch_name = 'ECG'
EoG_ch_name = 'HEOG, VEOG'
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm surprised your pep8 linter didn't throw an error for this. Variable names should always be in lower case except in some limited cases.

@jasmainak
Copy link
Contributor

also @annapasca try to give your feature branch a more meaningful name if you can :-) Otherwise it's hard to try two pull requests which have the same name as the feature branch ...

@jasmainak jasmainak merged commit ec69624 into neuropycon:master Sep 13, 2018
@jasmainak
Copy link
Contributor

Few more comments:

  • tests should not write to the directory we are working from. Ideally it should save stuff in 'temp' directory
  • tests should not throw any warnings. Right now, I get warnings of too many open windows

But I'd say not urgent for now. Let's raise an issue so we don't forget.

@annapasca
Copy link
Contributor Author

@jasmainak about test

tests should not write to the directory we are working from. Ideally it should save stuff in 'temp' directory

NeuroPycon works saving most output in the absolute path, thus how can we solve this issue for the test?
e.g. the test_preproc saves 4 files in the dir we are running the test...

tests should not throw any warnings. Right now, I get warnings of too many open windows

OK! How is possible to avoid this?

Thks a lot for all your useful suggestions! :)

@jasmainak
Copy link
Contributor

@annapasca see here: https://github.com/mne-tools/mne-python/blob/master/mne/tests/test_epochs.py#L657 how to create a temporary directory. You can probably also use this directly.

@jasmainak
Copy link
Contributor

OK! How is possible to avoid this?

why don't you close the matplotlib figures once you use them in the report object?

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

2 participants