code: def maverage(size):
    
    size_inv = 1. / size
  
    @tostream
    def maverage_filter(sig, zero=0.):
      data = deque((zero * size_inv for _ in xrange(size)), maxlen=size)
      mean_value = zero
      for el in sig:
        mean_value -= data.popleft()
        new_value = el * size_inv
        data.append(new_value)
        mean_value += new_value
        yield mean_value
  
    return maverage_filter
docs: Moving average
  
    This is the only strategy that uses a ``collections.deque`` object
    instead of a ZFilter instance. Fast, but without extra capabilites such
    as a frequency response plotting method.
  
    Parameters
    ----------
    size :
      Data block window size. Should be an integer.
  
    Returns
    -------
    A callable that accepts two parameters: a signal ``sig`` and the starting
    memory element ``zero`` that behaves like the ``LinearFilter.__call__``
    arguments. The output from that callable is a Stream instance, and has
    no decimation applied.
  
    See Also
    --------
    envelope :
      Signal envelope (time domain) strategies.