mne.
EvokedArray
(data, info, tmin, comment='', nave=1, kind='average', verbose=None)¶Evoked object from numpy array
Parameters: | data : array of shape (n_channels, n_times)
info : instance of Info
tmin : float
comment : string
nave : int
kind : str
verbose : bool, str, int, or None
|
---|
See also
Attributes
ch_names |
Channel names |
compensation_grade |
The current gradient compensation grade |
proj |
Methods
__add__ (\*args, \*\*kwargs) |
Warning DEPRECATED: ev1 + ev2 weighted summation has been deprecated and will be removed in 0.14, use combine_evoked([ev1, ev2],weights=”nave”) instead |
__contains__ (ch_type) |
Check channel type membership |
__hash__ () |
Hash the object |
__neg__ () |
Negate channel responses |
__sub__ (\*args, \*\*kwargs) |
Warning DEPRECATED: ev1 - ev2 weighted subtraction has been deprecated and will be removed in 0.14, use combine_evoked([ev1, -ev2], weights=”nave”) instead |
add_channels (add_list[, force_update_info]) |
Append new channels to the instance. |
add_eeg_average_proj (\*args, \*\*kwargs) |
Warning DEPRECATED: This function is deprecated and will be removed in 0.14. Use set_eeg_reference() instead. |
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 in mag/grad channels. |
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 selected time points. |
plot_projs_topomap ([ch_type, layout, axes]) |
Plot SSP vector |
plot_sensors ([kind, ch_type, title, ...]) |
Plot sensors 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]) |
Rereference EEG channels to new reference channel(s). |
set_montage (montage[, verbose]) |
Set EEG sensor configuration |
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. |
__add__
(*args, **kwargs)¶Warning
DEPRECATED: ev1 + ev2 weighted summation has been deprecated and will be removed in 0.14, use combine_evoked([ev1, ev2],weights=”nave”) instead
Add evoked taking into account number of epochs
The addition will be performed by weighting each Evoked instance by the number of averages.
__contains__
(ch_type)¶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
__hash__
()¶Hash the object
Returns: | hash : int
|
---|
__neg__
()¶Negate channel responses
Returns: | evoked_neg : instance of Evoked
|
---|
__sub__
(*args, **kwargs)¶Warning
DEPRECATED: ev1 - ev2 weighted subtraction has been deprecated and will be removed in 0.14, use combine_evoked([ev1, -ev2], weights=”nave”) instead
Subtract evoked taking into account number of epochs
The subtraction will be performed by weighting each Evoked instance by the number of averages.
add_channels
(add_list, force_update_info=False)¶Append new channels to the instance.
Parameters: | add_list : list
force_update_info : bool
|
---|---|
Returns: | inst : instance of Raw, Epochs, or Evoked
|
add_eeg_average_proj
(*args, **kwargs)¶Warning
DEPRECATED: This function is deprecated and will be removed in 0.14. Use set_eeg_reference() instead.
Add an average EEG reference projector if one does not exist.
add_proj
(projs, remove_existing=False, verbose=None)¶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)¶Make animation of evoked data as topomap timeseries. 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
()¶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)¶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
()¶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')¶Compute virtual evoked using interpolated fields in mag/grad channels.
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
copy
()¶Copy the instance of evoked
Returns: | evoked : instance of Evoked |
---|
crop
(tmin=None, tmax=None)¶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.
decimate
(decim, offset=0)¶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
Epochs.decimate
, Epochs.resample
, Raw.resample
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)¶Remove SSP projection vector
Parameters: | idx : int
|
---|---|
Returns: | self : instance of Raw | Epochs | Evoked |
detrend
(order=1, picks=None)¶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)¶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)¶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
|
---|---|
Returns: | ch_name : str
latency : float | int
|
interpolate_bads
(reset_bads=True, mode='accurate')¶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)¶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)¶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)¶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)¶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')¶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)¶Plot evoked data as butterfly plot and add topomaps for selected 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)¶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, axes=None, block=False, show=True)¶Plot sensors positions.
Parameters: | kind : str
ch_type : None | str
title : str | None
show_names : bool
ch_groups : ‘position’ | array of shape (ch_groups, picks) | None
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, show=True)¶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
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)¶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 | 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)¶Plot whitened evoked response
Plots the whitened evoked response and the whitened GFP as described in [R9]. 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
[R9] | (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. |
rename_channels
(mapping)¶Rename channels.
Parameters: | mapping : dict | callable
|
---|
Notes
New in version 0.9.0.
resample
(sfreq, npad='auto', window='boxcar')¶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)¶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)¶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
[R10] | (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)¶Define the sensor type of channels.
Parameters: | mapping : dict
|
---|
Notes
New in version 0.9.0.
set_eeg_reference
(ref_channels=None)¶Rereference EEG channels to new reference channel(s).
If multiple reference channels are specified, they will be averaged. If no reference channels are specified, an average reference will be applied.
Parameters: | ref_channels : list of str | None
|
---|---|
Returns: | inst : instance of Raw | Epochs | Evoked
|
See also
Notes
New in version 0.13.0.
set_montage
(montage, verbose=None)¶Set EEG sensor configuration
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)¶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)¶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)¶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
|