Estimates power spectral density (PSD) using Welch's method and integrates power within standard EEG frequency bands for each epoch and channel.
Arguments
- psg
An
mrpheus_psgobject fromprepare_psg().- channels
Character vector. Channel labels to include. If
NULL(default), all non-bad EEG channels are used.- bands
Named list of length-2 numeric vectors defining frequency bands in Hz. Default matches YASA's
bandpower():- relative
Logical. If
TRUE, each band power is divided by the sum of all band powers (dimensionless). Matches YASArelative = True. DefaultFALSE.- win_sec
Numeric. Welch window length in seconds. Default
4.- noverlap
Integer. Number of overlapping samples between Welch windows. Default
200. Must be less thanwin_sec * sample_rate.- nfft
Integer. FFT length. Default
1024. If smaller than the window length in samples it is automatically raised to the next power of 2.
Value
A tibble with columns epoch, channel, one column per named band,
and total_power (sum of all band powers, in V^2/Hz units before any
relative scaling).
Details
The Welch implementation matches scipy.signal.welch with YASA's default
parameters (win_sec = 4, noverlap = 200, nfft = 1024, Hann window,
constant detrend, mean averaging). Relative power matches YASA's
relative = True behaviour: each band is divided by the sum of all band
powers (not the total PSD integral).