Python API Reference

This is the reference for classes (CamelCase names) and functions (underscore_case names) of MNE-Python, grouped thematically by analysis stage. Functions and classes that are not below a module heading are found in the mne namespace.

MNE-Python also provides multiple command-line scripts that can be called directly from a terminal, see Command line tools using Python.

mne:

MNE software for MEG and EEG data analysis.

Most-used classes

io.Raw(fname[, allow_maxshield, preload, …])

Raw data in FIF format.

Epochs(raw, events[, event_id, tmin, tmax, …])

Epochs extracted from a Raw instance.

Evoked(fname[, condition, proj, kind, …])

Evoked data.

Info

Measurement information.

Reading raw data

mne.io:

IO module for reading raw data.

anonymize_info(info)

Anonymize measurement information in place.

find_edf_events(\*args, \*\*kwargs)

Warning

DEPRECATED: find_edf_events is deprecated in 0.18, and will be removed in 0.19. Please use mne.events_from_annotations instead

read_raw_artemis123(input_fname[, preload, …])

Read Artemis123 data as raw object.

read_raw_bti(pdf_fname[, config_fname, …])

Raw object from 4D Neuroimaging MagnesWH3600 data.

read_raw_cnt(input_fname[, montage, eog, …])

Read CNT data as raw object.

read_raw_ctf(directory[, system_clock, …])

Raw object from CTF directory.

read_raw_curry(fname[, preload, verbose])

Read raw data from Curry files.

read_raw_edf(input_fname[, montage, eog, …])

Reader function for EDF or EDF+ files.

read_raw_bdf(input_fname[, montage, eog, …])

Reader function for BDF files.

read_raw_gdf(input_fname[, montage, eog, …])

Reader function for GDF files.

read_raw_kit(input_fname[, mrk, elp, hsp, …])

Reader function for KIT conversion to FIF.

read_raw_nicolet(input_fname, ch_type[, …])

Read Nicolet data as raw object.

read_raw_eeglab(input_fname[, montage, eog, …])

Read an EEGLAB .set file.

read_raw_brainvision(vhdr_fname[, montage, …])

Reader for Brain Vision EEG file.

read_raw_egi(input_fname[, montage, eog, …])

Read EGI simple binary as raw object.

read_raw_fif(fname[, allow_maxshield, …])

Reader function for Raw FIF data.

read_raw_eximia(fname[, preload, verbose])

Reader for an eXimia EEG file.

read_raw_fieldtrip(fname, info[, data_name])

Load continuous (raw) data from a FieldTrip preprocessing structure.

Base class:

BaseRaw(info[, preload, first_samps, …])

Base class for Raw data.

mne.io.kit:

KIT module for reading raw data.

read_mrk(fname)

Marker Point Extraction in MEG space directly from sqd.

File I/O

decimate_surface(points, triangles, n_triangles)

Decimate surface data.

channel_type(info, idx)

Get channel type.

channel_indices_by_type(info[, picks])

Get indices of channels by type.

get_head_surf(subject[, source, …])

Load the subject head surface.

get_meg_helmet_surf(info[, trans, verbose])

Load the MEG helmet associated with the MEG sensors.

get_volume_labels_from_aseg(mgz_fname[, …])

Return a list of names and colors of segmented volumes.

get_volume_labels_from_src(src, subject, …)

Return a list of Label of segmented volumes included in the src space.

parse_config(fname)

Parse a config file (like .ave and .cov files).

read_labels_from_annot(subject[, parc, …])

Read labels from a FreeSurfer annotation file.

read_bem_solution(fname[, verbose])

Read the BEM solution from a file.

read_bem_surfaces(fname[, patch_stats, …])

Read the BEM surfaces from a FIF file.

read_cov(fname[, verbose])

Read a noise covariance from a FIF file.

read_dipole(fname[, verbose])

Read .dip file from Neuromag/xfit or MNE.

read_epochs(fname[, proj, preload, verbose])

Read epochs from a fif file.

read_epochs_kit(input_fname, events[, …])

Reader function for KIT epochs files.

read_epochs_eeglab(input_fname[, events, …])

Reader function for EEGLAB epochs files.

read_epochs_fieldtrip(fname, info[, …])

Load epoched data from a FieldTrip preprocessing structure.

read_events(filename[, include, exclude, …])

Read events from fif or text file.

read_evokeds(fname[, condition, baseline, …])

Read evoked dataset(s).

read_evoked_fieldtrip(fname, info[, …])

Load evoked data from a FieldTrip timelocked structure.

read_forward_solution(fname[, include, …])

Read a forward solution a.k.a.

read_label(filename[, subject, color])

Read FreeSurfer Label file.

read_morph_map(subject_from, subject_to[, …])

Read morph map.

read_proj(fname)

Read projections from a FIF file.

read_reject_parameters(fname)

Read rejection parameters from .cov or .ave config file.

read_selection(name[, fname, info, verbose])

Read channel selection from file.

read_source_estimate(fname[, subject])

Read a source estimate object.

read_source_spaces(fname[, patch_stats, verbose])

Read the source spaces from a FIF file.

read_surface(fname[, read_metadata, …])

Load a Freesurfer surface mesh in triangular format.

read_trans(fname[, return_all])

Read a -trans.fif file.

read_tri(fname_in[, swap, verbose])

Read triangle definitions from an ascii file.

write_labels_to_annot(labels[, subject, …])

Create a FreeSurfer annotation from a list of labels.

write_bem_solution(fname, bem)

Write a BEM model with solution.

write_bem_surfaces(fname, surfs)

Write BEM surfaces to a fiff file.

write_cov(fname, cov)

Write a noise covariance matrix.

write_events(filename, event_list)

Write events to file.

write_evokeds(fname, evoked)

Write an evoked dataset to a file.

write_forward_solution(fname, fwd[, …])

Write forward solution to a file.

write_label(filename, label[, verbose])

Write a FreeSurfer label.

write_proj(fname, projs)

Write projections to a FIF file.

write_source_spaces(fname, src[, overwrite, …])

Write source spaces to a file.

write_surface(fname, coords, faces[, …])

Write a triangular Freesurfer surface mesh.

write_trans(fname, trans)

Write a -trans.fif file.

io.read_info(fname[, verbose])

Read measurement info from a file.

io.show_fiff(fname[, indent, read_limit, …])

Show FIFF information.

digitization.DigPoint

Container for a digitization point.

digitization.Digitization([elements])

Represent a list of DigPoint objects.

Base class:

BaseEpochs(info, data, events[, event_id, …])

Abstract base class for Epochs-type classes.

Creating data objects from arrays

EvokedArray(data, info[, tmin, comment, …])

Evoked object from numpy array.

EpochsArray(data, info[, events, tmin, …])

Epochs object from numpy array.

io.RawArray(data, info[, first_samp, copy, …])

Raw object from numpy array.

create_info(ch_names, sfreq[, ch_types, …])

Create a basic Info instance suitable for use with create_raw.

Datasets

mne.datasets:

Functions for fetching remote datasets.

See datasets for more information.

brainstorm.bst_auditory.data_path([path, …])

Get path to local copy of brainstorm (bst_auditory) dataset.

brainstorm.bst_resting.data_path([path, …])

Get path to local copy of brainstorm (bst_resting) dataset.

brainstorm.bst_raw.data_path([path, …])

Get path to local copy of brainstorm (bst_raw) dataset.

eegbci.load_data(subject, runs[, path, …])

Get paths to local copies of EEGBCI dataset files.

fetch_aparc_sub_parcellation([subjects_dir, …])

Fetch the modified subdivided aparc parcellation.

fetch_fsaverage([subjects_dir, verbose])

Fetch and update fsaverage.

fetch_hcp_mmp_parcellation([subjects_dir, …])

Fetch the HCP-MMP parcellation.

hf_sef.data_path([dataset, path, …])

Get path to local copy of the high frequency SEF dataset.

kiloword.data_path([path, force_update, …])

Get path to local copy of the kiloword dataset.

misc.data_path([path, force_update, …])

Get path to local copy of misc dataset.

mtrf.data_path([path, force_update, …])

Get path to local copy of mtrf dataset.

multimodal.data_path([path, force_update, …])

Get path to local copy of multimodal dataset.

opm.data_path([path, force_update, …])

Get path to local copy of opm dataset.

sleep_physionet.age.fetch_data(subjects[, …])

Get paths to local copies of PhysioNet Polysomnography dataset files.

sleep_physionet.temazepam.fetch_data(subjects)

Get paths to local copies of PhysioNet Polysomnography dataset files.

sample.data_path([path, force_update, …])

Get path to local copy of sample dataset.

somato.data_path([path, force_update, …])

Get path to local copy of somato dataset.

spm_face.data_path([path, force_update, …])

Get path to local copy of spm dataset.

visual_92_categories.data_path([path, …])

Get path to local copy of visual_92_categories dataset.

phantom_4dbti.data_path([path, …])

Get path to local copy of phantom_4dbti dataset.

Visualization

mne.viz:

Visualization routines.

ClickableImage(imdata, **kwargs)

Display an image so you can click on it and store x/y positions.

add_background_image(fig, im[, set_ratios])

Add a background image to a plot.

compare_fiff(fname_1, fname_2[, fname_out, …])

Compare the contents of two fiff files using diff and show_fiff.

circular_layout(node_names, node_order[, …])

Create layout arranging nodes on a circle.

mne_analyze_colormap([limits, format])

Return a colormap similar to that used by mne_analyze.

plot_bem([subject, subjects_dir, …])

Plot BEM contours on anatomical slices.

plot_connectivity_circle(con, node_names[, …])

Visualize connectivity as a circular graph.

plot_cov(cov, info[, exclude, colorbar, …])

Plot Covariance data.

plot_csd(csd[, info, mode, colorbar, cmap, …])

Plot CSD matrices.

plot_dipole_amplitudes(dipoles[, colors, show])

Plot the amplitude traces of a set of dipoles.

plot_dipole_locations(dipoles[, trans, …])

Plot dipole locations.

plot_drop_log(drop_log[, threshold, …])

Show the channel stats based on a drop_log from Epochs.

plot_epochs(epochs[, picks, scalings, …])

Visualize epochs.

plot_events(events[, sfreq, first_samp, …])

Plot events to get a visual display of the paradigm.

plot_evoked(evoked[, picks, exclude, unit, …])

Plot evoked data using butterfly plots.

plot_evoked_image(evoked[, picks, exclude, …])

Plot evoked data as images.

plot_evoked_topo(evoked[, layout, …])

Plot 2D topography of evoked responses.

plot_evoked_topomap(evoked[, times, …])

Plot topographic maps of specific time points of evoked data.

plot_evoked_joint(evoked[, times, title, …])

Plot evoked data as butterfly plot and add topomaps for time points.

plot_evoked_field(evoked, surf_maps[, time, …])

Plot MEG/EEG fields on head surface and helmet in 3D.

plot_evoked_white(evoked, noise_cov[, show, …])

Plot whitened evoked response.

plot_filter(h, sfreq[, freq, gain, title, …])

Plot properties of a filter.

plot_head_positions(pos[, mode, cmap, …])

Plot head positions.

plot_ideal_filter(freq, gain[, axes, title, …])

Plot an ideal filter response.

plot_compare_evokeds(evokeds[, picks, gfp, …])

Plot evoked time courses for one or more conditions and/or channels.

plot_ica_sources(ica, inst[, picks, …])

Plot estimated latent sources given the unmixing matrix.

plot_ica_components(ica[, picks, ch_type, …])

Project unmixing matrix on interpolated sensor topography.

plot_ica_properties(ica, inst[, picks, …])

Display component properties.

plot_ica_scores(ica, scores[, exclude, …])

Plot scores related to detected components.

plot_ica_overlay(ica, inst[, exclude, …])

Overlay of raw and cleaned signals given the unmixing matrix.

plot_epochs_image(epochs[, picks, sigma, …])

Plot Event Related Potential / Fields image.

plot_layout(layout[, picks, show])

Plot the sensor positions.

plot_montage(montage[, scale_factor, …])

Plot a montage.

plot_projs_topomap(projs[, layout, cmap, …])

Plot topographic maps of SSP projections.

plot_raw(raw[, events, duration, start, …])

Plot raw data.

plot_raw_psd(raw[, fmin, fmax, tmin, tmax, …])

Plot the power spectral density across channels.

plot_sensors(info[, kind, ch_type, title, …])

Plot sensors positions.

plot_sensors_connectivity(info, con[, picks])

Visualize the sensor connectivity in 3D.

plot_snr_estimate(evoked, inv[, show, verbose])

Plot a data SNR estimate.

plot_source_estimates(stc[, subject, …])

Plot SourceEstimate with PySurfer.

plot_volume_source_estimates(stc, src[, …])

Plot Nutmeg style volumetric source estimates using nilearn.

plot_vector_source_estimates(stc[, subject, …])

Plot VectorSourceEstimate with PySurfer.

plot_sparse_source_estimates(src, stcs[, …])

Plot source estimates obtained with sparse solver.

plot_tfr_topomap(tfr[, tmin, tmax, fmin, …])

Plot topographic maps of specific time-frequency intervals of TFR data.

plot_topo_image_epochs(epochs[, layout, …])

Plot Event Related Potential / Fields image on topographies.

plot_topomap(data, pos[, vmin, vmax, cmap, …])

Plot a topographic map as image.

plot_alignment([info, trans, subject, …])

Plot head, sensor, and source space alignment in 3D.

snapshot_brain_montage(fig, montage[, …])

Take a snapshot of a Mayavi Scene and project channels onto 2d coords.

plot_arrowmap(data, info_from[, info_to, …])

Plot arrow map.

set_3d_backend(backend_name)

Set the backend for MNE.

get_3d_backend()

Return the backend currently used.

use_3d_backend(backend_name)

Create a viz context.

set_3d_view(figure[, azimuth, elevation, …])

Configure the view of the given scene.

set_3d_title(figure, title[, size])

Configure the title of the given scene.

create_3d_figure(size[, bgcolor])

Return an empty figure based on the current 3d backend.

Preprocessing

Projections:

Projection

Projection vector.

compute_proj_epochs(epochs[, n_grad, n_mag, …])

Compute SSP (spatial space projection) vectors on Epochs.

compute_proj_evoked(evoked[, n_grad, n_mag, …])

Compute SSP (spatial space projection) vectors on Evoked.

compute_proj_raw(raw[, start, stop, …])

Compute SSP (spatial space projection) vectors on Raw.

read_proj(fname)

Read projections from a FIF file.

write_proj(fname, projs)

Write projections to a FIF file.

mne.channels:

Module dedicated to manipulation of channels.

Can be used for setting of sensor locations used for processing and plotting.

Layout(box, pos, names, ids, kind)

Sensor layouts.

Montage(pos, ch_names, kind, selection[, …])

Montage for standard EEG electrode locations.

DigMontage([hsp, hpi, elp, point_names, …])

Montage for digitized electrode and headshape position data.

fix_mag_coil_types(info)

Fix magnetometer coil types.

read_montage(kind[, ch_names, path, unit, …])

Read a generic (built-in) montage.

get_builtin_montages()

Get a list of all builtin montages.

read_dig_montage([hsp, hpi, elp, …])

Read subject-specific digitization montage from a file.

read_layout(kind[, path, scale])

Read layout from a file.

find_layout(info[, ch_type, exclude])

Choose a layout based on the channels in the info ‘chs’ field.

make_eeg_layout(info[, radius, width, …])

Create .lout file from EEG electrode digitization.

make_grid_layout(info[, picks, n_col])

Generate .lout file for custom data, i.e., ICA sources.

find_ch_connectivity(info, ch_type)

Find the connectivity matrix for the given channels.

read_ch_connectivity(fname[, picks])

Parse FieldTrip neighbors .mat file.

equalize_channels(candidates[, verbose])

Equalize channel picks for a collection of MNE-Python objects.

rename_channels(info, mapping)

Rename channels.

generate_2d_layout(xy[, w, h, pad, …])

Generate a custom 2D layout from xy points.

make_1020_channel_selections(info[, midline])

Return dict mapping from ROI names to lists of picks for 10/20 setups.

mne.preprocessing:

Preprocessing with artifact detection, SSP, and ICA.

ICA([n_components, max_pca_components, …])

M/EEG signal decomposition using Independent Component Analysis (ICA).

Xdawn([n_components, signal_cov, …])

Implementation of the Xdawn Algorithm.

compute_proj_ecg(raw[, raw_event, tmin, …])

Compute SSP/PCA projections for ECG artifacts.

compute_proj_eog(raw[, raw_event, tmin, …])

Compute SSP/PCA projections for EOG artifacts.

create_ecg_epochs(raw[, ch_name, event_id, …])

Conveniently generate epochs around ECG artifact events.

create_eog_epochs(raw[, ch_name, event_id, …])

Conveniently generate epochs around EOG artifact events.

find_ecg_events(raw[, event_id, ch_name, …])

Find ECG peaks.

find_eog_events(raw[, event_id, l_freq, …])

Locate EOG artifacts.

fix_stim_artifact(inst[, events, event_id, …])

Eliminate stimulation’s artifacts from instance.

ica_find_ecg_events(raw, ecg_source[, …])

Find ECG peaks from one selected ICA source.

ica_find_eog_events(raw[, eog_source, …])

Locate EOG artifacts from one selected ICA source.

infomax(data[, weights, l_rate, block, …])

Run (extended) Infomax ICA decomposition on raw data.

mark_flat(raw[, bad_percent, min_duration, …])

Mark flat segments of raw data using annotations or in info[‘bads’].

maxwell_filter(raw[, origin, int_order, …])

Maxwell filter data using multipole moments.

oversampled_temporal_projection(raw[, …])

Denoise MEG channels using leave-one-out temporal projection.

peak_finder(x0[, thresh, extrema, verbose])

Noise-tolerant fast peak-finding algorithm.

read_ica(fname[, verbose])

Restore ICA solution from fif file.

run_ica(raw, n_components[, …])

Run ICA decomposition on raw data and identify artifact sources.

corrmap(icas, template[, threshold, label, …])

Find similar Independent Components across subjects by map similarity.

EEG referencing:

add_reference_channels(inst, ref_channels[, …])

Add reference channels to data that consists of all zeros.

set_bipolar_reference(inst, anode, cathode)

Re-reference selected channels using a bipolar referencing scheme.

set_eeg_reference(inst[, ref_channels, …])

Specify which reference to use for EEG data.

mne.filter:

IIR and FIR filtering and resampling functions.

construct_iir_filter(iir_params[, f_pass, …])

Use IIR parameters to get filtering coefficients.

create_filter(data, sfreq, l_freq, h_freq[, …])

Create a FIR or IIR filter.

estimate_ringing_samples(system[, max_try])

Estimate filter ringing.

filter_data(data, sfreq, l_freq, h_freq[, …])

Filter a subset of channels.

notch_filter(x, Fs, freqs[, filter_length, …])

Notch filter for the signal x.

resample(x[, up, down, npad, axis, window, …])

Resample an array.

mne.chpi

Functions for fitting head positions with (c)HPI coils.

filter_chpi(raw[, include_line, t_step, …])

Remove cHPI and line noise from data.

head_pos_to_trans_rot_t(quats)

Convert Maxfilter-formatted head position quaternions.

read_head_pos(fname)

Read MaxFilter-formatted head position parameters.

write_head_pos(fname, pos)

Write MaxFilter-formatted head position parameters.

mne.transforms

Helpers for various transformations.

Transform(fro, to[, trans])

A transform.

quat_to_rot(quat)

Convert a set of quaternions to rotations.

rot_to_quat(rot)

Convert a set of rotations to quaternions.

Events

Annotations(onset, duration, description[, …])

Annotation object for annotating segments of raw data.

AcqParserFIF(info)

Parser for Elekta data acquisition settings.

concatenate_events(events, first_samps, …)

Concatenate event lists to be compatible with concatenate_raws.

find_events(raw[, stim_channel, output, …])

Find events from raw file.

find_stim_steps(raw[, pad_start, pad_stop, …])

Find all steps in data from a stim channel.

make_fixed_length_events(raw[, id, start, …])

Make a set of events separated by a fixed duration.

merge_events(events, ids, new_id[, …])

Merge a set of events.

parse_config(fname)

Parse a config file (like .ave and .cov files).

pick_events(events[, include, exclude, step])

Select some events.

read_annotations(fname[, sfreq, uint16_codec])

Read annotations from a file.

read_events(filename[, include, exclude, …])

Read events from fif or text file.

write_events(filename, event_list)

Write events to file.

concatenate_epochs(epochs_list[, add_offset])

Concatenate a list of epochs into one epochs object.

events_from_annotations(raw[, event_id, …])

Get events and event_id from an Annotations object.

mne.event:

IO with fif files containing events.

define_target_events(events, reference_id, …)

Define new events by co-occurrence of existing events.

shift_time_events(events, ids, tshift, sfreq)

Shift an event.

mne.epochs:

Tools for working with epoched data.

add_channels_epochs(epochs_list[, verbose])

Concatenate channels, info and data from two Epochs objects.

average_movements(epochs[, head_pos, …])

Average data using Maxwell filtering, transforming using head positions.

combine_event_ids(epochs, old_event_ids, …)

Collapse event_ids from an epochs instance into a new event_id.

equalize_epoch_counts(epochs_list[, method])

Equalize the number of trials in multiple Epoch instances.

Sensor Space Data

combine_evoked(all_evoked, weights)

Merge evoked data by weighted addition or subtraction.

concatenate_raws(raws[, preload, …])

Concatenate raw instances as if they were continuous.

equalize_channels(candidates[, verbose])

Equalize channel picks for a collection of MNE-Python objects.

grand_average(all_inst[, interpolate_bads, …])

Make grand average of a list evoked or AverageTFR data.

pick_channels(ch_names, include[, exclude, …])

Pick channels by names.

pick_channels_cov(orig[, include, exclude])

Pick channels from covariance matrix.

pick_channels_forward(orig[, include, …])

Pick channels from forward operator.

pick_channels_regexp(ch_names, regexp)

Pick channels using regular expression.

pick_types(info[, meg, eeg, stim, eog, ecg, …])

Pick channels by type and names.

pick_types_forward(orig[, meg, eeg, …])

Pick by channel type and names from a forward operator.

pick_info(info[, sel, copy, verbose])

Restrict an info structure to a selection of channels.

read_epochs(fname[, proj, preload, verbose])

Read epochs from a fif file.

read_reject_parameters(fname)

Read rejection parameters from .cov or .ave config file.

read_selection(name[, fname, info, verbose])

Read channel selection from file.

rename_channels(info, mapping)

Rename channels.

Covariance computation

Covariance(data, names, bads, projs, nfree)

Noise covariance matrix.

compute_covariance(epochs[, …])

Estimate noise covariance matrix from epochs.

compute_raw_covariance(raw[, tmin, tmax, …])

Estimate noise covariance matrix from a continuous segment of raw data.

cov.compute_whitener(noise_cov[, info, …])

Compute whitening matrix.

cov.prepare_noise_cov(noise_cov, info[, …])

Prepare noise covariance matrix.

cov.regularize(cov, info[, mag, grad, eeg, …])

Regularize noise covariance matrix.

compute_rank(inst[, rank, scalings, info, …])

Compute the rank of data or noise covariance.

make_ad_hoc_cov(info[, std, verbose])

Create an ad hoc noise covariance.

read_cov(fname[, verbose])

Read a noise covariance from a FIF file.

write_cov(fname, cov)

Write a noise covariance matrix.

MRI Processing

Step by step instructions for using gui.coregistration():

gui.coregistration([tabbed, split, width, …])

Coregister an MRI with a subject’s head shape.

gui.fiducials([subject, fid_file, subjects_dir])

Set the fiducials for an MRI subject.

create_default_subject([fs_home, update, …])

Create an average brain subject for subjects without structural MRI.

scale_mri(subject_from, subject_to, scale[, …])

Create a scaled copy of an MRI subject.

scale_bem(subject_to, bem_name[, …])

Scale a bem file.

scale_labels(subject_to[, pattern, …])

Scale labels to match a brain that was previously created by scaling.

scale_source_space(subject_to, src_name[, …])

Scale a source space for an mri created with scale_mri().

Forward Modeling

Forward

Forward class to represent info from forward solution.

SourceSpaces(source_spaces[, info])

Represent a list of source space.

add_source_space_distances(src[, …])

Compute inter-source distances along the cortical surface.

apply_forward(fwd, stc, info[, start, stop, …])

Project source space currents to sensor space using a forward operator.

apply_forward_raw(fwd, stc, info[, start, …])

Project source space currents to sensor space using a forward operator.

average_forward_solutions(fwds[, weights])

Average forward solutions.

convert_forward_solution(fwd[, surf_ori, …])

Convert forward solution between different source orientations.

dig_mri_distances(info, trans, subject[, …])

Compute distances between head shape points and the scalp surface.

forward.compute_depth_prior(forward, info[, …])

Compute depth prior for depth weighting.

forward.compute_orient_prior(forward[, …])

Compute orientation prior.

forward.restrict_forward_to_label(fwd, labels)

Restrict forward operator to labels.

forward.restrict_forward_to_stc(fwd, stc[, …])

Restrict forward operator to active sources in a source estimate.

make_bem_model(subject[, ico, conductivity, …])

Create a BEM model for a subject.

make_bem_solution(surfs[, verbose])

Create a BEM solution using the linear collocation approach.

make_forward_dipole(dipole, bem, info[, …])

Convert dipole object to source estimate and calculate forward operator.

make_forward_solution(info, trans, src, bem)

Calculate a forward solution for a subject.

make_field_map(evoked[, trans, subject, …])

Compute surface maps used for field display in 3D.

make_sphere_model([r0, head_radius, info, …])

Create a spherical model for forward solution calculation.

morph_source_spaces(src_from, subject_to[, …])

Morph an existing source space to a different subject.

read_bem_surfaces(fname[, patch_stats, …])

Read the BEM surfaces from a FIF file.

read_forward_solution(fname[, include, …])

Read a forward solution a.k.a.

read_trans(fname[, return_all])

Read a -trans.fif file.

read_source_spaces(fname[, patch_stats, verbose])

Read the source spaces from a FIF file.

read_surface(fname[, read_metadata, …])

Load a Freesurfer surface mesh in triangular format.

sensitivity_map(fwd[, projs, ch_type, mode, …])

Compute sensitivity map.

setup_source_space(subject[, spacing, …])

Set up bilateral hemisphere surface-based source space with subsampling.

setup_volume_source_space([subject, pos, …])

Set up a volume source space with grid spacing or discrete source space.

surface.complete_surface_info(surf[, …])

Complete surface information.

use_coil_def(fname)

Use a custom coil definition file.

write_bem_surfaces(fname, surfs)

Write BEM surfaces to a fiff file.

write_trans(fname, trans)

Write a -trans.fif file.

mne.bem:

ConductorModel

BEM or sphere model.

fit_sphere_to_headshape(info[, dig_kinds, …])

Fit a sphere to the headshape points to determine head center.

get_fitting_dig(info[, dig_kinds, …])

Get digitization points suitable for sphere fitting.

make_watershed_bem(subject[, subjects_dir, …])

Create BEM surfaces using the FreeSurfer watershed algorithm.

make_flash_bem(subject[, overwrite, show, …])

Create 3-Layer BEM model from prepared flash MRI images.

convert_flash_mris(subject[, flash30, …])

Convert DICOM files for use with make_flash_bem.

Inverse Solutions

mne.minimum_norm:

Linear inverse solvers based on L2 Minimum Norm Estimates (MNE).

InverseOperator

InverseOperator class to represent info from inverse operator.

apply_inverse(evoked, inverse_operator[, …])

Apply inverse operator to evoked data.

apply_inverse_epochs(epochs, …[, method, …])

Apply inverse operator to Epochs.

apply_inverse_raw(raw, inverse_operator, lambda2)

Apply inverse operator to Raw data.

compute_source_psd(raw, inverse_operator[, …])

Compute source power spectral density (PSD).

compute_source_psd_epochs(epochs, …[, …])

Compute source power spectral density (PSD) from Epochs.

compute_rank_inverse(inv)

Compute the rank of a linear inverse operator (MNE, dSPM, etc.).

estimate_snr(evoked, inv[, verbose])

Estimate the SNR as a function of time for evoked data.

make_inverse_operator(info, forward, noise_cov)

Assemble inverse operator.

prepare_inverse_operator(orig, nave, lambda2)

Prepare an inverse operator for actually computing the inverse.

read_inverse_operator(fname[, verbose])

Read the inverse operator decomposition from a FIF file.

source_band_induced_power(epochs, …[, …])

Compute source space induced power in given frequency bands.

source_induced_power(epochs, …[, label, …])

Compute induced power and phase lock.

write_inverse_operator(fname, inv[, verbose])

Write an inverse operator to a FIF file.

point_spread_function(inverse_operator, …)

Compute point-spread functions (PSFs) for linear estimators.

cross_talk_function(inverse_operator, …[, …])

Compute cross-talk functions (CTFs) for linear estimators.

mne.inverse_sparse:

Non-Linear sparse inverse solvers.

mixed_norm(evoked, forward, noise_cov, alpha)

Mixed-norm estimate (MxNE) and iterative reweighted MxNE (irMxNE).

tf_mixed_norm(evoked, forward, noise_cov[, …])

Time-Frequency Mixed-norm estimate (TF-MxNE).

gamma_map(evoked, forward, noise_cov, alpha)

Hierarchical Bayes (Gamma-MAP) sparse source localization method.

make_stc_from_dipoles(dipoles, src[, verbose])

Convert a list of spatio-temporal dipoles into a SourceEstimate.

mne.beamformer:

Beamformers for source localization.

Beamformer

A computed beamformer.

read_beamformer(fname)

Read a beamformer filter.

make_lcmv(info, forward, data_cov[, reg, …])

Compute LCMV spatial filter.

apply_lcmv(evoked, filters[, max_ori_out, …])

Apply Linearly Constrained Minimum Variance (LCMV) beamformer weights.

apply_lcmv_epochs(epochs, filters[, …])

Apply Linearly Constrained Minimum Variance (LCMV) beamformer weights.

apply_lcmv_raw(raw, filters[, start, stop, …])

Apply Linearly Constrained Minimum Variance (LCMV) beamformer weights.

apply_lcmv_cov(data_cov, filters[, verbose])

Apply Linearly Constrained Minimum Variance (LCMV) beamformer weights.

make_dics(info, forward, csd[, reg, label, …])

Compute a Dynamic Imaging of Coherent Sources (DICS) spatial filter.

apply_dics(evoked, filters[, verbose])

Apply Dynamic Imaging of Coherent Sources (DICS) beamformer weights.

apply_dics_csd(csd, filters[, verbose])

Apply Dynamic Imaging of Coherent Sources (DICS) beamformer weights.

apply_dics_epochs(epochs, filters[, …])

Apply Dynamic Imaging of Coherent Sources (DICS) beamformer weights.

rap_music(evoked, forward, noise_cov[, …])

RAP-MUSIC source localization method.

tf_dics(epochs, forward, noise_csds, tmin, …)

5D time-frequency beamforming based on DICS.

tf_lcmv(epochs, forward, noise_covs, tmin, …)

5D time-frequency beamforming based on LCMV.

Dipole(times, pos, amplitude, ori, gof[, …])

Dipole class for sequential dipole fits.

DipoleFixed(info, data, times, nave, …[, …])

Dipole class for fixed-position dipole fits.

fit_dipole(evoked, cov, bem[, trans, …])

Fit a dipole.

mne.dipole:

Single-dipole functions and classes.

get_phantom_dipoles([kind])

Get standard phantom dipole locations and orientations.

Source Space Data

BiHemiLabel(lh, rh[, name, color])

A freesurfer/MNE label with vertices in both hemispheres.

Label([vertices, pos, values, hemi, …])

A FreeSurfer/MNE label with vertices restricted to one hemisphere.

MixedSourceEstimate(data[, vertices, tmin, …])

Container for mixed surface and volume source estimates.

SourceEstimate(data[, vertices, tmin, …])

Container for surface source estimates.

VectorSourceEstimate(data[, vertices, tmin, …])

Container for vector surface source estimates.

VolSourceEstimate(data[, vertices, tmin, …])

Container for volume source estimates.

VolVectorSourceEstimate(data[, vertices, …])

Container for volume source estimates.

SourceMorph(subject_from, subject_to, kind, …)

Morph source space data from one subject to another.

compute_source_morph(src[, subject_from, …])

Create a SourceMorph from one subject to another.

head_to_mni(pos, subject, mri_head_t[, …])

Convert pos from head coordinate system to MNI ones.

head_to_mri(pos, subject, mri_head_t[, …])

Convert pos from head coordinate system to MRI ones.

extract_label_time_course(stcs, labels, src)

Extract label time course for lists of labels and source estimates.

grade_to_tris(grade[, verbose])

Get tris defined for a certain grade.

grade_to_vertices(subject, grade[, …])

Convert a grade to source space vertices for a given subject.

label.select_sources(subject, label[, …])

Select sources from a label.

grow_labels(subject, seeds, extents, hemis)

Generate circular labels in source space with region growing.

label_sign_flip(label, src)

Compute sign for label averaging.

labels_to_stc(labels, values[, tmin, tstep, …])

Convert a set of labels and values to a STC.

morph_labels(labels, subject_to[, …])

Morph a set of labels.

random_parcellation(subject, n_parcel, hemi)

Generate random cortex parcellation by growing labels.

read_labels_from_annot(subject[, parc, …])

Read labels from a FreeSurfer annotation file.

read_dipole(fname[, verbose])

Read .dip file from Neuromag/xfit or MNE.

read_label(filename[, subject, color])

Read FreeSurfer Label file.

read_source_estimate(fname[, subject])

Read a source estimate object.

read_source_morph(fname)

Load the morph for source estimates from a file.

split_label(label[, parts, subject, …])

Split a Label into two or more parts.

stc_to_label(stc[, src, smooth, connected, …])

Compute a label from the non-zero sources in an stc object.

transform_surface_to(surf, dest, trans[, copy])

Transform surface to the desired coordinate system.

vertex_to_mni(vertices, hemis, subject[, …])

Convert the array of vertices for a hemisphere to MNI coordinates.

write_labels_to_annot(labels[, subject, …])

Create a FreeSurfer annotation from a list of labels.

write_label(filename, label[, verbose])

Write a FreeSurfer label.

Time-Frequency

mne.time_frequency:

Time frequency analysis tools.

AverageTFR(info, data, times, freqs, nave[, …])

Container for Time-Frequency data.

EpochsTFR(info, data, times, freqs[, …])

Container for Time-Frequency data on epochs.

CrossSpectralDensity(data, ch_names, …[, …])

Cross-spectral density.

Functions that operate on mne-python objects:

csd_fourier(epochs[, fmin, fmax, tmin, …])

Estimate cross-spectral density from an array using short-time fourier.

csd_multitaper(epochs[, fmin, fmax, tmin, …])

Estimate cross-spectral density from epochs using Morlet wavelets.

csd_morlet(epochs, frequencies[, tmin, …])

Estimate cross-spectral density from epochs using Morlet wavelets.

pick_channels_csd(csd[, include, exclude])

Pick channels from covariance matrix.

read_csd(fname)

Read a CrossSpectralDensity object from an HDF5 file.

fit_iir_model_raw(raw[, order, picks, tmin, …])

Fit an AR model to raw data and creates the corresponding IIR filter.

psd_welch(inst[, fmin, fmax, tmin, tmax, …])

Compute the power spectral density (PSD) using Welch’s method.

psd_multitaper(inst[, fmin, fmax, tmin, …])

Compute the power spectral density (PSD) using multitapers.

tfr_morlet(inst, freqs, n_cycles[, use_fft, …])

Compute Time-Frequency Representation (TFR) using Morlet wavelets.

tfr_multitaper(inst, freqs, n_cycles[, …])

Compute Time-Frequency Representation (TFR) using DPSS tapers.

tfr_stockwell(inst[, fmin, fmax, n_fft, …])

Time-Frequency Representation (TFR) using Stockwell Transform.

read_tfrs(fname[, condition])

Read TFR datasets from hdf5 file.

write_tfrs(fname, tfr[, overwrite])

Write a TFR dataset to hdf5.

Functions that operate on np.ndarray objects:

csd_array_fourier(X, sfreq[, t0, fmin, …])

Estimate cross-spectral density from an array using short-time fourier.

csd_array_multitaper(X, sfreq[, t0, fmin, …])

Estimate cross-spectral density from an array using Morlet wavelets.

csd_array_morlet(X, sfreq, frequencies[, …])

Estimate cross-spectral density from an array using Morlet wavelets.

dpss_windows(N, half_nbw, Kmax[, low_bias, …])

Compute Discrete Prolate Spheroidal Sequences.

morlet(sfreq, freqs[, n_cycles, sigma, …])

Compute Morlet wavelets for the given frequency range.

stft(x, wsize[, tstep, verbose])

STFT Short-Term Fourier Transform using a sine window.

istft(X[, tstep, Tx])

ISTFT Inverse Short-Term Fourier Transform using a sine window.

stftfreq(wsize[, sfreq])

Frequencies of stft transformation.

psd_array_multitaper(x, sfreq[, fmin, fmax, …])

Compute power spectral density (PSD) using a multi-taper method.

psd_array_welch(x, sfreq[, fmin, fmax, …])

Compute power spectral density (PSD) using Welch’s method.

tfr_array_morlet(epoch_data, sfreq, freqs[, …])

Compute time-frequency transform using Morlet wavelets.

tfr_array_multitaper(epoch_data, sfreq, freqs)

Compute time-frequency transforms using wavelets and multitaper windows.

tfr_array_stockwell(data, sfreq[, fmin, …])

Compute power and intertrial coherence using Stockwell (S) transform.

mne.time_frequency.tfr:

A module which implements the time-frequency estimation.

Morlet code inspired by Matlab code from Sheraz Khan & Brainstorm & SPM

cwt(X, Ws[, use_fft, mode, decim])

Compute time freq decomposition with continuous wavelet transform.

morlet(sfreq, freqs[, n_cycles, sigma, …])

Compute Morlet wavelets for the given frequency range.

Connectivity Estimation

mne.connectivity:

Spectral and effective connectivity measures.

degree(connectivity[, threshold_prop])

Compute the undirected degree of a connectivity matrix.

envelope_correlation(data[, combine, verbose])

Compute the envelope correlation.

phase_slope_index(data[, indices, sfreq, …])

Compute the Phase Slope Index (PSI) connectivity measure.

seed_target_indices(seeds, targets)

Generate indices parameter for seed based connectivity analysis.

spectral_connectivity(data[, method, …])

Compute frequency- and time-frequency-domain connectivity measures.

Statistics

mne.stats:

Functions for statistical analysis.

Parametric statistics (see scipy.stats and statsmodels for more options):

ttest_1samp_no_p(X[, sigma, method])

Perform one-sample t-test.

f_oneway(\*args)

Perform a 1-way ANOVA.

f_mway_rm(data, factor_levels[, effects, …])

Compute M-way repeated measures ANOVA for fully balanced designs.

f_threshold_mway_rm(n_subjects, factor_levels)

Compute F-value thresholds for a two-way ANOVA.

linear_regression(inst, design_matrix[, names])

Fit Ordinary Least Squares regression (OLS).

linear_regression_raw(raw, events[, …])

Estimate regression-based evoked potentials/fields by linear modeling.

Mass-univariate multiple comparison correction:

bonferroni_correction(pval[, alpha])

P-value correction with Bonferroni method.

fdr_correction(pvals[, alpha, method])

P-value correction with False Discovery Rate (FDR).

Non-parametric (clustering) resampling methods:

permutation_cluster_test(X[, threshold, …])

Cluster-level statistical permutation test.

permutation_cluster_1samp_test(X[, …])

Non-parametric cluster-level paired t-test.

permutation_t_test(X[, n_permutations, …])

One sample/paired sample permutation test based on a t-statistic.

spatio_temporal_cluster_test(X[, threshold, …])

Non-parametric cluster-level test for spatio-temporal data.

spatio_temporal_cluster_1samp_test(X[, …])

Non-parametric cluster-level paired t-test for spatio-temporal data.

summarize_clusters_stc(clu[, p_thresh, …])

Assemble summary SourceEstimate from spatiotemporal cluster results.

Compute connectivity matrices for cluster-level statistics:

channels.find_ch_connectivity(info, ch_type)

Find the connectivity matrix for the given channels.

channels.read_ch_connectivity(fname[, picks])

Parse FieldTrip neighbors .mat file.

spatial_dist_connectivity(src, dist[, verbose])

Compute connectivity from distances in a source space.

spatial_src_connectivity(src[, dist, verbose])

Compute connectivity for a source space activation.

spatial_tris_connectivity(tris[, …])

Compute connectivity from triangles.

spatial_inter_hemi_connectivity(src, dist[, …])

Get vertices on each hemisphere that are close to the other hemisphere.

spatio_temporal_src_connectivity(src, n_times)

Compute connectivity for a source space activation over time.

spatio_temporal_tris_connectivity(tris, n_times)

Compute connectivity from triangles and time instants.

spatio_temporal_dist_connectivity(src, …)

Compute connectivity from distances in a source space and time instants.

Simulation

mne.simulation:

Data simulation code.

add_chpi(raw[, head_pos, interp, n_jobs, …])

Add cHPI activations to raw data.

add_ecg(raw[, head_pos, interp, n_jobs, …])

Add ECG noise to raw data.

add_eog(raw[, head_pos, interp, n_jobs, …])

Add blink noise to raw data.

add_noise(inst, cov[, iir_filter, …])

Create noise as a multivariate Gaussian.

simulate_evoked(fwd, stc, info, cov[, nave, …])

Generate noisy evoked data.

simulate_raw(info[, stc, trans, src, bem, …])

Simulate raw data.

simulate_stc(src, labels, stc_data, tmin, tstep)

Simulate sources time courses from waveforms and labels.

simulate_sparse_stc(src, n_dipoles, times[, …])

Generate sparse (n_dipoles) sources time courses from data_fun.

select_source_in_label(src, label[, …])

Select source positions using a label.

SourceSimulator(src[, tstep, duration])

Class to generate simulated Source Estimates.

Decoding

mne.decoding:

Decoding and encoding, including machine learning and receptive fields.

CSP([n_components, reg, log, cov_est, …])

M/EEG signal decomposition using the Common Spatial Patterns (CSP).

EMS

Transformer to compute event-matched spatial filters.

FilterEstimator(info, l_freq, h_freq[, …])

Estimator to filter RtEpochs.

LinearModel([model])

Compute and store patterns from linear models.

PSDEstimator([sfreq, fmin, fmax, bandwidth, …])

Compute power spectral density (PSD) using a multi-taper method.

Scaler([info, scalings, with_mean, with_std])

Standardize channel data.

TemporalFilter([l_freq, h_freq, sfreq, …])

Estimator to filter data array along the last dimension.

TimeFrequency(freqs[, sfreq, method, …])

Time frequency transformer.

UnsupervisedSpatialFilter(estimator[, average])

Use unsupervised spatial filtering across time and samples.

Vectorizer

Transform n-dimensional array into 2D array of n_samples by n_features.

ReceptiveField(tmin, tmax, sfreq[, …])

Fit a receptive field model.

TimeDelayingRidge(tmin, tmax, sfreq[, …])

Ridge regression of data with time delays.

SlidingEstimator(base_estimator[, scoring, …])

Search Light.

GeneralizingEstimator(base_estimator[, …])

Generalization Light.

SPoC([n_components, reg, log, …])

Implementation of the SPoC spatial filtering.

Functions that assist with decoding and model fitting:

compute_ems(epochs[, conditions, picks, …])

Compute event-matched spatial filter on epochs.

cross_val_multiscore(estimator, X[, y, …])

Evaluate a score by cross-validation.

get_coef(estimator[, attr, inverse_transform])

Retrieve the coefficients of an estimator ending with a Linear Model.

Realtime

Realtime functionality has moved to the standalone module mne_realtime.

MNE-Report

mne:

Report([info_fname, subjects_dir, subject, …])

Object for rendering HTML.

open_report(fname, \*\*params)

Read a saved report or, if it doesn’t exist yet, create a new one.

Logging and Configuration

get_config_path([home_dir])

Get path to standard mne-python config file.

get_config([key, default, raise_error, …])

Read MNE-Python preferences from environment or config file.

open_docs([kind, version])

Launch a new web browser tab with the MNE documentation.

set_log_level([verbose, return_old_level])

Set the logging level.

set_log_file([fname, output_format, overwrite])

Set the log to print to a file.

set_config(key, value[, home_dir, set_env])

Set a MNE-Python preference key in the config file and environment.

sys_info([fid, show_paths])

Print the system information for debugging.

verbose(function)

Verbose decorator to allow functions to override log-level.

mne.utils:

deprecated([extra])

Mark a function or class as deprecated (decorator).

warn(message[, category, module])

Emit a warning with trace outside the mne namespace.

mne.cuda:

get_cuda_memory([kind])

Get the amount of free memory for CUDA operations.

init_cuda([ignore_config, verbose])

Initialize CUDA functionality.