mne.time_frequency.EpochsTFR

class mne.time_frequency.EpochsTFR(info, data, times, freqs, comment=None, method=None, verbose=None)[source]

Container for Time-Frequency data on epochs.

Can for example store induced power at sensor level.

Parameters:
info : Info

The measurement info.

data : ndarray, shape (n_epochs, n_channels, n_freqs, n_times)

The data.

times : ndarray, shape (n_times,)

The time values in seconds.

freqs : ndarray, shape (n_freqs,)

The frequencies in Hz.

comment : str | None, defaults to None

Comment on the data, e.g., the experimental condition.

method : str | None, defaults to None

Comment on the method used to compute the data, e.g., morlet wavelet.

verbose : bool, str, int, or None

If not None, override default verbose level (see mne.verbose() and Logging documentation for more).

Notes

New in version 0.13.0.

Attributes:
info : instance of Info

Measurement info.

ch_names : list

Channel names.

data : ndarray, shape (n_epochs, n_channels, n_freqs, n_times)

The data array.

times : ndarray, shape (n_times,)

The time values in seconds.

freqs : ndarray, shape (n_freqs,)

The frequencies in Hz.

comment : string

Comment on dataset. Can be the condition.

method : str | None, defaults to None

Comment on the method used to compute the data, e.g., morlet wavelet.

Methods

__contains__(ch_type) Check channel type membership.
__hash__() Hash the object.
add_channels(add_list[, force_update_info]) Append new channels to the instance.
apply_baseline(baseline[, mode, verbose]) Baseline correct the data.
average() Average the data across epochs.
copy() Give a copy of the EpochsTFR.
crop([tmin, tmax]) Crop data to a given time interval in place.
drop_channels(ch_names) Drop some channels.
pick_channels(ch_names) Pick some channels.
pick_types([meg, eeg, stim, eog, ecg, emg, …]) Pick some channels by type and names.
reorder_channels(ch_names) Reorder channels.
save(fname[, overwrite]) Save TFR object to hdf5 file.
__contains__(ch_type)[source]

Check channel type membership.

Parameters:
ch_type : str

Channel type to check for. Can be e.g. ‘meg’, ‘eeg’, ‘stim’, etc.

Returns:
in : bool

Whether or not the instance contains the given channel type.

Examples

Channel type membership can be tested as:

>>> 'meg' in inst  
True
>>> 'seeg' in inst  
False
__hash__()[source]

Hash the object.

Returns:
hash : int

The hash

add_channels(add_list, force_update_info=False)[source]

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

force_update_info : bool

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.

New in version 0.12.

Returns:
inst : instance of Raw, Epochs, or Evoked

The modified instance.

See also

drop_channels

apply_baseline(baseline, mode='mean', verbose=None)[source]

Baseline correct the data.

Parameters:
baseline : tuple or list of length 2

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) all the time interval is used.

mode : ‘mean’ | ‘ratio’ | ‘logratio’ | ‘percent’ | ‘zscore’ | ‘zlogratio’

Perform baseline correction by

  • subtracting the mean of baseline values (‘mean’)
  • dividing by the mean of baseline values (‘ratio’)
  • dividing by the mean of baseline values and taking the log (‘logratio’)
  • subtracting the mean of baseline values followed by dividing by the mean of baseline values (‘percent’)
  • subtracting the mean of baseline values and dividing by the standard deviation of baseline values (‘zscore’)
  • dividing by the mean of baseline values, taking the log, and dividing by the standard deviation of log baseline values (‘zlogratio’)
verbose : bool, str, int, or None

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

Returns:
inst : instance of AverageTFR

The modified instance.

average()[source]

Average the data across epochs.

Returns:
ave : instance of AverageTFR

The averaged data.

ch_names

Channel names.

compensation_grade

The current gradient compensation grade.

copy()[source]

Give a copy of the EpochsTFR.

Returns:
tfr : instance of EpochsTFR

The copy.

crop(tmin=None, tmax=None)[source]

Crop data to a given time interval in place.

Parameters:
tmin : float | None

Start time of selection in seconds.

tmax : float | None

End time of selection in seconds.

Returns:
inst : instance of AverageTFR

The modified instance.

drop_channels(ch_names)[source]

Drop some channels.

Parameters:
ch_names : list

List of the names of the channels to remove.

Returns:
inst : instance of Raw, Epochs, or Evoked

The modified instance.

Notes

New in version 0.9.0.

pick_channels(ch_names)[source]

Pick some channels.

Parameters:
ch_names : list

The list of channels to select.

Returns:
inst : instance of Raw, Epochs, or Evoked

The modified instance.

Notes

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.

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, verbose=None)[source]

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.

dipole : bool

Dipole time course channels.

gof : bool

Dipole goodness of fit channels.

bio : bool

Bio channels.

ecog : bool

Electrocorticography channels.

fnirs : bool | str

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

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.

verbose : bool, str, int, or None

If not None, override default verbose level (see mne.verbose() and Logging documentation for more).

Returns:
inst : instance of Raw, Epochs, or Evoked

The modified instance.

See also

pick_channels

Notes

New in version 0.9.0.

reorder_channels(ch_names)[source]

Reorder channels.

Parameters:
ch_names : list

The desired channel order.

Returns:
inst : instance of Raw, Epochs, or Evoked

The modified instance.

Notes

Channel names must be unique. Channels that are not in ch_names are dropped.

New in version 0.16.0.

save(fname, overwrite=False)[source]

Save TFR object to hdf5 file.

Parameters:
fname : str

The file name, which should end with -tfr.h5 .

overwrite : bool

If True, overwrite file (if it exists). Defaults to false