yasa.bandpower_from_psd

yasa.bandpower_from_psd(psd, freqs, ch_names=None, bands=[(0.5, 4, 'Delta'), (4, 8, 'Theta'), (8, 12, 'Alpha'), (12, 16, 'Sigma'), (16, 30, 'Beta'), (30, 40, 'Gamma')], relative=True)[source]

Compute the average power of the EEG in specified frequency band(s) given a pre-computed PSD.

New in version 0.1.5.

Parameters
psdarray_like

Power spectral density of data, in uV^2/Hz. Must be of shape (n_channels, n_freqs). See scipy.signal.welch() for more details.

freqsarray_like

Array of frequencies.

ch_nameslist

List of channel names, e.g. [‘Cz’, ‘F3’, ‘F4’, …]. If None, channels will be labelled [‘CHAN000’, ‘CHAN001’, …].

bandslist of tuples

List of frequency bands of interests. Each tuple must contain the lower and upper frequencies, as well as the band name (e.g. (0.5, 4, ‘Delta’)).

relativeboolean

If True, bandpower is divided by the total power between the min and max frequencies defined in band (default 0.5 to 40 Hz).

Returns
bandpowerspandas.DataFrame

Bandpower dataframe, in which each row is a channel and each column a spectral band.