mne.
Evoked
(fname, condition=None, baseline=None, proj=True, kind='average', verbose=None)¶Evoked data
Parameters: | fname : string
condition : int, or str
baseline : tuple or list of length 2, or None
proj : bool, optional
kind : str
verbose : bool, str, int, or None
|
---|---|
Attributes: | info : dict
ch_names : list of string
nave : int
kind : str
first : int
last : int
comment : string
times : array
data : array of shape (n_channels, n_times)
verbose : bool, str, int, or None.
|
Methods
add_channels (add_list[, copy]) |
Append new channels to the instance. |
add_eeg_average_proj () |
Add an average EEG reference projector if one does not exist |
add_proj (projs[, remove_existing]) |
Add SSP projection vectors |
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, copy]) |
Crop data to a given time interval |
del_proj (idx) |
Remove SSP projection vector |
detrend ([order, picks]) |
Detrend data |
drop_channels (ch_names[, copy]) |
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[, copy]) |
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 as butterfly 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_projs_topomap ([ch_type, layout, axes]) |
Plot SSP vector |
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 |
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) |
Filter the data using Savitzky-Golay polynomial method |
set_channel_types (mapping) |
Define the sensor type of channels. |
set_montage (montage) |
Set EEG sensor configuration |
shift_time (tshift[, relative]) |
Shift time scale in evoked data |
to_data_frame ([picks, index, scale_time, ...]) |
Export data in tabular structure as a pandas DataFrame. |
__init__
(fname, condition=None, baseline=None, proj=True, kind='average', verbose=None)¶add_channels
(add_list, copy=False)¶Append new channels to the instance.
Parameters: | add_list : list
copy : bool
|
---|---|
Returns: | out : MNE object of type(self)
|
add_eeg_average_proj
()¶Add an average EEG reference projector if one does not exist
add_proj
(projs, remove_existing=False)¶Add SSP projection vectors
Parameters: | projs : list
remove_existing : bool
|
---|---|
Returns: | self : instance of Raw | Epochs | Evoked
|
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
copy
()¶Copy the instance of evoked
Returns: | evoked : instance of Evoked |
---|
crop
(tmin=None, tmax=None, copy=False)¶Crop data to a given time interval
Parameters: | tmin : float | None
tmax : float | None
copy : bool
|
---|
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
|
---|
drop_channels
(ch_names, copy=False)¶Drop some channels
Parameters: | ch_names : list
copy : bool
|
---|
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’, ‘misc’, None}
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: | self : mne.io.Raw, mne.Epochs or mne.Evoked
|
Notes
New in version 0.9.0.
pick_channels
(ch_names, copy=False)¶Pick some channels
Parameters: | ch_names : list
copy : bool
|
---|
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, include=[], exclude='bads', selection=None, copy=False)¶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
include : list of string
exclude : list of string | str
selection : list of string
copy : bool
|
---|
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)¶Plot evoked data as butterfly 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
xlim : ‘tight’ | tuple | None
proj : bool | ‘interactive’
hline : list of floats | None
units : dict | None
scalings : dict | None
titles : dict | None
axes : instance of Axes | list | None
gfp : bool | ‘only’
window_title : str | None
spatial_colors : bool
|
---|
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
xlim : ‘tight’ | tuple | None
proj : bool | ‘interactive’
units : dict | None
scalings : dict | None
titles : dict | None
axes : instance of Axes | list | None
cmap : matplotlib colormap
|
---|
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_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', 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
show : bool
|
---|---|
Returns: | fig : Instance of matplotlib.figure.Figure
.. versionadded:: 0.10.0 : |
plot_topomap
(times='auto', ch_type=None, layout=None, vmin=None, vmax=None, cmap='RdBu_r', 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
Parameters: | times : float | array of floats | “auto” | “peaks”.
ch_type : ‘mag’ | ‘grad’ | ‘planar1’ | ‘planar2’ | ‘eeg’ | None
layout : None | Layout
vmin : float | callable
vmax : float | callable
cmap : matplotlib colormap
sensors : bool | str
colorbar : bool
scale : dict | float | None
scale_time : float | None
unit : dict | str | None
res : int
size : scalar
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
|
---|
plot_white
(noise_cov, show=True)¶Plot whitened evoked response
Plots the whitened evoked response and the whitened GFP as described in [R5]. 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
[R5] | (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=100, window='boxcar')¶Resample data
This function operates in-place.
Parameters: | sfreq : float
npad : int
window : string or tuple
|
---|
save
(fname)¶Save dataset to file.
Parameters: | fname : string
|
---|
savgol_filter
(h_freq)¶Filter the data using Savitzky-Golay polynomial method
Parameters: | h_freq : float
|
---|
See also
mne.io.Raw.filter
Notes
Data are modified in-place.
For Savitzky-Golay low-pass approximation, see:
New in version 0.9.0.
References
[R6] | (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_montage
(montage)¶Set EEG sensor configuration
Parameters: | montage : instance of Montage or DigMontage |
---|
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’]
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
|