,

Downsample a signal_tbl by a factor q, using an FIR or IIR filter. This is a wrapper for decimate from the gsignal package, see its documentation for details.

eeg_downsample(
  .data,
  .q = 2,
  .max_sample = NULL,
  .n = if (.ftype == "iir") 8 else 30,
  .ftype = "iir",
  .multiple_times = FALSE,
  ...
)

Arguments

.data

An eeg_lst object.

.q

integer factor(s) to downsample by.

.max_sample

Optionally, the (approximated) maximum sample number can be defined here, which is at least half of the total number of samples

.n

Order of the filter used prior to the downsampling, specified as a positive integer. Default: 8 if ftype equals "iir"; 30 of ftype equals "fir".

.ftype

filter type; either "fir", specifying a FIR filter of length n designed with the function fir1, or "iir" (default), specifying an IIR Chebyshev filter of order 8 using the function cheby1.

.multiple_times

Indicates whether to factorize `q`` and apply the downsampling in steps.

...

Not in use.

Details

A factor q larger than 13 can result in NAs. To avoid this, the downsampling can be done in steps. For example, instead of setting q = 20, it is possible to set q = c(2,10).