yasa.bandpower_from_psd_ndarray#

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

Compute bandpowers in N-dimensional PSD.

This is a NumPy-only implementation of the yasa.bandpower_from_psd function, which supports 1-D arrays of shape (n_freqs), or N-dimensional arays (e.g. 2-D (n_chan, n_freqs) or 3-D (n_chan, n_epochs, n_freqs))

Added in version 0.2.0.

Parameters:
psdnumpy.ndarray

Power spectral density of data, in uV^2/Hz. Must be a N-D array of shape (…, n_freqs). See scipy.signal.welch for more details.

freqsnumpy.ndarray

Array of frequencies. Must be a 1-D array of shape (n_freqs,)

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:
bandpowersnumpy.ndarray

Bandpower array of shape (n_bands, …).