Skip to content

Commit

Permalink
MRG: Seeg eeg seperated in butterfly plot epochs (mne-tools#6210)
Browse files Browse the repository at this point in the history
* butterfly plots for different channels work

still minor problems, see vertical scroll bar and display of units

* annotating units

Units and channels types are annotated in butterfly plot.

* updated whats_new.rst and docstring

* viewing order corrected

* solved bug regarding picks

* ordered the types list

* Minors

* Minor

* introducing scalings_default

* Added a list with default plotting orders to pick.py

* Adding order argument to epochs.py

* order argument works now

* order added to docstring

* Everything works except scaling

* Cleaning up

* Probably a solution to the scaling problem

* Making it more explicit

* Minor

* scaling problem solved

Scaling problem is solved, can be merged

* worked on revision

* revisions resolved

* minor Minor

* PEP8 conform

* Solved the problem regarding test_ica.py

* STY: Newline
  • Loading branch information
stfnrpplngr authored and larsoner committed Apr 26, 2019
1 parent b9dcbe1 commit bc94beb
Show file tree
Hide file tree
Showing 8 changed files with 168 additions and 181 deletions.
1 change: 1 addition & 0 deletions doc/whats_new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Current

Changelog
~~~~~~~~~
- Add ``butterfly`` and ``order`` arguments to :func:`mne.viz.plot_epochs` and offer separated traces for non-meg data (seeg, eeg, ecog) in butterfly view by `Stefan Repplinger`_ and `Eric Larson`_

- :func:`mne.simulation.simulate_stc` now allows for label overlaps by `Nathalie Gayraud`_, and `Ivana Kojcic`_

Expand Down
16 changes: 9 additions & 7 deletions mne/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@
ref_meg='steelblue', misc='k', stim='k', resp='k', chpi='k',
exci='k', ias='k', syst='k', seeg='saddlebrown', dipole='k',
gof='k', bio='k', ecog='k', hbo='darkblue', hbr='b'),
units=dict(eeg='uV', grad='fT/cm', mag='fT', eog='uV', misc='AU',
seeg='mV', dipole='nAm', gof='GOF', emg='uV', ecg='uV',
bio='uV', ecog='uV', hbo='uM', hbr='uM'),
units=dict(mag='fT', grad='fT/cm', eeg='uV', eog='uV', ecg='uV', emg='uV',
misc='AU', seeg='mV', dipole='nAm', gof='GOF', bio='uV',
ecog='uV', hbo='uM', hbr='uM'),
# scalings for the units
scalings=dict(mag=1e15, grad=1e13, eeg=1e6, eog=1e6, emg=1e6, ecg=1e6,
misc=1.0, seeg=1e3, dipole=1e9, gof=1.0, bio=1e6, ecog=1e6,
hbo=1e6, hbr=1e6),
# rough guess for a good plot
scalings_plot_raw=dict(mag=1e-12, grad=4e-11, eeg=20e-6, eog=150e-6,
ecg=5e-4, emg=1e-3, ref_meg=1e-12, misc=1e-3,
stim=1, resp=1, chpi=1e-4, exci=1, ias=1, syst=1,
Expand All @@ -28,10 +30,10 @@
misc=(-5., 5.), seeg=(-20., 20.), dipole=(-100., 100.),
gof=(0., 1.), bio=(-500., 500.), ecog=(-200., 200.), hbo=(0, 20),
hbr=(0, 20)),
titles=dict(eeg='EEG', grad='Gradiometers', mag='Magnetometers',
misc='misc', seeg='sEEG', dipole='Dipole', eog='EOG',
gof='Goodness of fit', ecg='ECG', emg='EMG', bio='BIO',
ecog='ECoG', hbo='Oxyhemoglobin', hbr='Deoxyhemoglobin'),
titles=dict(mag='Magnetometers', grad='Gradiometers', eeg='EEG', eog='EOG',
ecg='ECG', emg='EMG', misc='misc', seeg='sEEG', bio='BIO',
dipole='Dipole', ecog='ECoG', hbo='Oxyhemoglobin',
hbr='Deoxyhemoglobin', gof='Goodness of fit'),
mask_params=dict(marker='o',
markerfacecolor='w',
markeredgecolor='k',
Expand Down
10 changes: 6 additions & 4 deletions mne/epochs.py
Original file line number Diff line number Diff line change
Expand Up @@ -919,13 +919,15 @@ def ch_names(self):

@copy_function_doc_to_method_doc(plot_epochs)
def plot(self, picks=None, scalings=None, n_epochs=20, n_channels=20,
title=None, events=None, event_colors=None, show=True,
block=False, decim='auto', noise_cov=None):
title=None, events=None, event_colors=None, order=None,
show=True, block=False, decim='auto', noise_cov=None,
butterfly=False):
return plot_epochs(self, picks=picks, scalings=scalings,
n_epochs=n_epochs, n_channels=n_channels,
title=title, events=events,
event_colors=event_colors, show=show, block=block,
decim=decim, noise_cov=noise_cov)
event_colors=event_colors, order=order,
show=show, block=block, decim=decim,
noise_cov=noise_cov, butterfly=butterfly)

@copy_function_doc_to_method_doc(plot_epochs_psd)
def plot_psd(self, fmin=0, fmax=np.inf, tmin=None, tmax=None, proj=False,
Expand Down
4 changes: 4 additions & 0 deletions mne/io/pick.py
Original file line number Diff line number Diff line change
Expand Up @@ -847,6 +847,10 @@ def _check_excludes_includes(chs, info=None, allow_bads=False):
seeg=True, dipole=False, gof=False, bio=False, ecog=True, fnirs=True)
_PICK_TYPES_KEYS = tuple(list(_PICK_TYPES_DATA_DICT.keys()) + ['ref_meg'])
_DATA_CH_TYPES_SPLIT = ('mag', 'grad', 'eeg', 'seeg', 'ecog', 'hbo', 'hbr')
_DATA_CH_TYPES_ORDER_DEFAULT = ('mag', 'grad', 'eeg', 'eog', 'ecg', 'emg',
'reg_mag', 'misc', 'stim', 'resp', 'chpi',
'exci', 'ias', 'syst', 'seeg', 'bio', 'ecog',
'hbo', 'hbr', 'whitened')

# Valid data types, ordered for consistency, used in viz/evoked.
_VALID_CHANNEL_TYPES = ('eeg', 'grad', 'mag', 'seeg', 'eog', 'ecg', 'emg',
Expand Down
Loading

0 comments on commit bc94beb

Please sign in to comment.