How to calculate gB2rest value

Hi there,

im preparing my masters thesis and as part of it I want to analyse the global beta-2 resting-state power (gB2rest).
From what I found in research I think that the right way to do it is to use Welch`s method to get the Power spectral density of my EEG data and then restrict it down to the beta-2 frequency (fmin = 16, fmax = 20).
But Im honestly not sure if this is the right approach. Has anyone of you ever worked with gB2rest or has any inside on how to extra it from the EEG data?

Rough code:

fmin, fmax = 16, 20  # Beta-2 frequency range (adjust as needed)
psd, freqs = mne.time_frequency.psd_welch(raw, fmin=fmin, fmax=fmax, n_fft=1024) 

gB2rest = psd[:, (freqs >= fmin) & (freqs <= fmax)].sum(axis=-1)