Numpy: using the interpolatin function to average between the new ticks

Viewed 12

enter image description here

I have a graph like this and since i want to use the log scale in the frequency domain i want to resample the data so the points are evently distributed. When I use the interpolate function of numpy like this:

f_new = np.geomspace(f[0], f[-1], points)
mag_new = np.interp(f_new, f, mag)

it would just interpolate between the neighboring point but i want to take the average of the nearast points. Is there an elegant numpyish way to do this using some agglomaration function? Thanks ahead!!!

0 Answers
Related