I need to translate this matlab code
result = movmean(std_new1,PTA);
into numpy.
std_new1 is a 1x19290 vector as follows:
std_new1 = NA, NA, NA, NA, NA, NA, NA, NA, NA, 0.0223287, 0.023921, 0.0255133, 0.0271056, 0.0286979, 0.0302902, ....
and PTA is 1x1 vector = 20
I tried numpy:
result = np.ma.average(std_new1, PTA)
but I get TypeError: only integer scalar arrays can be converted to a scalar index
I then tried also
result = np.ma.average(std_new1, PTA[0])
but then i get IndexError: tuple index out of range
I'm reading numpy doc and it says
numpy.ma.average(a, axis=None, weights=None, returned=False)
so i don't understand what is the issue. First code should be fine but it isn't.
Any better alternative to calculate moving average?
Thank you