compute_tfr: Compute Time-Frequency representation of EEG data

View source: R/tfr_analysis.R

compute_tfrR Documentation

Compute Time-Frequency representation of EEG data

Description

This function creates a time frequency representation of EEG time series data. Currently, it is possible to use either Morlet wavelets or Hanning tapers during the decomposition, which uses convolution in the frequency domain.

Usage

compute_tfr(data, ...)

## Default S3 method:
compute_tfr(data, ...)

## S3 method for class 'eeg_epochs'
compute_tfr(
  data,
  method = "morlet",
  foi,
  n_freq,
  spacing = "linear",
  n_cycles = 7,
  keep_trials = FALSE,
  output = "power",
  downsample = 1,
  verbose = TRUE,
  ...
)

## S3 method for class 'eeg_evoked'
compute_tfr(
  data,
  method = "morlet",
  foi,
  n_freq,
  spacing = "linear",
  n_cycles = 7,
  keep_trials = FALSE,
  output = "power",
  downsample = 1,
  verbose = TRUE,
  ...
)

Arguments

data

An object of class eeg_epochs.

...

Further TFR parameters

method

Time-frequency analysis method. Defaults to "morlet".

foi

Frequencies of interest. Scalar or character vector of the lowest and highest frequency to resolve.

n_freq

Number of frequencies to be resolved. Must be an integer number of frequencies.

spacing

Use "linear" or "log" spacing for the frequency vector and number of cycles.

n_cycles

Number of cycles at each frequency. If a single integer, use a constant number of cycles at each frequency. If a character vector of length 2, the number of cycles will scale with frequency from the minimum to the maximum.

keep_trials

Keep single trials or average over them before returning. Defaults to FALSE.

output

Sets whether output is power, phase, or fourier coefficients.

downsample

Downsampling factor. Integer. Selects every n samples after performing time-frequency analysis on the full sampling rate data.

verbose

Print informative messages in console.

Value

An object of class eeg_tfr

Methods (by class)

  • default: Default method for compute_tfr

  • eeg_epochs: Default method for compute_tfr

  • eeg_evoked: Method for eeg_evoked objects.

Author(s)

Matt Craddock matt@mattcraddock.com

Examples

out <- compute_tfr(demo_epochs, method = "morlet", foi = c(4, 30), n_freq = 10, n_cycles = 3)
out
out$freq_info$morlet_resolution
out <- compute_tfr(demo_epochs, method = "morlet", foi = c(4, 30), n_freq = 10, n_cycles = c(3, 10))
out$freq_info$morlet_resolution

neuroconductor/eegUtils documentation built on Feb. 3, 2023, 5:33 p.m.