relative band power


I am attempting to calculate relative band power for EEG channels in an EDF file following this paper:

which defines the formula for relative power (RP) as:

RP(f1,f2)= (P(f1,f2)/P(FMIN,FMAX))×100%

so far as I can tell P(f1,f2) could be calculated different ways depending on the definition of power in a band:

  1. power calculated from an epochs object calculated using compute_psd between f1 and f2
totalPower = epochs.compute_psd(picks=picks, fmin=FMIN, fmax=MAX)
bandPower = epochs.compute_psd(picks=picks, fmin=f1 fmax=f2)

# pad bandPower to same dimensions as totalPower and divide

  1. power calculated between 1 and 45Hz filtered by f1 and f2
totalPower = epochs.compute_psd(picks=picks, fmin=FMIN, fmax=FMAX)
totalPsds, totalFreqs = totalPower.get_data(return_freqs=True)
bandPsds = totalPsds[:,:,(totalFreqs >= f1) & (totalFreqs < f2)].mean(axis=-1)

I am likely showing my naivety here but both are possible in code but only one or neither method is likely conventionally correct.

Please could the group let me know what they think.



with a little code, you can actually figure it out!

import numpy as np

import mne


sample_data_folder = mne.datasets.sample.data_path()
sample_data_raw_file = sample_data_folder / 'MEG' / 'sample' / 'sample_audvis_raw.fif'
raw =, verbose=False, preload=False)

fmin, fmax = 10, 20

psd1 = raw.compute_psd()
psd2 = raw.compute_psd(fmin=fmin, fmax=fmax)

mask = np.logical_and(psd1.freqs >= fmin, psd1.freqs <= fmax)

np.testing.assert_array_equal(psd1.get_data()[..., mask],

the assertion holds, i.e., you get the same result either way.

1 Like