mne.Evoked(fname, condition=None, proj=True, kind=’average’, allow_maxshield=False, verbose=None)[source]¶Evoked data.
| Parameters: | fname : string 
 condition : int, or str 
 proj : bool, optional 
 kind : str 
 allow_maxshield : bool | str (default False) 
 verbose : bool, str, int, or None 
  | 
|---|
Notes
Evoked objects contain a single condition only.
Attributes
ch_names | 
Channel names. | 
data | 
The data matrix. | 
| info | (dict) Measurement info. | 
| nave | (int) Number of averaged epochs. | 
| kind | (str) Type of data, either average or standard_error. | 
| first | (int) First time sample. | 
| last | (int) Last time sample. | 
| comment | (string) Comment on dataset. Can be the condition. | 
| times | (array) Array of time instants in seconds. | 
| verbose | (bool, str, int, or None.) See above. | 
Methods
__contains__(ch_type) | 
Check channel type membership. | 
__hash__() | 
Hash the object. | 
__neg__() | 
Negate channel responses. | 
add_channels(add_list[, force_update_info]) | 
Append new channels to the instance. | 
add_proj(projs[, remove_existing, verbose]) | 
Add SSP projection vectors. | 
animate_topomap([ch_type, times, …]) | 
Make animation of evoked data as topomap timeseries. | 
anonymize() | 
Anonymize measurement information in place. | 
apply_baseline([baseline, verbose]) | 
Baseline correct evoked data. | 
apply_proj() | 
Apply the signal space projection (SSP) operators to the data. | 
as_type([ch_type, mode]) | 
Compute virtual evoked using interpolated fields. | 
copy() | 
Copy the instance of evoked. | 
crop([tmin, tmax]) | 
Crop data to a given time interval. | 
decimate(decim[, offset]) | 
Decimate the evoked data. | 
del_proj([idx]) | 
Remove SSP projection vector. | 
detrend([order, picks]) | 
Detrend data. | 
drop_channels(ch_names) | 
Drop some channels. | 
get_peak([ch_type, tmin, tmax, mode, …]) | 
Get location and latency of peak amplitude. | 
interpolate_bads([reset_bads, mode]) | 
Interpolate bad MEG and EEG channels. | 
pick_channels(ch_names) | 
Pick some channels. | 
pick_types([meg, eeg, stim, eog, ecg, emg, …]) | 
Pick some channels by type and names. | 
plot([picks, exclude, unit, show, ylim, …]) | 
Plot evoked data using butteryfly plots. | 
plot_field(surf_maps[, time, time_label, n_jobs]) | 
Plot MEG/EEG fields on head surface and helmet in 3D. | 
plot_image([picks, exclude, unit, show, …]) | 
Plot evoked data as images. | 
plot_joint([times, title, picks, exclude, …]) | 
Plot evoked data as butterfly plot and add topomaps for time points. | 
plot_projs_topomap([ch_type, layout, axes]) | 
Plot SSP vector. | 
plot_sensors([kind, ch_type, title, …]) | 
Plot sensor positions. | 
plot_topo([layout, layout_scale, color, …]) | 
Plot 2D topography of evoked responses. | 
plot_topomap([times, ch_type, layout, vmin, …]) | 
Plot topographic maps of specific time points of evoked data. | 
plot_white(noise_cov[, show]) | 
Plot whitened evoked response. | 
rename_channels(mapping) | 
Rename channels. | 
resample(sfreq[, npad, window]) | 
Resample data. | 
save(fname) | 
Save dataset to file. | 
savgol_filter(h_freq[, copy]) | 
Filter the data using Savitzky-Golay polynomial method. | 
set_channel_types(mapping) | 
Define the sensor type of channels. | 
set_eeg_reference([ref_channels, verbose]) | 
Specify which reference to use for EEG data. | 
set_montage(montage[, verbose]) | 
Set EEG sensor configuration and head digitization. | 
shift_time(tshift[, relative]) | 
Shift time scale in evoked data. | 
time_as_index(times[, use_rounding]) | 
Convert time to indices. | 
to_data_frame([picks, index, scale_time, …]) | 
Export data in tabular structure as a pandas DataFrame. | 
__contains__(ch_type)[source]¶Check channel type membership.
| Parameters: | ch_type : str 
  | 
|---|---|
| Returns: | in : bool 
  | 
Examples
Channel type membership can be tested as:
>>> 'meg' in inst  
True
>>> 'seeg' in inst  
False
__neg__()[source]¶Negate channel responses.
| Returns: | evoked_neg : instance of Evoked 
  | 
|---|
add_channels(add_list, force_update_info=False)[source]¶Append new channels to the instance.
| Parameters: | add_list : list 
 force_update_info : bool 
  | 
|---|---|
| Returns: | inst : instance of Raw, Epochs, or Evoked 
  | 
add_proj(projs, remove_existing=False, verbose=None)[source]¶Add SSP projection vectors.
| Parameters: | projs : list 
 remove_existing : bool 
 verbose : bool, str, int, or None 
  | 
|---|---|
| Returns: | self : instance of Raw | Epochs | Evoked 
  | 
animate_topomap(ch_type=’mag’, times=None, frame_rate=None, butterfly=False, blit=True, show=True)[source]¶Make animation of evoked data as topomap timeseries.
The animation can be paused/resumed with left mouse button. Left and right arrow keys can be used to move backward or forward in time.
| Parameters: | ch_type : str | None 
 times : array of floats | None 
 frame_rate : int | None 
 butterfly : bool 
 blit : bool 
 show : bool 
  | 
|---|---|
| Returns: | fig : instance of matplotlib figure 
 anim : instance of matplotlib FuncAnimation 
  | 
Notes
New in version 0.12.0.
anonymize()[source]¶Anonymize measurement information in place.
Reset ‘subject_info’, ‘meas_date’, ‘file_id’, and ‘meas_id’ keys if they
exist in info.
| Returns: | info : instance of Info 
  | 
|---|
Notes
Operates in place.
New in version 0.13.0.
apply_baseline(baseline=(None, 0), verbose=None)[source]¶Baseline correct evoked data.
| Parameters: | baseline : tuple of length 2 
 verbose : bool, str, int, or None 
  | 
|---|---|
| Returns: | evoked : instance of Evoked 
  | 
Notes
Baseline correction can be done multiple times.
New in version 0.13.0.
apply_proj()[source]¶Apply the signal space projection (SSP) operators to the data.
| Returns: | self : instance of Raw | Epochs | Evoked 
  | 
|---|
Notes
Once the projectors have been applied, they can no longer be removed. It is usually not recommended to apply the projectors at too early stages, as they are applied automatically later on (e.g. when computing inverse solutions). Hint: using the copy method individual projection vectors can be tested without affecting the original data. With evoked data, consider the following example:
projs_a = mne.read_proj('proj_a.fif')
projs_b = mne.read_proj('proj_b.fif')
# add the first, copy, apply and see ...
evoked.add_proj(a).copy().apply_proj().plot()
# add the second, copy, apply and see ...
evoked.add_proj(b).copy().apply_proj().plot()
# drop the first and see again
evoked.copy().del_proj(0).apply_proj().plot()
evoked.apply_proj()  # finally keep both
as_type(ch_type=’grad’, mode=’fast’)[source]¶Compute virtual evoked using interpolated fields.
Warning
Using virtual evoked to compute inverse can yield unexpected results. The virtual channels have ‘_virtual’ appended at the end of the names to emphasize that the data contained in them are interpolated.
| Parameters: | ch_type : str 
 mode : str 
  | 
|---|---|
| Returns: | evoked : instance of mne.Evoked 
  | 
Notes
New in version 0.9.0.
ch_names¶Channel names.
compensation_grade¶The current gradient compensation grade.
crop(tmin=None, tmax=None)[source]¶Crop data to a given time interval.
| Parameters: | tmin : float | None 
 tmax : float | None 
  | 
|---|---|
| Returns: | evoked : instance of Evoked 
  | 
Notes
Unlike Python slices, MNE time intervals include both their end points; crop(tmin, tmax) returns the interval tmin <= t <= tmax.
data¶The data matrix.
decimate(decim, offset=0)[source]¶Decimate the evoked data.
Note
No filtering is performed. To avoid aliasing, ensure your data are properly lowpassed.
| Parameters: | decim : int 
 offset : int 
  | 
|---|---|
| Returns: | evoked : instance of Evoked 
  | 
See also
Notes
Decimation can be done multiple times. For example,
evoked.decimate(2).decimate(2) will be the same as
evoked.decimate(4).
New in version 0.13.0.
del_proj(idx=’all’)[source]¶Remove SSP projection vector.
| Parameters: | idx : int | list of int | str 
  | 
|---|---|
| Returns: | self : instance of Raw | Epochs | Evoked  | 
detrend(order=1, picks=None)[source]¶Detrend data.
This function operates in-place.
| Parameters: | order : int 
 picks : array-like of int | None 
  | 
|---|---|
| Returns: | evoked : instance of Evoked 
  | 
drop_channels(ch_names)[source]¶Drop some channels.
| Parameters: | ch_names : list 
  | 
|---|---|
| Returns: | inst : instance of Raw, Epochs, or Evoked 
  | 
See also
Notes
New in version 0.9.0.
get_peak(ch_type=None, tmin=None, tmax=None, mode=’abs’, time_as_index=False, merge_grads=False)[source]¶Get location and latency of peak amplitude.
| Parameters: | ch_type : ‘mag’, ‘grad’, ‘eeg’, ‘seeg’, ‘ecog’, ‘hbo’, hbr’, ‘misc’, None # noqa 
 tmin : float | None 
 tmax : float | None 
 mode : {‘pos’, ‘neg’, ‘abs’} 
 time_as_index : bool 
 merge_grads : bool 
  | 
|---|---|
| Returns: | ch_name : str 
 latency : float | int 
  | 
interpolate_bads(reset_bads=True, mode=’accurate’)[source]¶Interpolate bad MEG and EEG channels.
Operates in place.
| Parameters: | reset_bads : bool 
 mode : str 
  | 
|---|---|
| Returns: | inst : instance of Raw, Epochs, or Evoked 
  | 
Notes
New in version 0.9.0.
pick_channels(ch_names)[source]¶Pick some channels.
| Parameters: | ch_names : list 
  | 
|---|---|
| Returns: | inst : instance of Raw, Epochs, or Evoked 
  | 
See also
Notes
New in version 0.9.0.
pick_types(meg=True, eeg=False, stim=False, eog=False, ecg=False, emg=False, ref_meg=’auto’, misc=False, resp=False, chpi=False, exci=False, ias=False, syst=False, seeg=False, dipole=False, gof=False, bio=False, ecog=False, fnirs=False, include=[], exclude=’bads’, selection=None)[source]¶Pick some channels by type and names.
| Parameters: | meg : bool | str 
 eeg : bool 
 stim : bool 
 eog : bool 
 ecg : bool 
 emg : bool 
 ref_meg: bool | str 
 misc : bool 
 resp : bool 
 chpi : bool 
 exci : bool 
 ias : bool 
 syst : bool 
 seeg : bool 
 dipole : bool 
 gof : bool 
 bio : bool 
 ecog : bool 
 fnirs : bool | str 
 include : list of string 
 exclude : list of string | str 
 selection : list of string 
  | 
|---|---|
| Returns: | inst : instance of Raw, Epochs, or Evoked 
  | 
Notes
New in version 0.9.0.
plot(picks=None, exclude=’bads’, unit=True, show=True, ylim=None, xlim=’tight’, proj=False, hline=None, units=None, scalings=None, titles=None, axes=None, gfp=False, window_title=None, spatial_colors=False, zorder=’unsorted’, selectable=True)[source]¶Plot evoked data using butteryfly plots.
Left click to a line shows the channel name. Selecting an area by clicking and holding left mouse button plots a topographic map of the painted area.
Note
If bad channels are not excluded they are shown in red.
| Parameters: | picks : array-like of int | None 
 exclude : list of str | ‘bads’ 
 unit : bool 
 show : bool 
 ylim : dict | None 
 xlim : ‘tight’ | tuple | None 
 proj : bool | ‘interactive’ 
 hline : list of floats | None 
 units : dict | None 
 scalings : dict | None 
 titles : dict | None 
 axes : instance of Axis | list | None 
 gfp : bool | ‘only’ 
 window_title : str | None 
 spatial_colors : bool 
 zorder : str | callable 
 selectable : bool 
  | 
|---|---|
| Returns: | fig : instance of matplotlib.figure.Figure 
  | 
plot_field(surf_maps, time=None, time_label=’t = %0.0f ms’, n_jobs=1)[source]¶Plot MEG/EEG fields on head surface and helmet in 3D.
| Parameters: | surf_maps : list 
 time : float | None 
 time_label : str 
 n_jobs : int 
  | 
|---|---|
| Returns: | fig : instance of mlab.Figure 
  | 
plot_image(picks=None, exclude=’bads’, unit=True, show=True, clim=None, xlim=’tight’, proj=False, units=None, scalings=None, titles=None, axes=None, cmap=’RdBu_r’)[source]¶Plot evoked data as images.
| Parameters: | picks : array-like of int | None 
 exclude : list of str | ‘bads’ 
 unit : bool 
 show : bool 
 clim : dict | None 
 xlim : ‘tight’ | tuple | None 
 proj : bool | ‘interactive’ 
 units : dict | None 
 scalings : dict | None 
 titles : dict | None 
 axes : instance of Axis | list | None 
 cmap : matplotlib colormap | (colormap, bool) | ‘interactive’ 
  | 
|---|---|
| Returns: | fig : instance of matplotlib.figure.Figure 
  | 
plot_joint(times=’peaks’, title=”, picks=None, exclude=’bads’, show=True, ts_args=None, topomap_args=None)[source]¶Plot evoked data as butterfly plot and add topomaps for time points.
| Parameters: | times : float | array of floats | “auto” | “peaks”. 
 title : str | None 
 picks : array-like of int | None 
 exclude : None | list of str | ‘bads’ 
 show : bool 
 ts_args : None | dict 
 topomap_args : None | dict 
  | 
|---|---|
| Returns: | fig : instance of matplotlib.figure.Figure | list 
  | 
Notes
New in version 0.12.0.
plot_projs_topomap(ch_type=None, layout=None, axes=None)[source]¶Plot SSP vector.
| Parameters: | ch_type : ‘mag’ | ‘grad’ | ‘planar1’ | ‘planar2’ | ‘eeg’ | None | List 
 layout : None | Layout | List of Layouts 
 axes : instance of Axes | list | None 
  | 
|---|---|
| Returns: | fig : instance of matplotlib figure 
  | 
plot_sensors(kind=’topomap’, ch_type=None, title=None, show_names=False, ch_groups=None, to_sphere=True, axes=None, block=False, show=True)[source]¶Plot sensor positions.
| Parameters: | kind : str 
 ch_type : None | str 
 title : str | None 
 show_names : bool 
 ch_groups : ‘position’ | array of shape (ch_groups, picks) | None 
 to_sphere : bool 
 axes : instance of Axes | instance of Axes3D | None 
 block : bool 
 show : bool 
  | 
|---|---|
| Returns: | fig : instance of matplotlib figure 
 selection : list 
  | 
See also
Notes
This function plots the sensor locations from the info structure using
matplotlib. For drawing the sensors using mayavi see
mne.viz.plot_trans().
New in version 0.12.0.
plot_topo(layout=None, layout_scale=0.945, color=None, border=’none’, ylim=None, scalings=None, title=None, proj=False, vline=[0.0], fig_facecolor=’k’, fig_background=None, axis_facecolor=’k’, font_color=’w’, merge_grads=False, legend=True, show=True)[source]¶Plot 2D topography of evoked responses.
Clicking on the plot of an individual sensor opens a new figure showing the evoked response for the selected sensor.
| Parameters: | layout : instance of Layout | None 
 layout_scale: float 
 color : list of color objects | color object | None 
 border : str 
 ylim : dict | None 
 scalings : dict | None 
 title : str 
 proj : bool | ‘interactive’ 
 vline : list of floats | None 
 fig_facecolor : str | obj 
 fig_background : None | numpy ndarray 
 axis_facecolor : str | obj 
 font_color : str | obj 
 merge_grads : bool 
 legend : bool | int | string | tuple 
 show : bool 
  | 
|---|---|
| Returns: | fig : instance of matplotlib.figure.Figure 
  | 
Notes
New in version 0.10.0.
plot_topomap(times=’auto’, ch_type=None, layout=None, vmin=None, vmax=None, cmap=None, sensors=True, colorbar=True, scale=None, scale_time=1000.0, unit=None, res=64, size=1, cbar_fmt=’%3.1f’, time_format=’%01d ms’, proj=False, show=True, show_names=False, title=None, mask=None, mask_params=None, outlines=’head’, contours=6, image_interp=’bilinear’, average=None, head_pos=None, axes=None)[source]¶Plot topographic maps of specific time points of evoked data.
| Parameters: | times : float | array of floats | “auto” | “peaks”. 
 ch_type : ‘mag’ | ‘grad’ | ‘planar1’ | ‘planar2’ | ‘eeg’ | None 
 layout : None | Layout 
 vmin : float | callable | None 
 vmax : float | callable | None 
 cmap : matplotlib colormap | (colormap, bool) | ‘interactive’ | None 
 sensors : bool | str 
 colorbar : bool 
 scale : dict | float | None 
 scale_time : float | None 
 unit : dict | str | None 
 res : int 
 size : float 
 cbar_fmt : str 
 time_format : str 
 proj : bool | ‘interactive’ 
 show : bool 
 show_names : bool | callable 
 title : str | None 
 mask : ndarray of bool, shape (n_channels, n_times) | None 
 mask_params : dict | None 
 outlines : ‘head’ | ‘skirt’ | dict | None 
 contours : int | False | array of float | None 
 image_interp : str 
 average : float | None 
 head_pos : dict | None 
 axes : instance of Axes | list | None 
  | 
|---|---|
| Returns: | fig : instance of matplotlib.figure.Figure 
  | 
plot_white(noise_cov, show=True)[source]¶Plot whitened evoked response.
Plots the whitened evoked response and the whitened GFP as described in [R7]. If one single covariance object is passed, the GFP panel (bottom) will depict different sensor types. If multiple covariance objects are passed as a list, the left column will display the whitened evoked responses for each channel based on the whitener from the noise covariance that has the highest log-likelihood. The left column will depict the whitened GFPs based on each estimator separately for each sensor type. Instead of numbers of channels the GFP display shows the estimated rank. The rank estimation will be printed by the logger for each noise covariance estimator that is passed.
| Parameters: | noise_cov : list | instance of Covariance | str 
 show : bool 
  | 
|---|---|
| Returns: | fig : instance of matplotlib.figure.Figure 
  | 
Notes
New in version 0.9.0.
References
| [R7] | (1, 2) Engemann D. and Gramfort A. (2015) Automated model selection in covariance estimation and spatial whitening of MEG and EEG signals, vol. 108, 328-342, NeuroImage. | 
proj¶Whether or not projections are active.
rename_channels(mapping)[source]¶Rename channels.
| Parameters: | mapping : dict | callable 
  | 
|---|
Notes
New in version 0.9.0.
resample(sfreq, npad=’auto’, window=’boxcar’)[source]¶Resample data.
This function operates in-place.
| Parameters: | sfreq : float 
 npad : int | str 
 window : string or tuple 
  | 
|---|---|
| Returns: | evoked : instance of mne.Evoked 
  | 
save(fname)[source]¶Save dataset to file.
| Parameters: | fname : string 
  | 
|---|
Notes
To write multiple conditions into a single file, use
mne.write_evokeds().
savgol_filter(h_freq, copy=False)[source]¶Filter the data using Savitzky-Golay polynomial method.
| Parameters: | h_freq : float 
 copy : bool 
  | 
|---|---|
| Returns: | inst : instance of Epochs or Evoked 
  | 
See also
Notes
For Savitzky-Golay low-pass approximation, see:
New in version 0.9.0.
References
| [R8] | (1, 2) Savitzky, A., Golay, M.J.E. (1964). “Smoothing and Differentiation of Data by Simplified Least Squares Procedures”. Analytical Chemistry 36 (8): 1627-39. | 
Examples
>>> import mne
>>> from os import path as op
>>> evoked_fname = op.join(mne.datasets.sample.data_path(), 'MEG', 'sample', 'sample_audvis-ave.fif')  
>>> evoked = mne.read_evokeds(evoked_fname, baseline=(None, 0))[0]  
>>> evoked.savgol_filter(10.)  # low-pass at around 10 Hz 
>>> evoked.plot()  
set_channel_types(mapping)[source]¶Define the sensor type of channels.
| Parameters: | mapping : dict 
  | 
|---|
Notes
New in version 0.9.0.
set_eeg_reference(ref_channels=None, verbose=None)[source]¶Specify which reference to use for EEG data.
By default, MNE-Python will automatically re-reference the EEG signal to use an average reference (see below). Use this function to explicitly specify the desired reference for EEG. This can be either an existing electrode or a new virtual channel. This function will re-reference the data according to the desired reference and prevent MNE-Python from automatically adding an average reference.
Some common referencing schemes and the corresponding value for the
ref_channels parameter:
ref_channels=[]. This will prevent MNE-Python from
automatically re-referencing the data to an average reference.ref_channels=None.ref_channels to the name of the channel that will act as
the new reference.ref_channels to a list of channel names,
indicating which channels to use. For example, to apply an average
mastoid reference, when using the 10-20 naming scheme, set
ref_channels=['M1', 'M2'].| Parameters: | ref_channels : list of str | None 
 verbose : bool, str, int, or None 
  | 
|---|---|
| Returns: | inst : instance of Raw | Epochs | Evoked 
  | 
See also
Notes
apply_proj() method to apply
them.New in version 0.13.0.
set_montage(montage, verbose=None)[source]¶Set EEG sensor configuration and head digitization.
| Parameters: | montage : instance of Montage or DigMontage 
 verbose : bool, str, int, or None 
  | 
|---|
Notes
Operates in place.
New in version 0.9.0.
shift_time(tshift, relative=True)[source]¶Shift time scale in evoked data.
| Parameters: | tshift : float 
 relative : bool 
  | 
|---|
Notes
Maximum accuracy of time shift is 1 / evoked.info[‘sfreq’]
time_as_index(times, use_rounding=False)[source]¶Convert time to indices.
| Parameters: | times : list-like | float | int 
 use_rounding : boolean 
  | 
|---|---|
| Returns: | index : ndarray 
  | 
to_data_frame(picks=None, index=None, scale_time=1000.0, scalings=None, copy=True, start=None, stop=None)[source]¶Export data in tabular structure as a pandas DataFrame.
Columns and indices will depend on the object being converted. Generally this will include as much relevant information as possible for the data type being converted. This makes it easy to convert data for use in packages that utilize dataframes, such as statsmodels or seaborn.
| Parameters: | picks : array-like of int | None 
 index : tuple of str | None 
 scale_time : float 
 scalings : dict | None 
 copy : bool 
 start : int | None 
 stop : int | None 
  | 
|---|---|
| Returns: | df : instance of pandas.core.DataFrame 
  |