A_f_delta = abs(f[X_delta]) ** 2
maximum_ix = argrelextrema(A_f, np.greater)
E_F_delta = np.sum(A_f[maximum_ix]) / 2
E_F_delta
2453.8235776144866
Calculate energy for each frequency band around frequency F of interest in Python