Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
ac7eae3
Pull in changes from old PR
hoechenberger Sep 16, 2021
e6d1d6b
Merge branch 'main' of https://github.com/mne-tools/mne-python into r…
hoechenberger Sep 17, 2021
0658f29
[MRG, BUG] Fixed bug with EDF channel types and minor bug where other…
adam2392 Sep 15, 2021
6c5f049
Remove _BEM_VIEWS from __init__.py
hoechenberger Sep 17, 2021
9c236d9
Add back cropped MNE logo
hoechenberger Sep 17, 2021
7785ffd
Change default of raw_psd back to False again
hoechenberger Sep 17, 2021
7e09555
Remove old JS libraries
hoechenberger Sep 17, 2021
e967137
FIX _repr_html_ of Info add all channel types (#9725)
vagechirkov Sep 16, 2021
1b7cc18
Don't call tight_layout() on figs passed to _fig_to_img()
hoechenberger Sep 17, 2021
6f3c4cd
Reduce verbosity related to prjector handling
hoechenberger Sep 23, 2021
a918003
Don't produce empty drop figure if no epochs were dropped
hoechenberger Sep 23, 2021
0a1f725
Don't add legend to GFP plots
hoechenberger Sep 23, 2021
284a2ea
use viz.utils.tight_layout()
hoechenberger Sep 23, 2021
20de178
More tight_layout()
hoechenberger Sep 23, 2021
73c037d
Fix warnings
hoechenberger Sep 23, 2021
35d24c6
Finally tight_layout() issues 🙈
hoechenberger Sep 24, 2021
0d07801
Add back time zone test
hoechenberger Sep 24, 2021
e6f3af3
Deprecation handling
hoechenberger Sep 24, 2021
21276ee
Better deprecation testing
hoechenberger Sep 24, 2021
a1113d6
ALMOST finish work on tutorial
hoechenberger Sep 25, 2021
3c94403
Disable carousel buttons
hoechenberger Sep 27, 2021
e1ed295
Finalize tutorial
hoechenberger Sep 27, 2021
58a30b4
Maximize main content column width
hoechenberger Sep 27, 2021
202e092
Allow more than 1 BEM sliders in a row
hoechenberger Sep 27, 2021
fe4ebe2
Apply changes discussed with Alex
hoechenberger Sep 27, 2021
1006f31
flake
hoechenberger Sep 28, 2021
659d040
Merge branch 'main' of https://github.com/mne-tools/mne-python into r…
hoechenberger Sep 28, 2021
5d05cef
Add options to decimate time points in STC and Evoked plots
hoechenberger Sep 28, 2021
e701166
Add time decimation params to parse_folder()
hoechenberger Sep 28, 2021
efa653b
Try to speed up tutorial rendering
hoechenberger Sep 28, 2021
7e5fce9
Allow further decimation, render STCs in parse_folder()
hoechenberger Sep 28, 2021
0832571
Style and further speedups
hoechenberger Sep 28, 2021
640a1a8
Even more speeeedd 🚗💨💨
hoechenberger Sep 28, 2021
b86289a
flake
hoechenberger Sep 28, 2021
303e2ca
Apply suggestions from code review [ci skip]
hoechenberger Sep 28, 2021
8519ade
Fix reference
hoechenberger Sep 28, 2021
b6eac3e
Reduce processing time
hoechenberger Sep 29, 2021
d9dad86
Further reduce tutorial runtime [skip azp][skip actions]
hoechenberger Sep 29, 2021
982b968
Explain butterfly param
hoechenberger Sep 29, 2021
fcec676
Avoid "deprecated" decorator
hoechenberger Sep 29, 2021
7494488
Merge branch 'main' of https://github.com/mne-tools/mne-python into r…
hoechenberger Sep 29, 2021
6c47f54
Re-enable add_sys_info test
hoechenberger Sep 29, 2021
c03f75e
Don't show STC traces, fix layout
hoechenberger Sep 29, 2021
1779238
Remove some cruft
hoechenberger Sep 29, 2021
926fbd4
Add changelog entries
hoechenberger Sep 29, 2021
e06de1d
Remove duplicate line in changelog [ci skip]
hoechenberger Sep 29, 2021
ff62cee
A few tiny layout tweaks
hoechenberger Sep 29, 2021
6d8f9ac
Hack around issue between deprecated decorator and numpydoc
hoechenberger Sep 30, 2021
987fadd
Better Note for add_code
hoechenberger Sep 30, 2021
da4a8c9
Revert "Hack around issue between deprecated decorator and numpydoc"
larsoner Sep 30, 2021
e630b34
ENH: Better decorator
larsoner Sep 30, 2021
bc53daa
BUG: Dont force tight_layout
larsoner Sep 30, 2021
cccf2ed
Merge remote-tracking branch 'upstream/main' into report2
larsoner Sep 30, 2021
b818289
DOC: Better linking
larsoner Sep 30, 2021
16ff11f
FIX: Ori labels
larsoner Sep 30, 2021
37debfe
STY: Flake
larsoner Sep 30, 2021
81c2b76
FIX: Missed one
larsoner Sep 30, 2021
297948c
TST: "Fix" doctest
larsoner Sep 30, 2021
b32399a
FIX: One more
larsoner Sep 30, 2021
33f8ab8
Use docdict for some more subject and subjects_dir params
hoechenberger Sep 30, 2021
907f96d
Merge branch 'report2' of https://github.com/hoechenberger/mne-python…
hoechenberger Sep 30, 2021
fa9993e
Explain slices=None and reformat code for readability
hoechenberger Sep 30, 2021
dab171b
Correct STC subject docstrings
hoechenberger Sep 30, 2021
bba68f6
Fix: plot_bem() requires subject param
hoechenberger Sep 30, 2021
0b55a9e
Remove whitespace
hoechenberger Sep 30, 2021
0a49b52
Properly encode titles and TOC entries
hoechenberger Oct 4, 2021
eff0d96
Center SVGs, fix horizontal scrolling issue
hoechenberger Oct 4, 2021
adc2b20
Add fill_doc decorator to plot_bem()
hoechenberger Oct 4, 2021
7dc2dc5
Merge branch 'main' of https://github.com/mne-tools/mne-python into r…
hoechenberger Oct 4, 2021
de7c9b1
Fix tests
hoechenberger Oct 4, 2021
b3136ec
Merge branch 'main' of https://github.com/mne-tools/mne-python into r…
hoechenberger Oct 5, 2021
c625b7c
ENH: Speed up test
larsoner Oct 5, 2021
1cc8b1e
Merge branch 'main' of https://github.com/mne-tools/mne-python into r…
hoechenberger Oct 5, 2021
7809b3e
Speed up evoked rendering in test
hoechenberger Oct 5, 2021
2f30351
MAINT: Speed up tests
larsoner Oct 6, 2021
d4a32b8
FIX: Also mayavi
larsoner Oct 7, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions doc/changes/latest.inc
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,10 @@ Enhancements

- Add full ECoG dataset to MNE-misc-data and demonstrate its use in :ref:`ex-electrode-pos-2d` and :ref:`tut-ieeg-localize` (:gh:`9784` by `Alex Rockhill`_)

- Completely revamp the `~mne.Report` experience: new HTML layout, many new methods, more flexibility; the functionality is demonstrated in :ref:`tut-report` (:gh:`9754` by `Richard Höchenberger`_, `Eric Larson`_, and `Alex Gramfort`_)

- Add basic HTML representations of `~mne.Forward` and `~mne.minimum_norm.InverseOperator` instances for a nicer Jupyter experience (:gh:`9754` by `Richard Höchenberger`_)

- `mne.io.read_raw_brainvision` now handles ASCII data with comma-separated values, as may be exported from BrainVision Analyzer (:gh:`9795` by `Richard Höchenberger`_)

- Add :func:`mne.preprocessing.ieeg.project_sensors_onto_brain` to project ECoG sensors onto the pial surface to compensate for brain shift (:gh:`9800` by `Alex Rockhill`_)
Expand Down Expand Up @@ -265,6 +269,10 @@ Bugs

- Fix bug where `mne.Annotations` were not appending channel names when being added together (:gh:`9780` by `Adam Li`_)

- `mne.viz.plot_evoked_joint` now correctly handles a ``times='peaks'`` parameter value (:gh:`9754` by `Richard Höchenberger`_)

- In `mne.viz.plot_compare_evokeds`, slightly adjust the x-axis limit calculation to avoid drawing an axis that is too short (:gh:`9754` by `Richard Höchenberger`_)

API changes
~~~~~~~~~~~
- In `mne.compute_source_morph`, the ``niter_affine`` and ``niter_sdr`` parameters have been replaced by ``niter`` and ``pipeline`` parameters for more consistent and finer-grained control of registration/warping steps and iteration (:gh:`9505` by `Alex Rockhill`_ and `Eric Larson`_)
Expand All @@ -277,4 +285,22 @@ API changes

- :func:`mne.inverse_sparse.mixed_norm` now simply warns when source estimates contain no dipole, e.g. if data are too noisy and alpha is based on SURE (:gh:`9685` by `Alex Gramfort`_)

- :class:`mne.Report` modernization has led to multiple deprecations (:gh:`9754` by `Richard Höchenberger`_):

- :meth:`mne.Report.add_figs_to_section` and :meth:`mne.Report.add_slider_to_section` have been deprecated in favor of :meth:`mne.Report.add_figure`

- :meth:`mne.Report.add_images_to_section` has been deprecated in favor of :meth:`mne.Report.add_image`

- :meth:`mne.Report.add_bem_to_section` has been deprecated in favor of :meth:`mne.Report.add_bem`

- :meth:`mne.Report.add_htmls_to_section` has been deprecated in favor of :meth:`mne.Report.add_html`

- In :meth:`mne.Report.parse_folder`, the ``sort_sections`` parameter has been deprecated in favor of ``sort_content``

- In :meth:`mne.Report.remove`, the ``caption`` and ``section`` parameters have been deprecated in favor of ``title`` and ``tags``, respectively

- The ``mne.Report.sections`` attribute has been deprecated in favor of ``mne.Report.tags``

- The ``mne.Report.fnames`` attribute has been deprecated without replacement

- The output folder name for HF_SEF datasets is now ``hf_sef`` instead of ``HF_SEF`` (:gh:`9763` by `Adam Li`_)
10 changes: 7 additions & 3 deletions mne/channels/channels.py
Original file line number Diff line number Diff line change
Expand Up @@ -819,8 +819,8 @@ def pick_channels(self, ch_names, ordered=False):
picks = pick_channels(self.info['ch_names'], ch_names, ordered=ordered)
return self._pick_drop_channels(picks)

@fill_doc
def pick(self, picks, exclude=()):
@verbose
def pick(self, picks, exclude=(), *, verbose=None):
"""Pick a subset of channels.

Parameters
Expand All @@ -829,6 +829,9 @@ def pick(self, picks, exclude=()):
exclude : list | str
Set of channels to exclude, only used when picking based on
types (e.g., exclude="bads" when picks="meg").
%(verbose)s

.. versionadded:: 0.24.0

Returns
-------
Expand Down Expand Up @@ -920,7 +923,8 @@ def drop_channels(self, ch_names):
idx = np.setdiff1d(np.arange(len(self.ch_names)), bad_idx)
return self._pick_drop_channels(idx)

def _pick_drop_channels(self, idx):
@verbose
def _pick_drop_channels(self, idx, *, verbose=None):
# avoid circular imports
from ..io import BaseRaw
from ..time_frequency import AverageTFR, EpochsTFR
Expand Down
42 changes: 40 additions & 2 deletions mne/data/html_templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


info_template = Template("""
<table class="table table-hover">
<table class="table table-hover table-striped table-sm table-responsive small">
<tr>
<th>Measurement date</th>
{{if meas_date is not None}}
Expand Down Expand Up @@ -82,7 +82,7 @@
""")

epochs_template = Template("""
<table class="table table-hover">
<table class="table table-hover table-striped table-sm table-responsive small">
<tr>
<th>Number of events</th>
<td>{{len(epochs.events)}}</td>
Expand All @@ -105,3 +105,41 @@
</tr>
</table>
""")

forward_template = Template("""
<table class="table table-hover table-striped table-sm table-responsive small">
<tr>
<th>Good channels</th>
<td>{{good_channels}}</td>
</tr>
<tr>
<th>Bad channels</th>
<td>{{bad_channels}}</td>
</tr>
<tr>
<th>Source space</th>
<td>{{source_space_descr}}</td>
</tr>
<tr>
<th>Source orientation</th>
<td>{{source_orientation}}</td>
</tr>
</table>
""")

inverse_operator_template = Template("""
<table class="table table-hover table-striped table-sm table-responsive small">
<tr>
<th>Channels</th>
<td>{{channels}}</td>
</tr>
<tr>
<th>Source space</th>
<td>{{source_space_descr}}</td>
</tr>
<tr>
<th>Source orientation</th>
<td>{{source_orientation}}</td>
</tr>
</table>
""")
10 changes: 10 additions & 0 deletions mne/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,16 @@
58, # Right-Accumbens-area

60, # Right-VentralDC
),
report_stc_plot_kwargs=dict(
views=('lateral', 'medial'),
hemi='split',
backend='pyvistaqt',
time_viewer=False,
show_traces=False,
size=(450, 450),
background='white',
time_label=None
)
)

Expand Down
1 change: 1 addition & 0 deletions mne/evoked.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ def __init__(self, fname, condition=None, proj=True,
# project and baseline correct
if proj:
self.apply_proj()
self.filename = fname

@property
def kind(self):
Expand Down
38 changes: 35 additions & 3 deletions mne/fixes.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
# Lars Buitinck <L.J.Buitinck@uva.nl>
# License: BSD

from distutils.version import LooseVersion
import functools
import inspect
from math import log
Expand All @@ -23,6 +22,39 @@
import numpy as np


###############################################################################
# distutils

# distutils has been deprecated since Python 3.10 and is scheduled for removal
# from the standard library with the release of Python 3.12. For version
# comparisons, we use setuptools's `parse_version` if available.

def _compare_version(version_a, operator, version_b):
"""Compare two version strings via a user-specified operator.

Parameters
----------
version_a : str
First version string.
operator : '==' | '>' | '<' | '>=' | '<='
Operator to compare ``version_a`` and ``version_b`` in the form of
``version_a operator version_b``.
version_b : str
Second version string.

Returns
-------
bool
The result of the version comparison.
"""
try:
from pkg_resources import parse_version as parse
except ImportError:
from distutils.version import LooseVersion as parse

return eval(f'parse("{version_a}") {operator} parse("{version_b}")')


###############################################################################
# Misc

Expand Down Expand Up @@ -928,7 +960,7 @@ def _crop_colorbar(cbar, cbar_vmin, cbar_vmax):
# _outline was removed in
# https://github.com/matplotlib/matplotlib/commit/03a542e875eba091a027046d5ec652daa8be6863
# so we use the code from there
if LooseVersion(matplotlib.__version__) >= LooseVersion("3.2.0"):
if _compare_version(matplotlib.__version__, '>=', '3.2.0'):
cbar.ax.set_ylim(cbar_vmin, cbar_vmax)
X = cbar._mesh()[0]
X = np.array([X[0], X[-1]])
Expand Down Expand Up @@ -959,7 +991,7 @@ def _crop_colorbar(cbar, cbar_vmin, cbar_vmax):
# Here we choose different defaults to speed things up by default
try:
import numba
if LooseVersion(numba.__version__) < LooseVersion('0.40'):
if _compare_version(numba.__version__, '<', '0.40'):
raise ImportError
prange = numba.prange
def jit(nopython=True, nogil=True, fastmath=True, cache=True,
Expand Down
56 changes: 36 additions & 20 deletions mne/forward/forward.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
_validate_type, _check_compensation_grade, _check_option,
_check_stc_units, _stamp_to_dt, _on_missing)
from ..label import Label
from ..data.html_templates import forward_template


class Forward(dict):
Expand All @@ -66,25 +67,15 @@ def copy(self):
"""Copy the Forward instance."""
return Forward(deepcopy(self))

def __repr__(self):
"""Summarize forward info instead of printing all."""
entr = '<Forward'

nchan = len(pick_types(self['info'], meg=True, eeg=False, exclude=[]))
entr += ' | ' + 'MEG channels: %d' % nchan
nchan = len(pick_types(self['info'], meg=False, eeg=True, exclude=[]))
entr += ' | ' + 'EEG channels: %d' % nchan

def _get_src_type_and_ori_for_repr(self):
src_types = np.array([src['type'] for src in self['src']])

if (src_types == 'surf').all():
entr += (' | Source space: Surface with %d vertices'
% self['nsource'])
src_type = 'Surface with %d vertices' % self['nsource']
elif (src_types == 'vol').all():
entr += (' | Source space: Volume with %d grid points'
% self['nsource'])
src_type = 'Volume with %d grid points' % self['nsource']
elif (src_types == 'discrete').all():
entr += (' | Source space: Discrete with %d dipoles'
% self['nsource'])
src_type = 'Discrete with %d dipoles' % self['nsource']
else:
count_string = ''
if (src_types == 'surf').any():
Expand All @@ -95,20 +86,45 @@ def __repr__(self):
count_string += '%d discrete, ' \
% (src_types == 'discrete').sum()
count_string = count_string.rstrip(', ')
entr += (' | Source space: Mixed (%s) with %d vertices'
% (count_string, self['nsource']))
src_type = ('Mixed (%s) with %d vertices'
% (count_string, self['nsource']))

if self['source_ori'] == FIFF.FIFFV_MNE_UNKNOWN_ORI:
entr += (' | Source orientation: Unknown')
src_ori = 'Unknown'
elif self['source_ori'] == FIFF.FIFFV_MNE_FIXED_ORI:
entr += (' | Source orientation: Fixed')
src_ori = 'Fixed'
elif self['source_ori'] == FIFF.FIFFV_MNE_FREE_ORI:
entr += (' | Source orientation: Free')
src_ori = 'Free'

return src_type, src_ori

def __repr__(self):
"""Summarize forward info instead of printing all."""
entr = '<Forward'

nchan = len(pick_types(self['info'], meg=True, eeg=False, exclude=[]))
entr += ' | ' + 'MEG channels: %d' % nchan
nchan = len(pick_types(self['info'], meg=False, eeg=True, exclude=[]))
entr += ' | ' + 'EEG channels: %d' % nchan

src_type, src_ori = self._get_src_type_and_ori_for_repr()
entr += f' | Source space: {src_type}'
entr += f' | Source orientation: {src_ori}'
entr += '>'

return entr

def _repr_html_(self):
good_chs, bad_chs, _, _, = self['info']._get_chs_for_repr()
src_descr, src_ori = self._get_src_type_and_ori_for_repr()
html = forward_template.substitute(
good_channels=good_chs,
bad_channels=bad_chs,
source_space_descr=src_descr,
source_orientation=src_ori
)
return html

@property
def ch_names(self):
return self['info']['ch_names']
Expand Down
7 changes: 0 additions & 7 deletions mne/html/bootstrap.min.css

This file was deleted.

7 changes: 0 additions & 7 deletions mne/html/bootstrap.min.js

This file was deleted.

6 changes: 0 additions & 6 deletions mne/html/jquery-ui.min.css

This file was deleted.

12 changes: 0 additions & 12 deletions mne/html/jquery-ui.min.js

This file was deleted.

6 changes: 0 additions & 6 deletions mne/html/jquery.js

This file was deleted.

Binary file added mne/icons/mne_icon-cropped.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 0 additions & 16 deletions mne/inverse_sparse/mxne_optim.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,22 +73,6 @@ def prox_l21(Y, alpha, n_orient, shape=None, is_stft=False):
The output data.
active_set : array of bool, shape (n_sources, )
Mask of active sources

Examples
--------
>>> Y = np.tile(np.array([0, 4, 3, 0, 0], dtype=np.float64), (2, 1))
>>> Y = np.r_[Y, np.zeros_like(Y)]
>>> print(Y) # doctest:+SKIP
[[ 0. 4. 3. 0. 0.]
[ 0. 4. 3. 0. 0.]
[ 0. 0. 0. 0. 0.]
[ 0. 0. 0. 0. 0.]]
>>> Yp, active_set = prox_l21(Y, 2, 2)
>>> print(Yp) # doctest:+SKIP
[[0. 2.86862915 2.15147186 0. 0. ]
[0. 2.86862915 2.15147186 0. 0. ]]
>>> print(active_set)
[ True True False False]
"""
if len(Y) == 0:
return np.zeros_like(Y), np.zeros((0,), dtype=bool)
Expand Down
18 changes: 12 additions & 6 deletions mne/io/meas_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -818,13 +818,8 @@ def pick_channels(self, ch_names, ordered=False):
def ch_names(self):
return self['ch_names']

def _repr_html_(self, caption=None):
"""Summarize info for HTML representation."""
def _get_chs_for_repr(self):
titles = _handle_default('titles')
if isinstance(caption, str):
html = f'<h4>{caption}</h4>'
else:
html = ''

# good channels
channels = {}
Expand Down Expand Up @@ -858,6 +853,17 @@ def _repr_html_(self, caption=None):
else:
bad_channels = 'None'

return good_channels, bad_channels, ecg, eog

def _repr_html_(self, caption=None):
"""Summarize info for HTML representation."""
if isinstance(caption, str):
html = f'<h4>{caption}</h4>'
else:
html = ''

good_channels, bad_channels, ecg, eog = self._get_chs_for_repr()

# meas date
meas_date = self['meas_date']
if meas_date is not None:
Expand Down
Loading