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: Revamps pyprep. An effort by NeurodataDesign at Johns Hopkins U #6

Merged
merged 59 commits into from
Jan 7, 2020

Conversation

adam2392
Copy link
Contributor

@adam2392 adam2392 commented Dec 12, 2019

Addresses: #5

Fixes include:

  1. full PREP implementation
  2. SK-learn style fit() pattern
  3. sub-pipelines as functions and classes, to allow customization
  4. unit/integration tests of said files
  5. black formatting
  6. Revamped travis.CI
  7. Includes notebook comparisons against MATLAB EEGLab's PREP

TODO:

  • update whats_new.rst
  • some additional testing using data I have w/ scalp EEG
  • clean up the raw data files to see if instead they can just be imported via mne-python (?)

@sappelhoff hope to get your initial feedback before tackling some of these "house-keeping" issues. Aamna and Liang are also done w/ the course at this point, so they may or may not help in this last endeavor. So I think between the two of us though, we can get this to however you want it to look :)

Nick3151 and others added 10 commits December 11, 2019 17:18
MRG: A common PR of Prep pipeline

1. Ports pyprep into Python3
2. Integrates full functionality of PREP
3. adds modularized sub-pipeline functions to run each part of PREP separately
4. Uses sklearn "fit()" function pattern
Remove read_montage function
Use DigMontage instead of montage_kind in Prep class
Update MNE version requirement to 19.2
Replace read_montage function with make_standard_montage
@codecov-io
Copy link

codecov-io commented Dec 15, 2019

Codecov Report

Merging #6 into master will decrease coverage by 1.68%.
The diff coverage is 97.69%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master       #6      +/-   ##
==========================================
- Coverage     100%   98.31%   -1.69%     
==========================================
  Files           2       12      +10     
  Lines         322     1006     +684     
==========================================
+ Hits          322      989     +667     
- Misses          0       17      +17
Impacted Files Coverage Δ
pyprep/noisy.py 100% <100%> (ø) ⬆️
test/test_removeTrend.py 100% <100%> (ø)
test/test_find_noisy_channels.py 100% <100%> (ø)
test/conftest.py 100% <100%> (ø)
test/test_reference.py 100% <100%> (ø)
test/test_prep_pipeline.py 100% <100%> (ø)
test/test_noisy.py 100% <100%> (ø) ⬆️
pyprep/prep_pipeline.py 100% <100%> (ø)
pyprep/removeTrend.py 94.73% <94.73%> (ø)
pyprep/utilities.py 94.73% <94.73%> (ø)
... and 12 more

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 0ef59ed...5f66193. Read the comment docs.

Copy link
Owner

@sappelhoff sappelhoff left a comment

Choose a reason for hiding this comment

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

Thanks!

I played around a bit with the changes by pulling your branch and making a new conda environment for it.

Please note that all of my comments are only "nice-to-have", because I lack the time to actually help with the requests :)

  • The prep_demo.ipynb does not run "out of the box" because it has a wrong path for the example file
  • Running the test suite, I get 39 warnings, most of which are deprecation warnings. It would be worth looking into resolving these warnings
  • the Makefile contains some non-working commands ... e.g., the build-doc command. I suggest to remove all unnecessary commands, keep the file minimal, and fix what's broken
  • Travis does not seem to run on this PR - any idea why?

@adam2392
Copy link
Contributor Author

Yes I agree, the datasets should be sort of "imported" via MNE API. Should be easily fixed here.

Can you advise what you mean for linking it in the sphinx gallery? Is all that is necessary, an explicit reference in that conf.py file? If not, what else should we do?

  • Running the test suite, I get 39 warnings, most of which are deprecation warnings. It would be worth looking into resolving these warnings

Agreed. I think these are mainly from the montage API being overhauled in the MNE versions.

  • the Makefile contains some non-working commands ... e.g., the build-doc command. I suggest to remove all unnecessary commands, keep the file minimal, and fix what's broken

Can erase as necessary.

  • Travis does not seem to run on this PR - any idea why?

I believe this should be a setting on your end? I am not a maintainer on this repo, so I can't access the travis, but I think there's a setting that enables PRs/branches to have travis run? If not, I'm not sure...

@sappelhoff
Copy link
Owner

I believe this should be a setting on your end? I am not a maintainer on this repo, so I can't access the travis, but I think there's a setting that enables PRs/branches to have travis run? If not, I'm not sure...

I just checked, and Travis is running the PR ... it's just not showing on GitHub somehow. Perhaps that'll be fixed automatically once one more commit is pushed.

I am not a maintainer on this repo

I just made you a maintainer, thanks again for contributing together with Aamna and Liang.

Can you advise what you mean for linking it in the sphinx gallery? Is all that is necessary, an explicit reference in that conf.py file? If not, what else should we do?

yes, the conf.py file needs to be edited to contain a sphinx-gallery import and the settings ... and more importantly, the ipynb example would have to be converted to a py file.

Some links to show you what I mean:

@adam2392 adam2392 added the enhancement New feature or request label Dec 22, 2019
@adam2392
Copy link
Contributor Author

@sappelhoff besides codecov, things are working out.

I converted the jupyter notebook to .py files, and did some adaptation of the conf.py files per your suggestion. I'm not too experienced w/ making docs the way you all do at MNE, but if there are still things missing, let me know!

Happy holidays ;)

Copy link
Owner

@sappelhoff sappelhoff left a comment

Choose a reason for hiding this comment

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

hi @adam2392 thanks for your patience :-)

If you could:

  1. make the CIs pass
  2. update what's new (https://github.com/sappelhoff/pyprep/blob/master/docs/source/whats_new.rst)

then I can merge this PR and deal with the rest.

@adam2392
Copy link
Contributor Author

adam2392 commented Jan 6, 2020

hi @adam2392 thanks for your patience :-)

If you could:

  1. make the CIs pass
  2. update what's new (https://github.com/sappelhoff/pyprep/blob/master/docs/source/whats_new.rst)

then I can merge this PR and deal with the rest.

Fixed the bug that pings users for input in the pytest. Updated the testing to make use of some fixtures that get thrown back and forth (e.g. mne.io.Raw and mne.Montage).

@sappelhoff sappelhoff merged commit f97e7ec into sappelhoff:master Jan 7, 2020
@sappelhoff
Copy link
Owner

and it's in! Thanks a lot everybody! :-)

May it help future researchers!

@sappelhoff
Copy link
Owner

@adam2392 I now fully integrated the code and updated the docs (see bottom of examples page: https://pyprep.readthedocs.io/en/latest/examples.html)

I decided against using binder + sphinx gallery for now, and instead I just ran the notebook on my machine, uploaded the ipynb output and provided a link to a notebook viewer:

https://nbviewer.jupyter.org/github/sappelhoff/pyprep/blob/master/examples/prep_demo.ipynb

Interestingly, the results now don't match so well anymore. Check the "results" section of the notebook, comparing the pyprep output and the "Matlab output".

I did not change any crucial code. What I did was:

  • fix some links
  • account for the fact that prep_pipeline takes a montage, not a string
  • introduce a more complete channel renaming function ... the map that you used before did not completely work --> I don't know how you didn't get errors before ... perhaps these errors were only recently introduced in MNE 🤷‍♂️

Anyhow, before we can make a release, we should check the full prep pipeline's output again.

Until that happens, I think it's okay to have this as an unreleased "work in progress" feature, which is also fine :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants