Spectrotemporal power estimation method. 'morlet' uses Morlet wavelets,
'multitaper' uses DPSS tapers [1]. None (the
default) only works when using __setstate__ and will raise an error otherwise.
The frequencies at which to compute the power estimates.
Must be an array of shape (n_freqs,). None (the
default) only works when using __setstate__ and will raise an error otherwise.
Channels to include. Slices and lists of integers will be interpreted as
channel indices. In lists, channel type strings (e.g., ['meg','eeg']) will pick channels of those types, channel name strings (e.g.,
['MEG0111','MEG2623'] will pick the given channels. Can also be the
string values 'all' to pick all channels, or 'data' to pick
data channels. None (default) will pick good data channels
(excluding reference MEG channels). Note that channels in info['bads']will be included if their names or indices are explicitly provided.
Whether to omit bad spans of data before spectrotemporal power
estimation. If True, spans with annotations whose description
begins with bad will be represented with np.nan in the
time-frequency representation.
The number of jobs to run in parallel. If -1, it is set
to the number of CPU cores. Requires the joblib package.
None (default) is a marker for ‘unset’ that will be interpreted
as n_jobs=1 (sequential execution) unless the call is performed under
a joblib.parallel_config context manager that sets another
value for n_jobs.
Control verbosity of the logging output. If None, use the default
verbosity level. See the logging documentation and
mne.verbose() for details. Should only be passed as a keyword
argument.
**method_kw
Additional keyword arguments passed to the spectrotemporal estimation function
(e.g., n_cycles,use_fft,zero_mean for Morlet method
or n_cycles,use_fft,zero_mean,time_bandwidth for multitaper method).
See tfr_array_morlet()
and tfr_array_multitaper() for additional details.
The last axis is always time, the next-to-last axis is always
frequency, and the first axis is always channel. If
method='multitaper' and output='complex' then the second axis
will be taper index.
Integer-, list-, and slice-based indexing is possible:
raw_tfr[[0,2]] gives the whole time-frequency plane for the
first and third channels.
raw_tfr[...,:3,:] gives the first 3 frequency bins and all
times for all channels (and tapers, if present).
raw_tfr[...,:100] gives the first 100 time samples in all
frequency bins for all channels (and tapers).
raw_tfr[(4,7)] is the same as raw_tfr[4,7].
Note
Unlike Raw objects (which returns a tuple of the
requested data values and the corresponding times), accessing
RawTFR values via subscript does
not return the corresponding frequency bin values. If you need
them, use RawTFR.freqs[freq_indices] or
RawTFR.get_data(...,return_freqs=True).
If True, force the info for objects to be appended to match the
values in self. This should generally only be used when adding
stim channels for which important metadata won’t be overwritten.
Add reference channels to data that consists of all zeros.
Adds reference channels to data that were not included during
recording. This is useful when you need to re-reference your data
to different channels. These added channels will consist of all zeros.
Name of the electrode(s) which served as the reference in the
recording. If a name is provided, a corresponding channel is added
and its data is set to 0. This is useful for later re-referencing.
The time interval to consider as “baseline” when applying baseline
correction. If None, do not apply baseline correction.
If a tuple (a,b), the interval is between a and b
(in seconds), including the endpoints.
If a is None, the beginning of the data is used; and if b
is None, it is set to the end of the data.
If (None,None), the entire time interval is used.
Note
The baseline (a,b) includes both endpoints, i.e. all timepoints t
such that a<=t<=b.
How baseline is computed is determined by the mode parameter.
Control verbosity of the logging output. If None, use the default
verbosity level. See the logging documentation and
mne.verbose() for details. Should only be passed as a keyword
argument.
Low-pass filtering is not performed, this simply selects
every Nth sample (where N is the value passed to
decim), i.e., it compresses the signal (see Notes).
If the data are not properly filtered, aliasing artifacts
may occur.
See Resampling and decimating data for more information.
Control verbosity of the logging output. If None, use the default
verbosity level. See the logging documentation and
mne.verbose() for details. Should only be passed as a keyword
argument.
For historical reasons, decim / “decimation” refers to simply subselecting
samples from a given signal. This contrasts with the broader signal processing
literature, where decimation is defined as (quoting
[2], p. 172; which cites
[3]):
“… a general system for downsampling by a factor of M is the one shown
in Figure 4.23. Such a system is called a decimator, and downsampling
by lowpass filtering followed by compression [i.e, subselecting samples]
has been termed decimation (Crochiere and Rabiner, 1983).”
Hence “decimation” in MNE is what is considered “compression” in the signal
processing community.
Decimation can be done multiple times. For example,
inst.decimate(2).decimate(2) will be the same as
inst.decimate(4).
If decim is 1, this method does not copy the underlying data.
Iterable (e.g. list) of channel name(s) or channel name to remove.
on_missing‘raise’ | ‘warn’ | ‘ignore’
Can be 'raise' (default) to raise an error, 'warn' to emit a
warning, or 'ignore' to ignore when entries in ch_names are not present in the raw instance.
Channels to include. Slices and lists of integers will be interpreted as
channel indices. In lists, channel type strings (e.g., ['meg','eeg']) will pick channels of those types, channel name strings (e.g.,
['MEG0111','MEG2623'] will pick the given channels. Can also be the
string values 'all' to pick all channels, or 'data' to pick
data channels. None (default) will pick all channels. Note that
channels in info['bads']will be included if their names or indices
are explicitly provided.
Channels to include. Slices and lists of integers will be interpreted as
channel indices. In lists, channel type strings (e.g., ['meg','eeg']) will pick channels of those types, channel name strings (e.g.,
['MEG0111','MEG2623'] will pick the given channels. Can also be the
string values 'all' to pick all channels, or 'data' to pick
data channels. None (default) will pick good data channels
(excluding reference MEG channels). Note that channels in info['bads']will be included if their names or indices are explicitly provided.
Channel names to exclude. If 'bads', channels
in spectrum.info['bads'] are excluded; pass an empty list to
include all channels (including “bad” channels, if any).
The lower- and upper-bound on frequencies of interest. Default is
None
which is equivalent to fmin=0,fmax=np.inf (spans all frequencies
present in the data).
Channels to include. Slices and lists of integers will be interpreted as
channel indices. In lists, channel type strings (e.g., ['meg','eeg']) will pick channels of those types, channel name strings (e.g.,
['MEG0111','MEG2623'] will pick the given channels. Can also be the
string values 'all' to pick all channels, or 'data' to pick
data channels. None (default) will pick all channels. Note that
channels in info['bads']will be included if their names or indices
are explicitly provided.
Control verbosity of the logging output. If None, use the default
verbosity level. See the logging documentation and
mne.verbose() for details. Should only be passed as a keyword
argument.
Control verbosity of the logging output. If None, use the default
verbosity level. See the logging documentation and
mne.verbose() for details. Should only be passed as a keyword
argument.
The channel names given are assumed to be a set, i.e. the order
does not matter. The original order of the channels is preserved.
You can use reorder_channels to set channel order if necessary.
If True include MEG channels. If string it can be ‘mag’, ‘grad’,
‘planar1’ or ‘planar2’ to select only magnetometers, all
gradiometers, or a specific type of gradiometer.
If True include CTF / 4D reference channels. If ‘auto’, reference
channels are included if compensations are present and meg is
not False. Can also be the string options for the meg
parameter.
Functional near-infrared spectroscopy channels. If True include all
fNIRS channels. If False (default) include none. If string it can
be ‘hbo’ (to include channels measuring oxyhemoglobin) or ‘hbr’ (to
include channels measuring deoxyhemoglobin).
Eyetracking channels. If True include all eyetracking channels. If False
(default) include none. If string it can be ‘eyegaze’ (to include
eye position channels) or ‘pupil’ (to include pupil-size
channels).
Control verbosity of the logging output. If None, use the default
verbosity level. See the logging documentation and
mne.verbose() for details. Should only be passed as a keyword
argument.
Channels to include. Slices and lists of integers will be interpreted as
channel indices. In lists, channel type strings (e.g., ['meg','eeg']) will pick channels of those types, channel name strings (e.g.,
['MEG0111','MEG2623'] will pick the given channels. Can also be the
string values 'all' to pick all channels, or 'data' to pick
data channels. None (default) will pick good data channels. Note
that channels in info['bads']will be included if their names or
indices are explicitly provided.
Channel names to exclude from being drawn. If 'bads', channels
in spectrum.info['bads'] are excluded; pass an empty list to
include all channels (including “bad” channels, if any).
The lower- and upper-bound on frequencies of interest. Default is
None
which is equivalent to fmin=0,fmax=np.inf (spans all frequencies
present in the data).
The time interval to consider as “baseline” when applying baseline
correction. If None, do not apply baseline correction.
If a tuple (a,b), the interval is between a and b
(in seconds), including the endpoints.
If a is None, the beginning of the data is used; and if b
is None, it is set to the end of the data.
If (None,None), the entire time interval is used.
Note
The baseline (a,b) includes both endpoints, i.e. all timepoints t
such that a<=t<=b.
How baseline is computed is determined by the mode parameter.
How to aggregate across channels. If None, plot one figure per selected channel. If a string,
"mean" uses numpy.mean(), "rms" computes the root-mean-square.
If callable(), it must operate on an array
of shape (n_channels,n_freqs,n_times) and return an array of shape
(n_freqs,n_times). Defaults to None.
Changed in version 1.3: Added support for callable.
Layout instance specifying sensor positions (does not need to be
specified for Neuromag data). If None (default), the layout is
inferred from the data (if possible).
yscale‘auto’ | ‘linear’ | ‘log’
The scale of the y (frequency) axis. ‘linear’ gives linear y axis, ‘log’ gives
log-spaced y axis and ‘auto’ detects if frequencies are log-spaced and if so sets
the y axis to ‘log’. Default is ‘auto’.
Lower and upper bounds of the colormap, typically a numeric value in the same
units as the data.
If both entries are None, the bounds are set at ± the maximum absolute value
of the data (yielding a colormap with midpoint at 0), or (0,max(abs(data)))
if the (possibly baselined) data are all-positive.
Providing None for just one entry will set the corresponding boundary at the
min/max of the data. Defaults to (None,None).
How to normalize the colormap. If None, standard linear normalization
is performed. If not None, vmin and vmax will be ignored.
See Matplotlib docs
for more details on colormap normalization, and
the ERDs example for an example of its use.
Colormap to use. If tuple, the first value indicates the colormap
to use and the second value is a boolean defining interactivity. In
interactive mode the colors are adjustable by clicking and dragging the
colorbar with left and right mouse button. Left mouse button moves the
scale up and down and right mouse button adjusts the range. Hitting
space bar resets the range. Up and down arrows can be used to change
the colormap. If None, 'Reds' is used for data that is either
all-positive or all-negative, and 'RdBu_r' is used otherwise.
'interactive' is equivalent to (None,True). Defaults to None.
Warning
Interactive mode works smoothly only for a small amount
of topomaps. Interactive mode is disabled by default for more than
2 topomaps.
Title for the plot. If "auto", will use the channel name (if combine is
None) or state the number and method of combined channels used to generate the
plot. If None, no title is shown. Default is None.
An array of boolean values, of the same
shape as the data. Data that corresponds to False entries in the mask are
plotted differently, as determined by mask_style, mask_alpha, and
mask_cmap. Useful for, e.g., highlighting areas of statistical significance.
How to distinguish the masked/unmasked regions of the plot. If "contour", a
line is drawn around the areas where the mask is True. If "mask", areas
where the mask is False will be (partially) transparent, as determined by
mask_alpha. If "both", both a contour and transparency are used. Default is
None, which is silently ignored if mask is None and is interpreted like
"both" otherwise.
Colormap to use for masked areas of the plot. If a str, must be a valid
Matplotlib colormap name. If None, cmap is used for both masked and unmasked
areas. Ignored if mask is None. Default is 'Greys'.
Relative opacity of the masked region versus the unmasked region, given as a
float between 0 and 1 (i.e., 0 means masked areas are not visible at all).
Defaults to 0.1.
The axes to plot into. If None, a new Figure
will be created with the correct number of axes. If Axes
are provided (either as a single instance or a list of axes),
the number of axes provided must match the number of picks. If combine is not None,
axes must either be an instance of Axes, or a list of length 1. Default is None.
Control verbosity of the logging output. If None, use the default
verbosity level. See the logging documentation and
mne.verbose() for details. Should only be passed as a keyword
argument.
Channels to include. Slices and lists of integers will be interpreted as
channel indices. In lists, channel type strings (e.g., ['meg','eeg']) will pick channels of those types, channel name strings (e.g.,
['MEG0111','MEG2623'] will pick the given channels. Can also be the
string values 'all' to pick all channels, or 'data' to pick
data channels. None (default) will pick good data channels. Note
that channels in info['bads']will be included if their names or
indices are explicitly provided.
Channel names to exclude. If 'bads', channels
in info['bads'] are excluded; pass an empty list to
include all channels (including “bad” channels, if any).
Default is an empty tuple which includes all channels.
How to aggregate across channels. If a string,
"mean" uses numpy.mean(), "rms" computes the root-mean-square.
If callable(), it must operate on an array
of shape (n_channels,n_freqs,n_times) and return an array of shape
(n_freqs,n_times). Defaults to "mean".
Changed in version 1.3: Added support for callable.
The lower- and upper-bound on frequencies of interest. Default is
None
which is equivalent to fmin=0,fmax=np.inf (spans all frequencies
present in the data).
The time interval to consider as “baseline” when applying baseline
correction. If None, do not apply baseline correction.
If a tuple (a,b), the interval is between a and b
(in seconds), including the endpoints.
If a is None, the beginning of the data is used; and if b
is None, it is set to the end of the data.
If (None,None), the entire time interval is used.
Note
The baseline (a,b) includes both endpoints, i.e. all timepoints t
such that a<=t<=b.
How baseline is computed is determined by the mode parameter.
Whether to plot on a decibel-like scale. If True, plots
10 × log₁₀(data).
yscale‘auto’ | ‘linear’ | ‘log’
The scale of the y (frequency) axis. ‘linear’ gives linear y axis, ‘log’ gives
log-spaced y axis and ‘auto’ detects if frequencies are log-spaced and if so sets
the y axis to ‘log’. Default is ‘auto’.
Lower and upper bounds of the colormap, typically a numeric value in the same
units as the data.
If both entries are None, the bounds are set at ± the maximum absolute value
of the data (yielding a colormap with midpoint at 0), or (0,max(abs(data)))
if the (possibly baselined) data are all-positive.
Providing None for just one entry will set the corresponding boundary at the
min/max of the data. To specify the colormap separately for the topomap annotations,
see topomap_args. Defaults to (None,None).
How to normalize the colormap. If None, standard linear normalization
is performed. If not None, vmin and vmax will be ignored.
See Matplotlib docs
for more details on colormap normalization, and
the ERDs example for an example of its use.
Keyword arguments to pass to mne.viz.plot_topomap(). axes and show are ignored. If times is not in this dict, automatic peak detection is used. Beyond that, if None, no customizable arguments will be passed. Defaults to None (i.e., an empty dict).
Control verbosity of the logging output. If None, use the default
verbosity level. See the logging documentation and
mne.verbose() for details. Should only be passed as a keyword
argument.
timefreqs has three different modes: tuples, dicts, and auto. For (list of) tuple(s)
mode, each tuple defines a pair (time, frequency) in s and Hz on the TFR plot.
For example, to look at 10 Hz activity 1 second into the epoch and 3 Hz activity 300 ms
into the epoch,
timefreqs=((1,10),(.3,3))
If provided as a dictionary, (time, frequency) tuples are keys and (time_window,
frequency_window) tuples are the values — indicating the width of the windows (centered
on the time and frequency indicated by the key) to be averaged over. For example,
timefreqs={(1,10):(0.1,2)}
would translate into a window that spans 0.95 to 1.05 seconds and 9 to 11 Hz. If
None, a single topomap will be plotted at the absolute peak across the
time-frequency representation.
Channels to include. Slices and lists of integers will be interpreted as
channel indices. In lists, channel type strings (e.g., ['meg','eeg']) will pick channels of those types, channel name strings (e.g.,
['MEG0111','MEG2623'] will pick the given channels. Can also be the
string values 'all' to pick all channels, or 'data' to pick
data channels. None (default) will pick good data channels. Note
that channels in info['bads']will be included if their names or
indices are explicitly provided.
The time interval to consider as “baseline” when applying baseline
correction. If None, do not apply baseline correction.
If a tuple (a,b), the interval is between a and b
(in seconds), including the endpoints.
If a is None, the beginning of the data is used; and if b
is None, it is set to the end of the data.
If (None,None), the entire time interval is used.
Note
The baseline (a,b) includes both endpoints, i.e. all timepoints t
such that a<=t<=b.
How baseline is computed is determined by the mode parameter.
The lower- and upper-bound on frequencies of interest. Default is
None
which is equivalent to fmin=0,fmax=np.inf (spans all frequencies
present in the data).
Lower and upper bounds of the colormap, in the same units as the data.
If vmin and vmax are both None, the bounds are set at
± the maximum absolute value
of the data (yielding a colormap with midpoint at 0). If only one of vmin, vmax is None, will use
min(data) or max(data), respectively.
Layout instance specifying sensor positions (does not need to be
specified for Neuromag data). If None (default), the layout is
inferred from the data (if possible).
The color of tick labels in the colorbar. Defaults to white.
yscale‘auto’ | ‘linear’ | ‘log’
The scale of the y (frequency) axis. ‘linear’ gives linear y axis, ‘log’ gives
log-spaced y axis and ‘auto’ detects if frequencies are log-spaced and if so sets
the y axis to ‘log’. Default is ‘auto’.
Control verbosity of the logging output. If None, use the default
verbosity level. See the logging documentation and
mne.verbose() for details. Should only be passed as a keyword
argument.
The channel type to plot. For 'grad', the gradiometers are
collected in pairs and the mean for each pair is plotted. If
None the first available channel type from order shown above is used. Defaults to 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 to
(None, None) the whole time interval is used.
Whether to add markers for sensor locations. If str, should be a
valid matplotlib format string (e.g., 'r+' for red plusses, see the
Notes section of plot()). If True (the
default), black circles will be used.
If True, show channel names next to each sensor marker. If callable,
channel names will be formatted using the callable; e.g., to
delete the prefix ‘MEG ‘ from all channel names, pass the function
lambdax:x.replace('MEG',''). If mask is not None, only
non-masked sensor names will be shown.
Array indicating channel-time combinations to highlight with a distinct
plotting style (useful for, e.g. marking which channels at which times a statistical test of the data reaches significance). Array elements set to True will be plotted
with the parameters given in mask_params. Defaults to None,
equivalent to an array of all False elements.
The number of contour lines to draw. If 0, no contours will be drawn.
If a positive integer, that number of contour levels are chosen using the
matplotlib tick locator (may sometimes be inaccurate, use array for
accuracy). If array-like, the array values are used as the contour levels.
The values should be in µV for EEG, fT for magnetometers and fT/m for
gradiometers. If colorbar=True, the colorbar will have ticks
corresponding to the contour levels. Default is 6.
The outlines to be drawn. If ‘head’, the default head scheme will be
drawn. If dict, each key refers to a tuple of x and y positions, the values
in ‘mask_pos’ will serve as image mask.
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’.
The sphere parameters to use for the head outline. Can be array-like of
shape (4,) to give the X/Y/Z origin and radius in meters, or a single float
to give just the radius (origin assumed 0, 0, 0). Can also be an instance
of a spherical ConductorModel to use the origin and
radius from that object. If 'auto' the sphere is fit to digitization
points. If 'eeglab' the head circle is defined by EEG electrodes
'Fpz', 'Oz', 'T7', and 'T8' (if 'Fpz' is not present,
it will be approximated from the coordinates of 'Oz'). None (the
default) is equivalent to 'auto' when enough extra digitization points
are available, and (0, 0, 0, 0.095) otherwise.
Extrapolate to four points placed to form a square encompassing all
data points, where each side of the square is three times the range
of the data in the respective dimension.
'local' (default for MEG sensors)
Extrapolate only to nearby points (approximately to points closer than
median inter-electrode distance). This will also set the
mask to be polygonal based on the convex hull of the sensors.
'head' (default for non-MEG sensors)
Extrapolate out to the edges of the clipping circle. This will be on
the head circle when the sensors are contained within the head circle,
but it can extend beyond the head when sensors are plotted outside
the head circle.
Changed in version 0.21:
The default was changed to 'local' for MEG sensors.
'local' was changed to use a convex hull mask
'head' was changed to extrapolate out to the clipping circle.
Colormap to use. If tuple, the first value indicates the colormap
to use and the second value is a boolean defining interactivity. In
interactive mode the colors are adjustable by clicking and dragging the
colorbar with left and right mouse button. Left mouse button moves the
scale up and down and right mouse button adjusts the range. Hitting
space bar resets the range. Up and down arrows can be used to change
the colormap. If None, 'Reds' is used for data that is either
all-positive or all-negative, and 'RdBu_r' is used otherwise.
'interactive' is equivalent to (None,True). Defaults to None.
Warning
Interactive mode works smoothly only for a small amount
of topomaps. Interactive mode is disabled by default for more than
2 topomaps.
Lower and upper bounds of the colormap, typically a numeric value in the same
units as the data.
If both entries are None, the bounds are set at (min(data),max(data)).
Providing None for just one entry will set the corresponding boundary at the
min/max of the data. Defaults to (None,None).
How to normalize the colormap. If None, standard linear normalization
is performed. If not None, vmin and vmax will be ignored.
See Matplotlib docs
for more details on colormap normalization, and
the ERDs example for an example of its use.
Control verbosity of the logging output. If None, use the default
verbosity level. See the logging documentation and
mne.verbose() for details. Should only be passed as a keyword
argument.
The (absolute or relative) time shift in seconds. If relative
is True, positive tshift increases the time value associated with
each sample, while negative tshift decreases it.
If True, increase or decrease time values by tshift seconds.
Otherwise, shift the time values such that the time of the first
sample equals tshift.
Returns:
epochsMNE-object
The modified instance.
Notes
This method allows you to shift the time values associated with each
data sample by an arbitrary amount. It does not resample the signal
or change the data values in any way.
Export data in tabular structure as a pandas DataFrame.
Channels are converted to columns in the DataFrame. By default,
additional columns 'time', 'freq', 'epoch', and
'condition' (epoch event description) are added, unless index
is not None (in which case the columns specified in index will
be used to form the DataFrame’s index instead). 'epoch', and
'condition' are not supported for AverageTFR.
Channels to include. Slices and lists of integers will be interpreted as
channel indices. In lists, channel type strings (e.g., ['meg','eeg']) will pick channels of those types, channel name strings (e.g.,
['MEG0111','MEG2623'] will pick the given channels. Can also be the
string values 'all' to pick all channels, or 'data' to pick
data channels. None (default) will pick all channels. Note that
channels in info['bads']will be included if their names or indices
are explicitly provided.
Kind of index to use for the DataFrame. If None, a sequential
integer index (pandas.RangeIndex) will be used. If 'time', a
pandas.Index or pandas.TimedeltaIndex will be used
(depending on the value of time_format). If a list of two or more string values, a pandas.MultiIndex will be created.
Valid string values are 'time', 'freq', 'epoch', and
'condition' for EpochsTFR and 'time' and 'freq'
for AverageTFR.
Defaults to None.
If True, the DataFrame is returned in long format where each row is one
observation of the signal at a unique combination of time point, channel, epoch number, and condition.
For convenience, a ch_type column is added to facilitate subsetting the resulting DataFrame. Defaults to False.
Desired time format. If None, no conversion is applied, and time values
remain as float values in seconds. If 'ms', time values will be rounded
to the nearest millisecond and converted to integers. If 'timedelta',
time values will be converted to pandas.Timedelta values.
Default is None.
Control verbosity of the logging output. If None, use the default
verbosity level. See the logging documentation and
mne.verbose() for details. Should only be passed as a keyword
argument.