Python API Reference

This is the classes and functions reference of MNE-Python. Functions are 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.

Classes

MNE software for MEG and EEG data analysis.

io.Raw(fname[, allow_maxshield, preload, …]) Raw data in FIF format.
io.RawFIF alias of Raw
io.RawArray(data, info[, first_samp, verbose]) Raw object from numpy array.
io.BaseRaw(info[, preload, first_samps, …]) Base class for Raw data.
Annotations(onset, duration, description[, …]) Annotation object for annotating segments of raw data.
AcqParserFIF(info) Parser for Elekta data acquisition settings.
BaseEpochs(info, data, events[, event_id, …]) Abstract base class for Epochs-type classes.
Epochs(raw, events[, event_id, tmin, tmax, …]) Epochs extracted from a Raw instance.
Evoked(fname[, condition, proj, kind, …]) Evoked data.
SourceSpaces(source_spaces[, info]) Represent a list of source space.
Forward Forward class to represent info from forward solution.
SourceEstimate(data[, vertices, tmin, …]) Container for surface source estimates.
VolSourceEstimate(data[, vertices, tmin, …]) Container for volume source estimates.
MixedSourceEstimate(data[, vertices, tmin, …]) Container for mixed surface and volume source estimates.
Covariance(data, names, bads, projs, nfree) Noise covariance matrix.
Dipole(times, pos, amplitude, ori, gof[, name]) Dipole class for sequential dipole fits.
DipoleFixed(info, data, times, nave, …[, …]) Dipole class for fixed-position dipole fits.
Label(vertices[, pos, values, hemi, …]) A FreeSurfer/MNE label with vertices restricted to one hemisphere.
BiHemiLabel(lh, rh[, name, color]) A freesurfer/MNE label with vertices in both hemispheres.
Transform(fro, to[, trans]) A transform.
Report([info_fname, subjects_dir, subject, …]) Object for rendering HTML.
Info Information about the recording.
Projection Projection vector.
preprocessing.ICA([n_components, …]) M/EEG signal decomposition using Independent Component Analysis (ICA).
preprocessing.Xdawn([n_components, …]) Implementation of the Xdawn Algorithm.
decoding.CSP([n_components, reg, log, …]) M/EEG signal decomposition using the Common Spatial Patterns (CSP).
decoding.FilterEstimator(info, l_freq, h_freq) Estimator to filter RtEpochs.
decoding.GeneralizationAcrossTime([picks, …]) Generalize across time and conditions.
decoding.PSDEstimator([sfreq, fmin, fmax, …]) Compute power spectrum density (PSD) using a multi-taper method.
decoding.Scaler([info, scalings, with_mean, …]) Standardize channel data.
decoding.TimeDecoding([picks, cv, clf, …]) Train and test a series of classifiers at each time point.
realtime.RtEpochs(client, event_id, tmin, tmax) Realtime Epochs.
realtime.RtClient(host[, cmd_port, …]) Realtime Client.
realtime.MockRtClient(raw[, verbose]) Mock Realtime Client.
realtime.FieldTripClient([info, host, port, …]) Realtime FieldTrip client.
realtime.StimServer([port, n_clients]) Stimulation Server.
realtime.StimClient(host[, port, timeout, …]) Stimulation Client.

Logging and Configuration

get_config_path([home_dir]) Get path to standard mne-python config file.
get_config([key, default, raise_error, home_dir]) 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.cuda:

init_cuda([ignore_config]) Initialize CUDA functionality.

Reading raw data

mne.io:

IO module for reading raw data.

Functions:

anonymize_info(info) Anonymize measurement information in place.
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_edf(input_fname[, montage, eog, …]) Reader function for EDF+, BDF conversion to FIF.
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.

KIT module for reading raw data.

mne.io.kit:

read_mrk(fname) Marker Point Extraction in MEG space directly from sqd.

File I/O

Functions:

decimate_surface(points, triangles, n_triangles) Decimate surface data.
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_events(filename[, include, exclude, …]) Read events from fif or text file.
read_evokeds(fname[, condition, baseline, …]) Read evoked dataset(s).
read_forward_solution(fname[, force_fixed, …]) 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 soure 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) Read a -trans.fif file.
read_tri(fname_in[, swap, verbose]) Read triangle definitions from an ascii file.
save_stc_as_volume(fname, stc, src[, dest, …]) Save a volume source estimate in a NIfTI 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.

Creating data objects from arrays

Classes:

mne:

EvokedArray(data, info[, tmin, comment, …]) Evoked object from numpy array.
EpochsArray(data, info[, events, tmin, …]) Epochs object from numpy array.

mne.io:

RawArray(data, info[, first_samp, verbose]) Raw object from numpy array.

Functions:

mne:

create_info(ch_names, sfreq[, ch_types, montage]) Create a basic Info instance suitable for use with create_raw.

Datasets

mne.datasets:

Functions for fetching remote datasets.

fetch_hcp_mmp_parcellation([subjects_dir, …]) Fetch the HCP-MMP parcellation.

mne.datasets.sample:

MNE sample dataset.

data_path([path, force_update, update_path, …]) Get path to local copy of sample dataset.

mne.datasets.brainstorm:

Brainstorm Dataset.

bst_auditory.data_path([path, force_update, …]) Get path to local copy of brainstorm (bst_auditory) dataset.
bst_resting.data_path([path, force_update, …]) Get path to local copy of brainstorm (bst_resting) dataset.
bst_raw.data_path([path, force_update, …]) Get path to local copy of brainstorm (bst_raw) dataset.

mne.datasets.megsim:

MEGSIM dataset.

data_path(url[, path, force_update, …]) Get path to local copy of MEGSIM dataset URL.
load_data([condition, data_format, …]) Get path to local copy of MEGSIM dataset type.

mne.datasets.spm_face:

SPM face dataset.

data_path([path, force_update, update_path, …]) Get path to local copy of spm dataset.

mne.datasets.eegbci:

EEG Motor Movement/Imagery Dataset.

load_data(subject, runs[, path, …]) Get paths to local copies of EEGBCI dataset files.

mne.datasets.somato:

Somatosensory dataset.

data_path([path, force_update, update_path, …]) Get path to local copy of somato dataset.

mne.datasets.multimodal:

Multimodal dataset.

data_path([path, force_update, update_path, …]) Get path to local copy of multimodal dataset.

mne.datasets.visual_92_categories:

MNE visual_92_categories dataset.

data_path([path, force_update, update_path, …]) Get path to local copy of visual_92_categories dataset.

Visualization

mne.viz:

Visualization routines.

Classes:

ClickableImage(imdata, **kwargs) Display an image so you can click on it and store x/y positions.

Functions:

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_dipole_amplitudes(dipoles[, colors, show]) Plot the amplitude traces of a set of dipoles.
plot_dipole_locations(dipoles, trans, subject) 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 butteryfly 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 multiple channels and conditions.
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 topogrpahy.
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[, 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[, tmin, tmax, fmin, fmax, …]) Plot the power spectral density across channels.
plot_sensors(info[, kind, ch_type, title, …]) Plot sensors positions.
plot_snr_estimate(evoked, inv[, show]) Plot a data SNR estimate.
plot_source_estimates(stc[, subject, …]) Plot SourceEstimates 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_trans(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.
show_fiff(fname[, indent, read_limit, …]) Show FIFF information.

Preprocessing

Projections:

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.
fix_stim_artifact(inst[, events, event_id, …]) Eliminate stimulation’s artifacts from instance.
make_eeg_average_ref_proj(info[, activate, …]) Create an EEG average reference SSP projection vector.

Manipulate channels and set sensors locations for processing and plotting:

Classes:

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.

Functions:

fix_mag_coil_types(info) Fix magnetometer coil types.
read_montage(kind[, ch_names, path, unit, …]) Read a generic (built-in) montage.
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.
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.

mne.preprocessing:

Preprocessing with artifact detection, SSP, and ICA.

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.
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.
maxwell_filter(raw[, origin, int_order, …]) Apply Maxwell filter to data using multipole moments.
read_ica(fname) 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) Rereference 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.

Head position estimation:

filter_chpi(raw[, include_line, verbose]) 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.
quat_to_rot(quat) Convert a set of quaternions to rotations.
rot_to_quat(rot) Convert a set of rotations to quaternions.

Events

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_events(filename[, include, exclude, …]) Read events from fif or text file.
write_events(filename, event_list) Write events to file.
concatenate_epochs(epochs_list) Concatenate a list of epochs into one epochs object.
define_target_events(events, reference_id, …) Define new events by co-occurrence of existing events.
add_channels_epochs(epochs_list[, name, …]) 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, events_list]) 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]) 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

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.
make_ad_hoc_cov(info[, 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.
regularize(cov, info[, mag, grad, eeg, …]) Regularize noise covariance matrix.

MRI Processing

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

gui.coregistration([tabbed, split, …]) 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([mne_root, fs_home, …]) 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

mne:

Functions:

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.
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[, force_fixed, …]) Read a forward solution a.k.a.
read_trans(fname) 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[, fname, …]) Set up bilateral hemisphere surface-based source space with subsampling.
setup_volume_source_space([subject, fname, …]) Set up a volume source space with grid spacing or discrete source space.
write_bem_surfaces(fname, surfs) Write BEM surfaces to a fiff file.
write_trans(fname, trans) Write a -trans.fif file.
fit_sphere_to_headshape(info[, dig_kinds, …]) Fit a sphere to the headshape points to determine head center.
get_fitting_dig(info[, dig_kinds, verbose]) 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.
restrict_forward_to_label(fwd, labels) Restrict forward operator to labels.
restrict_forward_to_stc(fwd, stc) Restrict forward operator to active sources in a source estimate.
Transform(fro, to[, trans]) A transform.
complete_surface_info(surf[, …]) Complete surface information.

Inverse Solutions

mne.minimum_norm:

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

Classes:

InverseOperator InverseOperator class to represent info from inverse operator.

Functions:

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 spectrum density (PSD).
compute_source_psd_epochs(epochs, …[, …]) Compute source power spectrum 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.
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.

mne.beamformer:

Beamformers for source localization.

lcmv(evoked, forward, noise_cov, data_cov[, …]) Linearly Constrained Minimum Variance (LCMV) beamformer.
lcmv_epochs(epochs, forward, noise_cov, data_cov) Linearly Constrained Minimum Variance (LCMV) beamformer.
lcmv_raw(raw, forward, noise_cov, data_cov) Linearly Constrained Minimum Variance (LCMV) beamformer.
dics(evoked, forward, noise_csd, data_csd[, …]) Dynamic Imaging of Coherent Sources (DICS).
dics_epochs(epochs, forward, noise_csd, data_csd) Dynamic Imaging of Coherent Sources (DICS).
dics_source_power(info, forward, noise_csds, …) Dynamic Imaging of Coherent Sources (DICS).
rap_music(evoked, forward, noise_cov[, …]) RAP-MUSIC source localization method.

mne:

Functions:

fit_dipole(evoked, cov, bem[, trans, …]) Fit a dipole.

mne.dipole:

Single-dipole functions and classes.

Functions:

get_phantom_dipoles([kind]) Get standard phantom dipole locations and orientations.

Source Space Data

compute_morph_matrix(subject_from, …[, …]) Get a matrix that morphs data from one subject to another.
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.
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.
morph_data(subject_from, subject_to, stc_from) Morph a source estimate from one subject to another.
morph_data_precomputed(subject_from, …) Morph source estimate between subjects using a precomputed matrix.
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 soure estimate object.
save_stc_as_volume(fname, stc, src[, dest, …]) Save a volume source estimate in a NIfTI 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.

Classes:

AverageTFR(info, data, times, freqs, nave[, …]) Container for Time-Frequency data.
EpochsTFR(info, data, times, freqs[, …]) Container for Time-Frequency data on epochs.

Functions that operate on mne-python objects:

csd_epochs(epochs[, mode, fmin, fmax, fsum, …]) Estimate cross-spectral density from epochs.
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.
fit_iir_model_raw(raw[, order, picks, tmin, …]) Fit an AR model to raw data and creates the corresponding IIR filter.
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.
tfr_array_morlet(epoch_data, sfreq, frequencies) Compute time-frequency transform using Morlet wavelets.
tfr_array_multitaper(epoch_data, sfreq, …) Compute time-frequency transforms using wavelets and multitaper windows.
tfr_array_stockwell(data, sfreq[, fmin, …]) Compute power and intertrial coherence using Stockwell (S) 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(X, sfreq[, mode, fmin, fmax, …]) Estimate cross-spectral density from an array.
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 spectrum density (PSD) using a multi-taper method.
psd_array_welch(x, sfreq[, fmin, fmax, …]) Compute power spectral density (PSD) using Welch’s method.

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:

Connectivity Analysis Tools.

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.
phase_slope_index(data[, indices, sfreq, …]) Compute the Phase Slope Index (PSI) connectivity measure.

Statistics

mne.stats:

Functions for statistical analysis.

bonferroni_correction(pval[, alpha]) P-value correction with Bonferroni method.
fdr_correction(pvals[, alpha, method]) P-value correction with False Discovery Rate (FDR).
permutation_cluster_test(X[, threshold, …]) Cluster-level statistical permutation test.
permutation_cluster_1samp_test(X[, …]) Non-parametric cluster-level 1 sample 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 1 sample T-test for spatio-temporal data.
ttest_1samp_no_p(X[, sigma, method]) Perform t-test with variance adjustment and no p-value calculation.
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.
f_oneway(*args) Call scipy.stats.f_oneway, but return only f-value.
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 thesholds for a two-way ANOVA.
summarize_clusters_stc(clu[, p_thresh, …]) Assemble summary SourceEstimate from spatiotemporal cluster results.

Functions to compute connectivity (adjacency) matrices for cluster-level statistics

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.

simulate_evoked(fwd, stc, info, cov[, snr, …]) Generate noisy evoked data.
simulate_raw(raw, 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.

Decoding

mne.decoding:

Decoding analysis utilities.

Classes:

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.
GeneralizationAcrossTime([picks, cv, clf, …]) Generalize across time and conditions.
LinearModel([model]) Compute and store patterns from linear models.
PSDEstimator([sfreq, fmin, fmax, bandwidth, …]) Compute power spectrum 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.
TimeDecoding([picks, cv, clf, times, …]) Train and test a series of classifiers at each time point.
TimeFrequency(frequencies[, 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.

Functions:

compute_ems(epochs[, conditions, picks, …]) Compute event-matched spatial filter on epochs.
get_coef(estimator[, attr, inverse_transform]) Retrieve the coefficients of an estimator ending with a Linear Model.

Realtime

mne.realtime:

Module for realtime MEG data using mne_rt_server.

Classes:

RtEpochs(client, event_id, tmin, tmax[, …]) Realtime Epochs.
RtClient(host[, cmd_port, data_port, …]) Realtime Client.
MockRtClient(raw[, verbose]) Mock Realtime Client.
FieldTripClient([info, host, port, …]) Realtime FieldTrip client.
StimServer([port, n_clients]) Stimulation Server.
StimClient(host[, port, timeout, verbose]) Stimulation Client.

MNE-Report

mne.report:

Generate html report from MNE database.

Classes:

Report([info_fname, subjects_dir, subject, …]) Object for rendering HTML.