API Documentation Generated by Endo, 2006-08-14
Return the M-point modified Bartlett-Hann window.
The M-point Bartlett window.
The M-point Blackman window.
The M-point minimum 4-term Blackman-Harris window.
The M-point Bohman window
The M-point boxcar window.
sort roots based on magnitude.
Convolve two N-dimensional arrays.
Description:
Convolve in1 and in2 with output size determined by mode.
Inputs:
in1 -- an N-dimensional array.
in2 -- an array with the same number of dimensions as in1.
mode -- a flag indicating the size of the output
'valid' (0): The output consists only of those elements that
are computed by scaling the larger array with all
the values of the smaller array.
'same' (1): The output is the same size as the largest input
centered with respect to the 'full' output.
'full' (2): The output is the full discrete linear convolution
of the inputs. (Default)
Outputs: (out,)
out -- an N-dimensional array containing a subset of the discrete linear
convolution of in1 with in2.
Conolve two 2-dimensional arrays.
Description:
Convolve in1 and in2 with output size determined by mode and boundary
conditions determined by boundary and fillvalue.
Inputs:
in1 -- a 2-dimensional array.
in2 -- a 2-dimensional array.
mode -- a flag indicating the size of the output
'valid' (0): The output consists only of those elements that
do not rely on the zero-padding.
'same' (1): The output is the same size as the input centered
with respect to the 'full' output.
'full' (2): The output is the full discrete linear convolution
of the inputs. (*Default*)
boundary -- a flag indicating how to handle boundaries
'fill' : pad input arrays with fillvalue. (*Default*)
'wrap' : circular boundary conditions.
'symm' : symmetrical boundary conditions.
fillvalue -- value to fill pad input arrays with (*Default* = 0)
Outputs: (out,)
out -- a 2-dimensional array containing a subset of the discrete linear
convolution of in1 with in2.
Cross-correlate two N-dimensional arrays.
Description:
Cross-correlate in1 and in2 with the output size determined by mode.
Inputs:
in1 -- an N-dimensional array.
in2 -- an array with the same number of dimensions as in1.
mode -- a flag indicating the size of the output
'valid' (0): The output consists only of those elements that
do not rely on the zero-padding.
'same' (1): The output is the same size as the largest input
centered with respect to the 'full' output.
'full' (2): The output is the full discrete linear
cross-correlation of the inputs. (Default)
Outputs: (out,)
out -- an N-dimensional array containing a subset of the discrete linear
cross-correlation of in1 with in2.
Cross-correlate two 2-dimensional arrays.
Description:
Cross correlate in1 and in2 with output size determined by mode
and boundary conditions determined by boundary and fillvalue.
Inputs:
in1 -- a 2-dimensional array.
in2 -- a 2-dimensional array.
mode -- a flag indicating the size of the output
'valid' (0): The output consists only of those elements that
do not rely on the zero-padding.
'same' (1): The output is the same size as the input centered
with respect to the 'full' output.
'full' (2): The output is the full discrete linear convolution
of the inputs. (*Default*)
boundary -- a flag indicating how to handle boundaries
'fill' : pad input arrays with fillvalue. (*Default*)
'wrap' : circular boundary conditions.
'symm' : symmetrical boundary conditions.
fillvalue -- value to fill pad input arrays with (*Default* = 0)
Outputs: (out,)
out -- a 2-dimensional array containing a subset of the discrete linear
cross-correlation of in1 with in2.
Deconvolves divisor out of signal.
Remove linear trend along axis from data.
If type is 'constant' then remove mean only.
Convolve two N-dimensional arrays using FFT. See convolve.
Returns a Gaussian window of length M with standard-deviation std.
Returns a window with a generalized Gaussian shape.
exp(-0.5*(x/sig)**(2*p))
half power point is at (2*log(2)))**(1/(2*p))*sig
Return a window of length Nx and type window.
If fftbins is 1, create a "periodic" window ready to use with ifftshift
and be multiplied by the result of an fft (SEE ALSO fftfreq).
Window types: boxcar, triang, blackman, hamming, hanning, bartlett,
parzen, bohman, blackmanharris, nuttall, barthann,
kaiser (needs beta), gaussian (needs std),
general_gaussian (needs power, width),
slepian (needs width)
If the window requires no parameters, then it can be a string.
If the window requires parameters, the window argument should be a tuple
with the first argument the string name of the window, and the next
arguments the needed parameters.
If window is a floating point number, it is interpreted as the beta
parameter of the kaiser window.
The M-point Hamming window.
The M-point Hanning window.
Return the hilbert transform of x of length N.
Return the '2-D' hilbert transform of x of length N.
Compute b(s) and a(s) from partial fraction expansion: r,p,k
If M = len(b) and N = len(a)
b(s) b[0] x**(M-1) + b[1] x**(M-2) + ... + b[M-1]
H(s) = ------ = ----------------------------------------------
a(s) a[0] x**(N-1) + a[1] x**(N-2) + ... + a[N-1]
r[0] r[1] r[-1]
= -------- + -------- + ... + --------- + k(s)
(s-p[0]) (s-p[1]) (s-p[-1])
If there are any repeated roots (closer than tol), then the partial
fraction expansion has terms like
r[i] r[i+1] r[i+n-1]
-------- + ----------- + ... + -----------
(s-p[i]) (s-p[i])**2 (s-p[i])**n
See also: residue, poly, polyval, unique_roots
Compute b(z) and a(z) from partial fraction expansion: r,p,k
If M = len(b) and N = len(a)
b(z) b[0] + b[1] z**(-1) + ... + b[M-1] z**(-M+1)
H(z) = ------ = ----------------------------------------------
a(z) a[0] + a[1] z**(-1) + ... + a[N-1] z**(-N+1)
r[0] r[-1]
= --------------- + ... + ---------------- + k[0] + k[1]z**(-1) ...
(1-p[0]z**(-1)) (1-p[-1]z**(-1))
If there are any repeated roots (closer than tol), then the partial
fraction expansion has terms like
r[i] r[i+1] r[i+n-1]
-------------- + ------------------ + ... + ------------------
(1-p[i]z**(-1)) (1-p[i]z**(-1))**2 (1-p[i]z**(-1))**n
See also: residuez, poly, polyval, unique_roots
Returns a Kaiser window of length M with shape parameter beta.
Filter data along one-dimension with an IIR or FIR filter.
Description
Filter a data sequence, x, using a digital filter. This works for many
fundamental data types (including Object type). The filter is a direct
form II transposed implementation of the standard difference equation
(see "Algorithm").
Inputs:
b -- The numerator coefficient vector in a 1-D sequence.
a -- The denominator coefficient vector in a 1-D sequence. If a[0]
is not 1, then both a and b are normalized by a[0].
x -- An N-dimensional input array.
axis -- The axis of the input data array along which to apply the
linear filter. The filter is applied to each subarray along
this axis (*Default* = -1)
zi -- Initial conditions for the filter delays. It is a vector
(or array of vectors for an N-dimensional input) of length
max(len(a),len(b)). If zi=None or is not given then initial
rest is assumed. SEE signal.lfiltic for more information.
Outputs: (y, {zf})
y -- The output of the digital filter.
zf -- If zi is None, this is not returned, otherwise, zf holds the
final filter delay values.
Algorithm:
The filter function is implemented as a direct II transposed structure.
This means that the filter implements
y[n] = b[0]*x[n] + b[1]*x[n-1] + ... + b[nb]*x[n-nb]
- a[1]*y[n-1] + ... + a[na]*y[n-na]
using the following difference equations:
y[m] = b[0]*x[m] + z[0,m-1]
z[0,m] = b[1]*x[m] + z[1,m-1] - a[1]*y[m]
...
z[n-3,m] = b[n-2]*x[m] + z[n-2,m-1] - a[n-2]*y[m]
z[n-2,m] = b[n-1]*x[m] - a[n-1]*y[m]
where m is the output sample number and n=max(len(a),len(b)) is the
model order.
The rational transfer function describing this filter in the
z-transform domain is
-1 -nb
b[0] + b[1]z + ... + b[nb] z
Y(z) = ---------------------------------- X(z)
-1 -na
a[0] + a[1]z + ... + a[na] z
Given a linear filter (b,a) and initial conditions on the output y
and the input x, return the inital conditions on the state vector zi
which is used by lfilter to generate the output given the input.
If M=len(b)-1 and N=len(a)-1. Then, the initial conditions are given
in the vectors x and y as
x = {x[-1],x[-2],...,x[-M]}
y = {y[-1],y[-2],...,y[-N]}
If x is not given, its inital conditions are assumed zero.
If either vector is too short, then zeros are added
to achieve the proper length.
The output vector zi contains
zi = {z_0[-1], z_1[-1], ..., z_K-1[-1]} where K=max(M,N).
Perform a median filter on an N-dimensional array.
Description:
Apply a median filter to the input array using a local window-size
given by kernel_size.
Inputs:
in -- An N-dimensional input array.
kernel_size -- A scalar or an N-length list giving the size of the
median filter window in each dimension. Elements of
kernel_size should be odd. If kernel_size is a scalar,
then this scalar is used as the size in each dimension.
Outputs: (out,)
out -- An array the same size as input containing the median filtered
result.
Median filter two 2-dimensional arrays.
Description:
Apply a median filter to the input array using a local window-size
given by kernel_size (must be odd).
Inputs:
in -- An 2 dimensional input array.
kernel_size -- A scalar or an length-2 list giving the size of the
median filter window in each dimension. Elements of
kernel_size should be odd. If kernel_size is a scalar,
then this scalar is used as the size in each dimension.
Outputs: (out,)
out -- An array the same size as input containing the median filtered
result.
A minimum 4-term Blackman-Harris window according to Nuttall.
Perform an order filter on an N-dimensional array.
Description:
Perform an order filter on the array in. The domain argument acts as a
mask centered over each pixel. The non-zero elements of domain are
used to select elements surrounding each input pixel which are placed
in a list. The list is sorted, and the output for that pixel is the
element corresponding to rank in the sorted list.
Inputs:
in -- an N-dimensional input array.
domain -- a mask array with the same number of dimensions as in. Each
dimension should have an odd number of elements.
rank -- an non-negative integer which selects the element from the
sorted list (0 corresponds to the largest element, 1 is the
next largest element, etc.)
Output: (out,)
out -- the results of the order filter in an array with the same
shape as in.
The M-point Parzen window
Calculate the minimax optimal filter using Remez exchange algorithm.
Description:
Calculate the filter-coefficients for the finite impulse response
(FIR) filter whose transfer function minimizes the maximum error
between the desired gain and the realized gain in the specified bands
using the remez exchange algorithm.
Inputs:
numtaps -- The desired number of taps in the filter.
bands -- A montonic sequence containing the band edges. All elements
must be non-negative and less than 1/2 the sampling frequency
as given by Hz.
desired -- A sequency half the size of bands containing the desired gain
in each of the specified bands
weight -- A relative weighting to give to each band region.
type --- The type of filter:
'bandpass' : flat response in bands.
'differentiator' : frequency proportional response in bands.
Outputs: (out,)
out -- A rank-1 array containing the coefficients of the optimal
(in a minimax sense) filter.
Resample to num samples using Fourier method along the given axis.
The resampled signal starts at the same value of x but is sampled
with a spacing of len(x) / num * (spacing of x). Because a Fourier method
is used, the signal is assumed periodic.
Window controls a Fourier-domain window that tapers the Fourier spectrum
before zero-padding to aleviate ringing in the resampled values for
sampled signals you didn't intend to be interpreted as band-limited.
If window is a string then use the named window. If window is a float, then
it represents a value of beta for a kaiser window. If window is a tuple,
then the first component is a string representing the window, and the next
arguments are parameters for that window.
Possible windows are:
'blackman' ('black', 'blk')
'hamming' ('hamm', 'ham')
'bartlett' ('bart', 'brt')
'hanning' ('hann', 'han')
'kaiser' ('ksr') # requires parameter (beta)
'gaussian' ('gauss', 'gss') # requires parameter (std.)
'general gauss' ('general', 'ggs') # requires two parameters
(power, width)
The first sample of the returned vector is the same as the first sample of the
input vector, the spacing between samples is changed from dx to
dx * len(x) / num
If t is not None, then it represents the old sample positions, and the new
sample positions will be returned as well as the new samples.
Compute partial-fraction expansion of b(s) / a(s).
If M = len(b) and N = len(a)
b(s) b[0] s**(M-1) + b[1] s**(M-2) + ... + b[M-1]
H(s) = ------ = ----------------------------------------------
a(s) a[0] s**(N-1) + a[1] s**(N-2) + ... + a[N-1]
r[0] r[1] r[-1]
= -------- + -------- + ... + --------- + k(s)
(s-p[0]) (s-p[1]) (s-p[-1])
If there are any repeated roots (closer than tol), then the partial
fraction expansion has terms like
r[i] r[i+1] r[i+n-1]
-------- + ----------- + ... + -----------
(s-p[i]) (s-p[i])**2 (s-p[i])**n
See also: invres, poly, polyval, unique_roots
Compute partial-fraction expansion of b(z) / a(z).
If M = len(b) and N = len(a)
b(z) b[0] + b[1] z**(-1) + ... + b[M-1] z**(-M+1)
H(z) = ------ = ----------------------------------------------
a(z) a[0] + a[1] z**(-1) + ... + a[N-1] z**(-N+1)
r[0] r[-1]
= --------------- + ... + ---------------- + k[0] + k[1]z**(-1) ...
(1-p[0]z**(-1)) (1-p[-1]z**(-1))
If there are any repeated roots (closer than tol), then the partial
fraction expansion has terms like
r[i] r[i+1] r[i+n-1]
-------------- + ------------------ + ... + ------------------
(1-p[i]z**(-1)) (1-p[i]z**(-1))**2 (1-p[i]z**(-1))**n
See also: invresz, poly, polyval, unique_roots
The M-point triangular window.
Determine the unique roots and their multiplicities in two lists
Inputs:
p -- The list of roots
tol --- The tolerance for two roots to be considered equal.
rtype --- How to determine the returned root from the close
ones: 'max': pick the maximum
'min': pick the minimum
'avg': average roots
Outputs: (pout, mult)
pout -- The list of sorted roots
mult -- The multiplicity of each root
Perform a Wiener filter on an N-dimensional array.
Description:
Apply a Wiener filter to the N-dimensional array in.
Inputs:
in -- an N-dimensional array.
kernel_size -- A scalar or an N-length list giving the size of the
median filter window in each dimension. Elements of
kernel_size should be odd. If kernel_size is a scalar,
then this scalar is used as the size in each dimension.
noise -- The noise-power to use. If None, then noise is estimated as
the average of the local variance of the input.
Outputs: (out,)
out -- Wiener filtered result with the same shape as in.
| Local name | Refers to |
|---|---|
| allclose | numpy.allclose |
| any | numpy.any |
| arange | numpy.arange |
| argmax | numpy.argmax |
| argsort | numpy.argsort |
| array | numpy.array |
| asarray | numpy.asarray |
| atleast_1d | numpy.atleast_1d |
| cast | numpy.cast |
| cos | numpy.cos |
| c_ | numpy.c_ |
| dot | numpy.dot |
| exp | numpy.exp |
| expand_dims | numpy.expand_dims |
| extract | numpy.extract |
| factorial | scipy.misc.common.factorial |
| fft | scipy.fftpack.basic.fft |
| fft2 | scipy.fftpack.basic.fft2 |
| fftn | scipy.fftpack.basic.fftn |
| ifft | scipy.fftpack.basic.ifft |
| ifft2 | scipy.fftpack.basic.ifft2 |
| ifftn | scipy.fftpack.basic.ifftn |
| ifftshift | numpy.dft.helper.ifftshift |
| iscomplexobj | numpy.iscomplexobj |
| isscalar | numpy.isscalar |
| less_equal | numpy.less_equal |
| linspace | numpy.linspace |
| maximum | numpy.maximum |
| mean | numpy.mean |
| minimum | numpy.minimum |
| newaxis | numpy.newaxis |
| numpy | numpy |
| ones | numpy.ones |
| pi | numpy.pi |
| poly | numpy.poly |
| polyadd | numpy.polyadd |
| polyder | numpy.polyder |
| polydiv | numpy.polydiv |
| polymul | numpy.polymul |
| polysub | numpy.polysub |
| polyval | numpy.polyval |
| prod | numpy.prod |
| product | numpy.product |
| rank | numpy.rank |
| ravel | numpy.ravel |
| real | numpy.real |
| real_if_close | numpy.real_if_close |
| reshape | numpy.reshape |
| roots | numpy.roots |
| r_ | numpy.r_ |
| sigtools | sigtools |
| sin | numpy.sin |
| size | numpy.size |
| sort | numpy.sort |
| sqrt | numpy.sqrt |
| sum | numpy.sum |
| take | numpy.take |
| transpose | numpy.transpose |
| types | types |
| unique | numpy.unique |
| where | numpy.where |
| zeros | numpy.zeros |