Tag Archive: python

Jul
19

Simple Moving Average Filter in Python

Just a simple moving average filter implementation as Python class, nothing more. class MovingAverageFilter: """Simple moving average filter"""   @property def avg(self): """Returns current moving average value""" return self.__avg   def __init__(self, n = 8, initial_value = 0): """Inits filter with window size n and initial value""" self.__n = n self.__buffer = [initial_value/n]*n self.__avg = …

Continue reading »