Previous topic

scikits.timeseries.lib.moving_funcs.cmov_mean

Next topic

Reports

This Page

scikits.timeseries.lib.moving_funcs.cmov_window

cmov_window(data, span, window_type)

Applies a centered moving window of type window_type and size span on the data.

Parameters:

data : array-like

Input data, as a sequence or (subclass of) ndarray. Masked arrays and TimeSeries objects are also accepted. The input array should be 1D or 2D at most. If the input array is 2D, the function is applied on each column.

span : int

Size of the filtering window.

window_type : {string/tuple/float}

Window type (see Notes)

Returns:

A (subclass of) MaskedArray. :

Noting ``k=span//2``, the ``k`` first and ``k`` last data are always masked. :

If ``data`` has a missing value at position ``i``, then the result has :

missing values in the interval ``[i-k:i+k+1]``. :

Warning

Only boxcar has been thoroughly tested so far...

Notes

The recognized window types are:

  • boxcar
  • triang
  • blackman
  • hamming
  • bartlett
  • parzen
  • bohman
  • blackmanharris
  • nuttall
  • barthann
  • kaiser (needs beta)
  • gaussian (needs std)
  • general_gaussian (needs power, width)
  • slepian (needs width).

If the window requires special parameters, the window_type argument should be a tuple with the first argument the string name of the window, and the next arguments the needed parameters. If window_type is a floating point number, it is interpreted as the beta parameter of the kaiser window.