mne.Evoked

class mne.Evoked(fname, condition=None, baseline=None, proj=True, kind='average', verbose=None)

Evoked data

Parameters:

fname : string

Name of evoked/average FIF file to load. If None no data is loaded.

condition : int, or str

Dataset ID number (int) or comment/name (str). Optional if there is only one data set in file.

baseline : tuple or list of length 2, or None

The time interval to apply rescaling / baseline correction. If None do not apply it. If baseline is (a, b) the interval is between “a (s)” and “b (s)”. If a is None the beginning of the data is used and if b is None then b is set to the end of the interval. If baseline is equal ot (None, None) all the time interval is used. If None, no correction is applied.

proj : bool, optional

Apply SSP projection vectors

kind : str

Either ‘average’ or ‘standard_error’. The type of data to read. Only used if ‘condition’ is a str.

verbose : bool, str, int, or None

If not None, override default verbose level (see mne.verbose).

Attributes:

info : dict

Measurement info.

ch_names : list of string

List of channels’ names.

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.

data : array of shape (n_channels, n_times)

Evoked response.

verbose : bool, str, int, or None.

See above.

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

A list of objects to append to self. Must contain all the same type as the current object

copy : bool

Whether to return a new instance or modify in place

Returns:

out : MNE object of type(self)

An object with new channels appended (will be the same object if copy==False)

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

List with projection vectors.

remove_existing : bool

Remove the projection vectors currently in the file.

Returns:

self : instance of Raw | Epochs | Evoked

The data container.

apply_proj()

Apply the signal space projection (SSP) operators to the data.

Returns:

self : instance of Raw | Epochs | Evoked

The instance.

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

The destination channel type. It can be ‘mag’ or ‘grad’.

mode : str

Either ‘accurate’ or ‘fast’, determines the quality of the Legendre polynomial expansion used. ‘fast’ should be sufficient for most applications.

Returns:

evoked : instance of mne.Evoked

The transformed evoked object containing only virtual channels.

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

Start time of selection in seconds.

tmax : float | None

End time of selection in seconds.

copy : bool

If False epochs is cropped in place.

del_proj(idx)

Remove SSP projection vector

Note: The projection vector can only be removed if it is inactive
(has not been applied to the data).
Parameters:

idx : int

Index of the projector to remove.

Returns:

self : instance of Raw | Epochs | Evoked

detrend(order=1, picks=None)

Detrend data

This function operates in-place.

Parameters:

order : int

Either 0 or 1, the order of the detrending. 0 is a constant (DC) detrend, 1 is a linear detrend.

picks : array-like of int | None

If None only MEG, EEG and SEEG channels are detrended.

drop_channels(ch_names, copy=False)

Drop some channels

Parameters:

ch_names : list

The list of channels to remove.

copy : bool

If True, returns new instance. Else, modifies in place. Defaults to False.

See also

pick_channels

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}

The channel type to use. Defaults to None. If more than one sensor Type is present in the data the channel type has to be explicitly set.

tmin : float | None

The minimum point in time to be considered for peak getting. If None (default), the beginning of the data is used.

tmax : float | None

The maximum point in time to be considered for peak getting. If None (default), the end of the data is used.

mode : {‘pos’, ‘neg’, ‘abs’}

How to deal with the sign of the data. If ‘pos’ only positive values will be considered. If ‘neg’ only negative values will be considered. If ‘abs’ absolute values will be considered. Defaults to ‘abs’.

time_as_index : bool

Whether to return the time index instead of the latency in seconds.

Returns:

ch_name : str

The channel exhibiting the maximum response.

latency : float | int

The time point of the maximum response, either latency in seconds or index.

interpolate_bads(reset_bads=True, mode='accurate')

Interpolate bad MEG and EEG channels.

Operates in place.

Parameters:

reset_bads : bool

If True, remove the bads from info.

mode : str

Either ‘accurate’ or ‘fast’, determines the quality of the Legendre polynomial expansion used for interpolation of MEG channels.

Returns:

self : mne.io.Raw, mne.Epochs or mne.Evoked

The interpolated data.

Notes

New in version 0.9.0.

pick_channels(ch_names, copy=False)

Pick some channels

Parameters:

ch_names : list

The list of channels to select.

copy : bool

If True, returns new instance. Else, modifies in place. Defaults to False.

See also

drop_channels

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

If True include all MEG channels. If False include None If string it can be ‘mag’, ‘grad’, ‘planar1’ or ‘planar2’ to select only magnetometers, all gradiometers, or a specific type of gradiometer.

eeg : bool

If True include EEG channels.

stim : bool

If True include stimulus channels.

eog : bool

If True include EOG channels.

ecg : bool

If True include ECG channels.

emg : bool

If True include EMG channels.

ref_meg: bool | str :

If True include CTF / 4D reference channels. If ‘auto’, the reference channels are only included if compensations are present.

misc : bool

If True include miscellaneous analog channels.

resp : bool

If True include response-trigger channel. For some MEG systems this is separate from the stim channel.

chpi : bool

If True include continuous HPI coil channels.

exci : bool

Flux excitation channel used to be a stimulus channel.

ias : bool

Internal Active Shielding data (maybe on Triux only).

syst : bool

System status channel information (on Triux systems only).

seeg : bool

Stereotactic EEG channels.

include : list of string

List of additional channels to include. If empty do not include any.

exclude : list of string | str

List of channels to exclude. If ‘bads’ (default), exclude channels in info['bads'].

selection : list of string

Restrict sensor channels (MEG, EEG) to this list of channel names.

copy : bool

If True, returns new instance. Else, modifies in place. Defaults to False.

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

The indices of channels to plot. If None show all.

exclude : list of str | ‘bads’

Channels names to exclude from being shown. If ‘bads’, the bad channels are excluded.

unit : bool

Scale plot with channel (SI) unit.

show : bool

Call pyplot.show() at the end or not.

ylim : dict

ylim for plots. e.g. ylim = dict(eeg=[-200e-6, 200e-6]) Valid keys are eeg, mag, grad

xlim : ‘tight’ | tuple | None

xlim for plots.

proj : bool | ‘interactive’

If true SSP projections are applied before display. If ‘interactive’, a check box for reversible selection of SSP projection vectors will be shown.

hline : list of floats | None

The values at which show an horizontal line.

units : dict | None

The units of the channel types used for axes lables. If None, defaults to dict(eeg=’uV’, grad=’fT/cm’, mag=’fT’).

scalings : dict | None

The scalings of the channel types to be applied for plotting. If None, defaults to dict(eeg=1e6, grad=1e13, mag=1e15).

titles : dict | None

The titles associated with the channels. If None, defaults to dict(eeg=’EEG’, grad=’Gradiometers’, mag=’Magnetometers’).

axes : instance of Axes | list | None

The axes to plot to. If list, the list must be a list of Axes of the same length as the number of channel types. If instance of Axes, there must be only one channel type plotted.

gfp : bool | ‘only’

Plot GFP in green if True or “only”. If “only”, then the individual channel traces will not be shown.

window_title : str | None

The title to put at the top of the figure window.

spatial_colors : bool

If True, the lines are color coded by mapping physical sensor coordinates into color values. Spatially similar channels will have similar colors. Bad channels will be dotted. If False, the good channels are plotted black and bad channels red. Defaults to False.

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

The surface mapping information obtained with make_field_map.

time : float | None

The time point at which the field map shall be displayed. If None, the average peak latency (across sensor types) is used.

time_label : str

How to print info about the time instant visualized.

n_jobs : int

Number of jobs to run in parallel.

Returns:

fig : instance of mlab.Figure

The mayavi 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

The indices of channels to plot. If None show all.

exclude : list of str | ‘bads’

Channels names to exclude from being shown. If ‘bads’, the bad channels are excluded.

unit : bool

Scale plot with channel (SI) unit.

show : bool

Call pyplot.show() at the end or not.

clim : dict

clim for images. e.g. clim = dict(eeg=[-200e-6, 200e6]) Valid keys are eeg, mag, grad

xlim : ‘tight’ | tuple | None

xlim for plots.

proj : bool | ‘interactive’

If true SSP projections are applied before display. If ‘interactive’, a check box for reversible selection of SSP projection vectors will be shown.

units : dict | None

The units of the channel types used for axes lables. If None, defaults to dict(eeg=’uV’, grad=’fT/cm’, mag=’fT’).

scalings : dict | None

The scalings of the channel types to be applied for plotting. If None, defaults to dict(eeg=1e6, grad=1e13, mag=1e15).

titles : dict | None

The titles associated with the channels. If None, defaults to dict(eeg=’EEG’, grad=’Gradiometers’, mag=’Magnetometers’).

axes : instance of Axes | list | None

The axes to plot to. If list, the list must be a list of Axes of the same length as the number of channel types. If instance of Axes, there must be only one channel type plotted.

cmap : matplotlib colormap

Colormap.

plot_projs_topomap(ch_type=None, layout=None, axes=None)

Plot SSP vector

Parameters:

ch_type : ‘mag’ | ‘grad’ | ‘planar1’ | ‘planar2’ | ‘eeg’ | None | List

The channel type to plot. For ‘grad’, the gradiometers are collec- ted in pairs and the RMS for each pair is plotted. If None (default), it will return all channel types present. If a list of ch_types is provided, it will return multiple figures.

layout : None | Layout | List of Layouts

Layout instance specifying sensor positions (does not need to be specified for Neuromag data). If possible, the correct layout file is inferred from the data; if no appropriate layout file was found, the layout is automatically generated from the sensor locations. Or a list of Layout if projections are from different sensor types.

axes : instance of Axes | list | None

The axes to plot to. If list, the list must be a list of Axes of the same length as the number of projectors. If instance of Axes, there must be only one projector. Defaults to None.

Returns:

fig : instance of matplotlib figure

Figure distributing one image per channel across sensor topography.

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 instance specifying sensor positions (does not need to be specified for Neuromag data). If possible, the correct layout is inferred from the data.

layout_scale: float :

Scaling factor for adjusting the relative size of the layout on the canvas

color : list of color objects | color object | None

Everything matplotlib accepts to specify colors. If not list-like, the color specified will be repeated. If None, colors are automatically drawn.

border : str

matplotlib borders style to be used for each sensor plot.

ylim : dict | None

ylim for plots. The value determines the upper and lower subplot limits. e.g. ylim = dict(eeg=[-200e-6, 200e6]). Valid keys are eeg, mag, grad, misc. If None, the ylim parameter for each channel is determined by the maximum absolute peak.

scalings : dict | None

The scalings of the channel types to be applied for plotting. If None, defaults to dict(eeg=1e6, grad=1e13, mag=1e15).

title : str

Title of the figure.

proj : bool | ‘interactive’

If true SSP projections are applied before display. If ‘interactive’, a check box for reversible selection of SSP projection vectors will be shown.

vline : list of floats | None

The values at which to show a vertical line.

fig_facecolor : str | obj

The figure face color. Defaults to black.

fig_background : None | numpy ndarray

A background image for the figure. This must work with a call to plt.imshow. Defaults to None.

axis_facecolor : str | obj

The face color to be used for each sensor plot. Defaults to black.

font_color : str | obj

The color of text in the colorbar and title. Defaults to white.

show : bool

Show figure if True.

Returns:

fig : Instance of matplotlib.figure.Figure

Images of evoked responses at sensor locations

.. 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”.

The time point(s) to plot. If “auto”, the number of axes determines the amount of time point(s). If axes is also None, 10 topographies will be shown with a regular time spacing between the first and last time instant. If “peaks”, finds time points automatically by checking for local maxima in Global Field Power.

ch_type : ‘mag’ | ‘grad’ | ‘planar1’ | ‘planar2’ | ‘eeg’ | None

The channel type to plot. For ‘grad’, the gradiometers are collec- ted in pairs and the RMS for each pair is plotted. If None, then channels are chosen in the order given above.

layout : None | Layout

Layout instance specifying sensor positions (does not need to be specified for Neuromag data). If possible, the correct layout file is inferred from the data; if no appropriate layout file was found, the layout is automatically generated from the sensor locations.

vmin : float | callable

The value specfying the lower bound of the color range. If None, and vmax is None, -vmax is used. Else np.min(data). If callable, the output equals vmin(data).

vmax : float | callable

The value specfying the upper bound of the color range. If None, the maximum absolute value is used. If vmin is None, but vmax is not, defaults to np.max(data). If callable, the output equals vmax(data).

cmap : matplotlib colormap

Colormap. Defaults to ‘RdBu_r’.

sensors : bool | str

Add markers for sensor locations to the plot. Accepts matplotlib plot format string (e.g., ‘r+’ for red plusses). If True, a circle will be used (via .add_artist). Defaults to True.

colorbar : bool

Plot a colorbar.

scale : dict | float | None

Scale the data for plotting. If None, defaults to 1e6 for eeg, 1e13 for grad and 1e15 for mag.

scale_time : float | None

Scale the time labels. Defaults to 1e3 (ms).

unit : dict | str | None

The unit of the channel type used for colorbar label. If scale is None the unit is automatically determined.

res : int

The resolution of the topomap image (n pixels along each side).

size : scalar

Side length of the topomaps in inches (only applies when plotting multiple topomaps at a time).

cbar_fmt : str

String format for colorbar values.

time_format : str

String format for topomap values. Defaults to "%01d ms".

proj : bool | ‘interactive’

If true SSP projections are applied before display. If ‘interactive’, a check box for reversible selection of SSP projection vectors will be shown.

show : bool

Call pyplot.show() at the end.

show_names : bool | callable

If True, show channel names on top of the map. If a callable is passed, channel names will be formatted using the callable; e.g., to delete the prefix ‘MEG ‘ from all channel names, pass the function lambda x: x.replace(‘MEG ‘, ‘’). If mask is not None, only significant sensors will be shown.

title : str | None

Title. If None (default), no title is displayed.

mask : ndarray of bool, shape (n_channels, n_times) | None

The channels to be marked as significant at a given time point. Indicies set to True will be considered. Defaults to None.

mask_params : dict | None

Additional plotting parameters for plotting significant sensors. Default (None) equals: dict(marker='o', markerfacecolor='w', markeredgecolor='k', linewidth=0, markersize=4).

outlines : ‘head’ | ‘skirt’ | dict | None

The outlines to be drawn. If ‘head’, the default head scheme will be drawn. If ‘skirt’ the head scheme will be drawn, but sensors are allowed to be plotted outside of the head circle. If dict, each key refers to a tuple of x and y positions, the values in ‘mask_pos’ will serve as image mask, and the ‘autoshrink’ (bool) field will trigger automated shrinking of the positions due to points outside the outline. Alternatively, a matplotlib patch object can be passed for advanced masking options, either directly or as a function that returns patches (required for multi-axis plots). If None, nothing will be drawn. Defaults to ‘head’.

contours : int | False | None

The number of contour lines to draw. If 0, no contours will be drawn.

image_interp : str

The image interpolation to be used. All matplotlib options are accepted.

average : float | None

The time window around a given time to be used for averaging (seconds). For example, 0.01 would translate into window that starts 5 ms before and ends 5 ms after a given time point. Defaults to None, which means no averaging.

head_pos : dict | None

If None (default), the sensors are positioned such that they span the head circle. If dict, can have entries ‘center’ (tuple) and ‘scale’ (tuple) for what the center and scale of the head should be relative to the electrode locations.

axes : instance of Axes | list | None

The axes to plot to. If list, the list must be a list of Axes of the same length as times (unless times is None). If instance of Axes, times must be a float or a list of one float. Defaults to 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

The noise covariance as computed by mne.cov.compute_covariance.

show : bool

Whether to show the figure or not. Defaults to True.

Returns:

fig : instance of matplotlib.figure.Figure

The figure object containing the plot.

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

a dictionary mapping the old channel to a new channel name e.g. {‘EEG061’ : ‘EEG161’}. Can also be a callable function that takes and returns a string (new in version 0.10.0).

Notes

New in version 0.9.0.

resample(sfreq, npad=100, window='boxcar')

Resample data

This function operates in-place.

Parameters:

sfreq : float

New sample rate to use

npad : int

Amount to pad the start and end of the data.

window : string or tuple

Window to use in resampling. See scipy.signal.resample.

save(fname)

Save dataset to file.

Parameters:

fname : string

Name of the file where to save the data.

savgol_filter(h_freq)

Filter the data using Savitzky-Golay polynomial method

Parameters:

h_freq : float

Approximate high cut-off frequency in Hz. Note that this is not an exact cutoff, since Savitzky-Golay filtering [R6] is done using polynomial fits instead of FIR/IIR filtering. This parameter is thus used to determine the length of the window over which a 5th-order polynomial smoothing is used.

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.

Note: The following sensor types are accepted:
ecg, eeg, emg, eog, exci, ias, misc, resp, seeg, stim, syst
Parameters:

mapping : dict

a dictionary mapping a channel to a sensor type (str) {‘EEG061’: ‘eog’}.

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

The amount of time shift to be applied if relative is True else the first time point. When relative is True, positive value of tshift moves the data forward while negative tshift moves it backward.

relative : bool

If true, move the time backwards or forwards by specified amount. Else, set the starting time point to the value of tshift.

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

If None only MEG and EEG channels are kept otherwise the channels indices in picks are kept.

index : tuple of str | None

Column to be used as index for the data. Valid string options are ‘epoch’, ‘time’ and ‘condition’. If None, all three info columns will be included in the table as categorial data.

scale_time : float

Scaling to be applied to time units.

scalings : dict | None

Scaling to be applied to the channels picked. If None, defaults to scalings=dict(eeg=1e6, grad=1e13, mag=1e15, misc=1.0).

copy : bool

If true, data will be copied. Else data may be modified in place.

start : int | None

If it is a Raw object, this defines a starting index for creating the dataframe from a slice. The times will be interpolated from the index and the sampling rate of the signal.

stop : int | None

If it is a Raw object, this defines a stop index for creating the dataframe from a slice. The times will be interpolated from the index and the sampling rate of the signal.

Returns:

df : instance of pandas.core.DataFrame

A dataframe suitable for usage with other statistical/plotting/analysis packages. Column/Index values will depend on the object type being converted, but should be human-readable.