Skip to content

Conversation

@adam2392
Copy link
Member

@adam2392 adam2392 commented May 12, 2020

Reference issue

Addresses: mne-tools/mne-misc-data#3

What does this implement/fix?

Updates plot_ecog example to use EDF data from mne-misc-data.

The ECoG data that currently is used for mne-python demos only contains an ECoG montage, but no "demoable" raw EDF files. As such, most demos showing off ECoG/SEEG functionality sort of just hack together random data points generated (e.g. np.random.random(50, 100) for a 50 x 100 channel recording), whereas it would be nice to have a fleshed out demo w/ a real EDF file to show end-to-end MNE functionality.

Additional information

This also raised issues in mne-bids, where we wanted to make an ieeg example, but had to hack together a soln. since no EDF versions of iEEG data was available in mne.

mne-tools/mne-bids#404

@adam2392
Copy link
Member Author

adam2392 commented May 12, 2020

@larsoner I am trying to update the download path accordingly like you suggested, but I get this error:

Downloading archive https://github.com/adam2392/mne-misc-data/tarball/seeg to /Users/adam2392/mne_data
Downloading https://codeload.github.com/adam2392/mne-misc-data/legacy.tar.gz/seeg (0 bytes)
Error while fetching file https://github.com/adam2392/mne-misc-data/tarball/seeg. Dataset fetching aborted.
  0%|          | Downloading : 0.00/0.00 [00:00<?,        ?B/s]Traceback (most recent call last):
  File "/Users/adam2392/Documents/mne-python/tutorials/misc/plot_ecog.py", line 29, in <module>
    mat = loadmat(mne.datasets.misc.data_path() + '/ecog/sample_ecog.mat')
  File "<decorator-gen-405>", line 21, in data_path
  File "/Users/adam2392/Documents/mne-python/mne/datasets/misc/_misc.py", line 15, in data_path
    download=download)
  File "/Users/adam2392/Documents/mne-python/mne/datasets/utils.py", line 397, in _data_path
    remove_archive, full = _download(path, u, an, h)
  File "/Users/adam2392/Documents/mne-python/mne/datasets/utils.py", line 455, in _download
    hash_=hash_, hash_type=hash_type)
  File "<decorator-gen-3>", line 21, in _fetch_file
  File "/Users/adam2392/Documents/mne-python/mne/utils/fetching.py", line 117, in _fetch_file
    _get_http(url, temp_file_name, initial_size, timeout, verbose_bool)
  File "/Users/adam2392/Documents/mne-python/mne/utils/fetching.py", line 55, in _get_http
    with open(temp_file_name, mode) as local_file:
FileNotFoundError: [Errno 2] No such file or directory: '/Users/adam2392/mne_data/https://github.com/adam2392/mne-misc-data/tarball/seeg.part'
  0%|          | Downloading : 0.00/0.00 [00:00<?,        ?B/s]

Any suggestions?

@larsoner
Copy link
Member

larsoner commented May 12, 2020

Fixed:

  • paths for downloading
  • colormap (should use one-sided for one-sided data)
  • animation
  • a few flake errors

Now things run smoothly for me:

Peek 2020-05-12 10-10

I don't think that sphinx-gallery natively supports FuncAnimation objects, but it probably should.

@larsoner
Copy link
Member

This example might give us a reason to look into sphinx-gallery/sphinx-gallery#150

@larsoner
Copy link
Member

Renders okay, so data downloading etc. works. No animation for now but it at least captures the figure:

https://20034-1301584-gh.circle-artifacts.com/0/dev/auto_tutorials/misc/plot_ecog.html#sphx-glr-auto-tutorials-misc-plot-ecog-py

You should be good to keep developing now @adam2392

@adam2392
Copy link
Member Author

I'm not going to do the animation actually. Don't feel very comfortable w/ my abilities there... But happy to take a look in the future of how this is possible.

The current state attempts to show users how to create some "snapshots" of the data and overlays them onto the FreeSurfer brain.

Some notes: For visualization purposes, I've found that MNE-python has a hard time for iEEG. However, the plot_ecog.py example has always been helpful to me because you can show ecog grids relatively simply, compared to say SEEG, or ECoG strips scattered over both hemispheres. I'm looking into blender to assist w/ my visualization needs on SEEG and more advanced cases where interactive (rotation, zoom, transparency, etc.) are necessary. If there is anything "Pythonable", then would like to make an issue to see if mne-python would like to use it.

@adam2392 adam2392 requested a review from agramfort May 13, 2020 15:39
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.

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.

maybe @drammock want to have a look before merging?

@larsoner
Copy link
Member

@adam2392 do you want to restore the animation I had put in? It looked pretty cool and sphinx-gallery/sphinx-gallery#687 is very close to being in (I think) so it should be possible to actually have the animation show up in the docs

@adam2392
Copy link
Member Author

Sure, I think we need to figure out an API for this sort of thing. Really I think it should end up being built into the new 3D brain object that @GuillaumeFavelier is working on, there are already nice interactive controls in there that could be used.

Can you provide links to expand on what this 3D brain is? Sounds interesting and useful.

@larsoner
Copy link
Member

#7162 links to a ton if PRs / issues / plans

@larsoner
Copy link
Member

  File "/home/circleci/project/tutorials/misc/plot_ecog.py", line 142, in <module>
    epochs = mne.Epochs(raw, events, tmin=0, tmax=raw.times[-1],
  File "<decorator-gen-184>", line 21, in __init__
  File "/home/circleci/project/mne/epochs.py", line 2085, in __init__
    super(Epochs, self).__init__(
  File "<decorator-gen-175>", line 21, in __init__
  File "/home/circleci/project/mne/epochs.py", line 472, in __init__
    _check_baseline(baseline, tmin, tmax, info['sfreq'])
  File "/home/circleci/project/mne/epochs.py", line 1850, in _check_baseline
    raise ValueError('Baseline interval is only one sample. Use '
ValueError: Baseline interval is only one sample. Use `baseline=(0, 0)` if this is desired.

@larsoner
Copy link
Member

generating gallery for auto_tutorials/misc... [ 33%] plot_ecog.py
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-circleci'
make: *** [Makefile:49: html_dev-pattern] Terminated

Too long with no output (exceeded 10m0s): context deadline exceeded

Probably need to set the number of frames and/or the interval

@larsoner
Copy link
Member

larsoner commented May 15, 2020

I went to using the Hilbert transform to compute the power in the band, feel free to switch back to CWT if need be, but I doubt it matters much (maybe .filter(None, 10) the gamma-band one if you want it to be smoother?) and the Hilbert is much faster

@larsoner
Copy link
Member

larsoner commented May 15, 2020

@adam2392
Copy link
Member Author

I went to using the Hilbert transform to compute the power in the band, feel free to switch back to CWT if need be, but I doubt it matters much (maybe .filter(None, 10) the gamma-band one if you want it to be smoother?) and the Hilbert is much faster

Sweet! Had dinner and came back to this sweet thumbnail. That's a neat sphinx trick... For purposes of an example, I think Hilbert is fine.

@agramfort
Copy link
Member

agramfort commented May 15, 2020

@drammock merge if happy. LGTM

@agramfort
Copy link
Member

agramfort commented May 15, 2020 via email

Copy link
Member

@drammock drammock left a comment

Choose a reason for hiding this comment

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

A few suggestions to smooth things, but otherwise +1 for merge.

adam2392 and others added 6 commits May 15, 2020 13:05
Co-authored-by: Daniel McCloy <dan@mccloy.info>
Co-authored-by: Daniel McCloy <dan@mccloy.info>
Co-authored-by: Daniel McCloy <dan@mccloy.info>
Co-authored-by: Daniel McCloy <dan@mccloy.info>
Co-authored-by: Daniel McCloy <dan@mccloy.info>
Co-authored-by: Daniel McCloy <dan@mccloy.info>
@drammock
Copy link
Member

I'll cancel the Travis and Azure tests, we only need Circle CI for the last round of changes.

@larsoner
Copy link
Member

I'll cancel the Travis and Azure tests, we only need Circle CI for the last round of changes.

Azure style we'll still want, too

@drammock drammock merged commit 65b0c6e into mne-tools:master May 15, 2020
@drammock
Copy link
Member

thanks @adam2392 !

@adam2392 adam2392 deleted the ieegdata branch May 15, 2020 18:56
larsoner added a commit to larsoner/mne-python that referenced this pull request May 19, 2020
* upstream/master: (74 commits)
  FIX: Correct a bug in find_bads_eog (mne-tools#7797)
  [MRG] split_naming='bids' changes from _part-%d to _split-%d (mne-tools#7794)
  MRG, MAINT, DOC: Remove spyder (mne-tools#7796)
  MAINT: fixes for linkcheck (mne-tools#7762)
  [WIP] Update ieeg data example for ECoG (mne-tools#7768)
  fix examples/tutorials [circle full] (mne-tools#7786)
  MAINT: Clean up VTK and add to pre on Azure (mne-tools#7780)
  ENH: Add matplotlib animation support [skip travis] (mne-tools#7783)
  MRG, API: change out_type default in permutation_cluster_(1samp_)test (mne-tools#7781)
  DOC: docstring fixes (mne-tools#7777)
  MRG, ENH: Add tol_kind option (mne-tools#7736)
  MRG, DOC: Notes about info (mne-tools#7772)
  ENH: Speed up NIRx read without preload (mne-tools#7759)
  Minor plot_raw aes improvement (mne-tools#7770)
  MRG, FIX: Fixes for BEM contours (mne-tools#7763)
  MRG, STY: Fix E741 (mne-tools#7767)
  MRG, ENH - Plot optodes in plot_alignment for fNIRS channels (mne-tools#7747)
  FIX: Update NIH support [skip travis] (mne-tools#7766)
  MAINT: Bump tol for gamma map test (mne-tools#7764)
  MRG, FIX: Fix MRI orientations (mne-tools#7725)
  ...
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