def downsample(x,M,p=<NUM_LIT:0>):
if not isinstance(M, int):<EOL><INDENT>raise TypeError("<STR_LIT>")<EOL><DEDENT>x = x[<NUM_LIT:0>:int(np.floor(len(x)/M))*M]<EOL>x = x.reshape((int(np.floor(len(x)/M)),M))<EOL>y = x[:,p]<EOL>return y<EOL>
Downsample by factor M

Keep every Mth sample of the input. The phase of the input samples
kept can be selected.

Parameters
----------
x : ndarray of input signal values
M : downsample factor
p : phase of decimated value, 0 (default), 1, ..., M-1

Returns
-------
y : ndarray of the output signal values

Examples
--------
>>> y = downsample(x,3)
>>> y = downsample(x,3,1)