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, MAINT: Lower memory again #8266

Merged
merged 2 commits into from
Sep 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version: 2
jobs:
build_docs:
docker:
- image: circleci/python:3.8.1-buster
- image: circleci/python:3.8.5-buster
steps:
- checkout
- run:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ doc/auto_examples/
doc/auto_tutorials/
doc/modules/generated/
doc/sphinxext/cachedir
tutorials/misc/report.h5
pip-log.txt
.coverage*
tags
Expand Down
2 changes: 1 addition & 1 deletion doc/carousel.inc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<div class="carousel-inner">

<div class="item active">
<div class="chopper container" style="background-image: url(_images/sphx_glr_plot_mne_dspm_source_localization_009.png)" title="dSPM">
<div class="chopper container" style="background-image: url(_images/sphx_glr_plot_mne_dspm_source_localization_008.png)" title="dSPM">
<div class="carousel-caption">
<h3>Source estimation</h3>
<p>Distributed, sparse, mixed-norm, beamformers, dipole fitting, and more.
Expand Down
31 changes: 14 additions & 17 deletions examples/forward/plot_left_cerebellum_volume_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,21 +50,18 @@
mne.viz.set_3d_view(fig, azimuth=173.78, elevation=101.75,
distance=0.30, focalpoint=(-0.03, -0.01, 0.03))

##############################################################################
# Compare volume source locations to segmentation file in freeview

# Export source positions to nift file
nii_fname = data_path + '/MEG/sample/mne_sample_lh-cerebellum-cortex.nii'

src.export_volume(nii_fname, mri_resolution=True)

# Uncomment the following lines to display source positions in freeview.
'''
# display image in freeview
from mne.utils import run_subprocess
mri_fname = subjects_dir + '/sample/mri/brain.mgz'
run_subprocess(['freeview', '-v', mri_fname, '-v',
'%s:colormap=lut:opacity=0.5' % aseg_fname, '-v',
'%s:colormap=jet:colorscale=0,2' % nii_fname, '-slice',
'157 75 105'])
'''
###############################################################################
# You can export source positions to a NIfTI file::
#
# >>> nii_fname = 'mne_sample_lh-cerebellum-cortex.nii'
# >>> src.export_volume(nii_fname, mri_resolution=True)
#
# And display source positions in freeview::
#
# >>> from mne.utils import run_subprocess
# >>> mri_fname = subjects_dir + '/sample/mri/brain.mgz'
# >>> run_subprocess(['freeview', '-v', mri_fname, '-v',
# '%s:colormap=lut:opacity=0.5' % aseg_fname, '-v',
# '%s:colormap=jet:colorscale=0,2' % nii_fname,
# '-slice', '157 75 105'])
3 changes: 3 additions & 0 deletions examples/inverse/plot_covariance_whitening_dspm.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
"""

.. _ex-covariance-whitening-dspm:

===================================================
Demonstrate impact of whitening on source estimates
===================================================
Expand Down
2 changes: 1 addition & 1 deletion examples/inverse/plot_custom_inverse_solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
noise_cov = mne.read_cov(cov_fname)
# Handling average file
evoked = mne.read_evokeds(ave_fname, condition=condition, baseline=(None, 0))
evoked.crop(tmin=0.04, tmax=0.18, verbose='error') # ignore baseline
evoked.crop(tmin=0.04, tmax=0.18)

evoked = evoked.pick_types(eeg=False, meg=True)
# Handling forward solution
Expand Down
2 changes: 1 addition & 1 deletion examples/inverse/plot_mixed_norm_inverse.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
# Handling average file
condition = 'Left Auditory'
evoked = mne.read_evokeds(ave_fname, condition=condition, baseline=(None, 0))
evoked.crop(tmin=0, tmax=0.3, verbose='error') # ignore baseline
evoked.crop(tmin=0, tmax=0.3)
# Handling forward solution
forward = mne.read_forward_solution(fwd_fname)

Expand Down
6 changes: 3 additions & 3 deletions examples/inverse/plot_multidict_reweighted_tfmxne.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
reject=reject, preload=True)
evoked = epochs.filter(1, None).average()
evoked = evoked.pick_types(meg=True)
evoked.crop(tmin=0.008, tmax=0.2, verbose='error') # ignore baseline
evoked.crop(tmin=0.008, tmax=0.2)

# Compute noise covariance matrix
cov = mne.compute_covariance(epochs, rank='info', tmax=0.)
Expand Down Expand Up @@ -85,8 +85,8 @@
# Crop to remove edges
for dip in dipoles:
dip.crop(tmin=-0.05, tmax=0.3)
evoked.crop(tmin=-0.05, tmax=0.3, verbose='error')
residual.crop(tmin=-0.05, tmax=0.3, verbose='error')
evoked.crop(tmin=-0.05, tmax=0.3)
residual.crop(tmin=-0.05, tmax=0.3)


###############################################################################
Expand Down
2 changes: 1 addition & 1 deletion examples/inverse/plot_rap_music.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
evoked = mne.read_evokeds(evoked_fname, condition=condition,
baseline=(None, 0))
# select N100
evoked.crop(tmin=0.05, tmax=0.15, verbose='error') # ignore baseline
evoked.crop(tmin=0.05, tmax=0.15)

evoked.pick_types(meg=True, eeg=False)

Expand Down
3 changes: 3 additions & 0 deletions examples/inverse/plot_vector_mne_solution.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
"""

.. _ex-vector-mne-solution:

============================================
Plotting the full vector-valued MNE solution
============================================
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
======================================

This example illustrates how to load all the EEG system montages
shipped in MNE-python, and display it on fsaverage template.
shipped in MNE-python, and display it on the fsaverage template subject.
""" # noqa: D205, D400
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Joan Massich <mailsik@gmail.com>
Expand Down
2 changes: 1 addition & 1 deletion examples/visualization/plot_make_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
# Load the evoked data
evoked = read_evokeds(evoked_fname, condition='Left Auditory',
baseline=(None, 0), verbose=False)
evoked.crop(0, .2, verbose='error') # ignore baseline
evoked.crop(0, .2)
times = evoked.times[::4]
# Create a list of figs for the slider
figs = list()
Expand Down
2 changes: 1 addition & 1 deletion mne/preprocessing/maxwell.py
Original file line number Diff line number Diff line change
Expand Up @@ -1609,8 +1609,8 @@ def _prep_fine_cal(info, fine_cal):
from ._fine_cal import read_fine_calibration
_validate_type(fine_cal, (dict, 'path-like'))
if not isinstance(fine_cal, dict):
fine_cal = read_fine_calibration(fine_cal)
extra = op.basename(str(fine_cal))
fine_cal = read_fine_calibration(fine_cal)
else:
extra = 'dict'
logger.info(f' Using fine calibration {extra}')
Expand Down
10 changes: 7 additions & 3 deletions mne/preprocessing/tests/test_maxwell.py
Original file line number Diff line number Diff line change
Expand Up @@ -643,9 +643,13 @@ def test_fine_calibration():

# Test 1D SSS fine calibration
with use_coil_def(elekta_def_fname):
raw_sss = maxwell_filter(raw, calibration=fine_cal_fname,
origin=mf_head_origin, regularize=None,
bad_condition='ignore')
with catch_logging() as log:
raw_sss = maxwell_filter(raw, calibration=fine_cal_fname,
origin=mf_head_origin, regularize=None,
bad_condition='ignore', verbose=True)
log = log.getvalue()
assert 'Using fine calibration' in log
assert op.basename(fine_cal_fname) in log
assert_meg_snr(raw_sss, sss_fine_cal, 82, 611)
py_cal = raw_sss.info['proc_history'][0]['max_info']['sss_cal']
assert (py_cal is not None)
Expand Down
3 changes: 1 addition & 2 deletions tutorials/intro/plot_40_sensor_locations.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,7 @@
# keywords like ``'head'``, ``'outer_skull'``, or ``'brain'`` to the
# ``surfaces`` parameter) making it useful for :ref:`assessing coordinate frame
# transformations <plot_source_alignment>`. For examples of various uses of
# :func:`~mne.viz.plot_alignment`, see
# :doc:`../../auto_examples/visualization/plot_montage`,
# :func:`~mne.viz.plot_alignment`, see :ref:`plot_montage`,
# :doc:`../../auto_examples/visualization/plot_eeg_on_scalp`, and
# :doc:`../../auto_examples/visualization/plot_meg_sensors`.
#
Expand Down
20 changes: 10 additions & 10 deletions tutorials/misc/plot_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
path = mne.datasets.sample.data_path(verbose=False)
report = mne.Report(verbose=True)
report.parse_folder(path, pattern='*raw.fif', render_bem=False)
report.save('report_basic.html')
report.save('report_basic.html', overwrite=True)

###############################################################################
# This report yields a textual summary of the :class:`~mne.io.Raw` files
Expand All @@ -85,7 +85,7 @@
pattern = 'sample_audvis_filt-0-40_raw.fif'
report = mne.Report(raw_psd=True, projs=True, verbose=True)
report.parse_folder(path, pattern=pattern, render_bem=False)
report.save('report_raw_psd.html')
report.save('report_raw_psd.html', overwrite=True)

###############################################################################
# The sample dataset also contains SSP projectors stored as *individual files*.
Expand All @@ -98,7 +98,7 @@
pattern = 'sample_audvis_*proj.fif'
report = mne.Report(info_fname=info_fname, verbose=True)
report.parse_folder(path, pattern=pattern, render_bem=False)
report.save('report_proj.html')
report.save('report_proj.html', overwrite=True)

###############################################################################
# This time we'll pass a specific ``subject`` and ``subjects_dir`` (even though
Expand All @@ -111,7 +111,7 @@
subjects_dir = os.path.join(path, 'subjects')
report = mne.Report(subject='sample', subjects_dir=subjects_dir, verbose=True)
report.parse_folder(path, pattern='', mri_decim=25)
report.save('report_mri_bem.html')
report.save('report_mri_bem.html', overwrite=True)

###############################################################################
# Now let's look at how :class:`~mne.Report` handles :class:`~mne.Evoked` data
Expand All @@ -122,7 +122,7 @@
pattern = 'sample_audvis-no-filter-ave.fif'
report = mne.Report(verbose=True)
report.parse_folder(path, pattern=pattern, render_bem=False)
report.save('report_evoked.html')
report.save('report_evoked.html', overwrite=True)

###############################################################################
# You have probably noticed that the EEG recordings look particularly odd. This
Expand All @@ -142,7 +142,7 @@
pattern = 'sample_audvis-no-filter-ave.fif'
report = mne.Report(baseline=baseline, verbose=True)
report.parse_folder(path, pattern=pattern, render_bem=False)
report.save('report_evoked_baseline.html')
report.save('report_evoked_baseline.html', overwrite=True)

###############################################################################
# To render whitened :class:`~mne.Evoked` files with baseline correction, pass
Expand All @@ -154,7 +154,7 @@
baseline = (None, 0)
report = mne.Report(cov_fname=cov_fname, baseline=baseline, verbose=True)
report.parse_folder(path, pattern=pattern, render_bem=False)
report.save('report_evoked_whitened.html')
report.save('report_evoked_whitened.html', overwrite=True)

###############################################################################
# If you want to actually *view* the noise covariance in the report, make sure
Expand All @@ -168,7 +168,7 @@
info_fname = os.path.join(path, 'MEG', 'sample', 'sample_audvis-ave.fif')
report = mne.Report(info_fname=info_fname, verbose=True)
report.parse_folder(path, pattern=pattern, render_bem=False)
report.save('report_cov.html')
report.save('report_cov.html', overwrite=True)

###############################################################################
# Adding custom plots to a report
Expand All @@ -188,7 +188,7 @@

# add the custom plot to the report:
report.add_figs_to_section(fig, captions='Left Auditory', section='evoked')
report.save('report_custom.html')
report.save('report_custom.html', overwrite=True)

###############################################################################
# Managing report sections
Expand Down Expand Up @@ -231,7 +231,7 @@
captions='Left Auditory',
section='evoked',
replace=True)
report.save('report_final.html')
report.save('report_final.html', overwrite=True)

###############################################################################
# With the context manager, the updated report is also automatically saved
Expand Down
4 changes: 2 additions & 2 deletions tutorials/source-modeling/plot_beamformer_lcmv.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@
baseline=(None, 0), preload=True, proj=proj,
reject=dict(grad=4000e-13, mag=4e-12, eog=150e-6))

# for speed purposes, cut to a window of interest (ignore baseline, etc.)
evoked = epochs.average().crop(0.05, 0.15, verbose='error')
# for speed purposes, cut to a window of interest
evoked = epochs.average().crop(0.05, 0.15)

# Visualize averaged sensor space data
evoked.plot_joint()
Expand Down
3 changes: 2 additions & 1 deletion tutorials/source-modeling/plot_compute_covariance.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,8 @@

##############################################################################
# Based on the negative log-likelihood, the baseline covariance
# seems more appropriate.
# seems more appropriate. See :ref:`ex-covariance-whitening-dspm` for more
# information.

###############################################################################
# References
Expand Down
2 changes: 1 addition & 1 deletion tutorials/source-modeling/plot_dipole_fit.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
baseline=(None, 0))
evoked.pick_types(meg=True, eeg=False)
evoked_full = evoked.copy()
evoked.crop(0.07, 0.08, verbose='error') # ignore baseline
evoked.crop(0.07, 0.08)

# Fit a dipole
dip = mne.fit_dipole(evoked, fname_cov, fname_bem, fname_trans)[0]
Expand Down
2 changes: 1 addition & 1 deletion tutorials/source-modeling/plot_forward.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@
# parameter.

fwd = mne.make_forward_solution(raw_fname, trans=trans, src=src, bem=bem,
meg=True, eeg=False, mindist=5.0, n_jobs=2,
meg=True, eeg=False, mindist=5.0, n_jobs=1,
verbose=True)
print(fwd)

Expand Down
Loading