|
Server : Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.17 System : Linux localhost 2.6.18-419.el5 #1 SMP Fri Feb 24 22:47:42 UTC 2017 x86_64 User : nobody ( 99) PHP Version : 5.2.17 Disable Function : NONE Directory : /proc/21585/root/usr/lib64/python2.4/site-packages/Numeric/FFT/ |
Upload File : |
mň
Jä:c @ sE d Z d k Z d k Z d k Z h Z h Z d d e i e i e d Z d d d Z
d d d Z d d d Z d d d Z
d d d Z d d d Z d d d
d Z d d e
d Z d d d
Z d d d Z d d d Z d d d Z d d d Z d d d Z d d d Z d d d Z d S( s}
Discrete Fourier Transforms - FFT.py
The underlying code for these functions is an f2c translated and modified
version of the FFTPACK routines.
fft(a, n=None, axis=-1)
inverse_fft(a, n=None, axis=-1)
real_fft(a, n=None, axis=-1)
inverse_real_fft(a, n=None, axis=-1)
hermite_fft(a, n=None, axis=-1)
inverse_hermite_fft(a, n=None, axis=-1)
fftnd(a, s=None, axes=None)
inverse_fftnd(a, s=None, axes=None)
real_fftnd(a, s=None, axes=None)
inverse_real_fftnd(a, s=None, axes=None)
fft2d(a, s=None, axes=(-2,-1))
inverse_fft2d(a, s=None, axes=(-2, -1))
real_fft2d(a, s=None, axes=(-2,-1))
inverse_real_fft2d(a, s=None, axes=(-2, -1))
Ni˙˙˙˙c C s t i | } | d j o | i | } n y | | }
Wn) t j
o | | }
|
| | <n X| i | | j oŔ t | i } | | | j o: t
d g t | } t
d | | | <| | } q;t
d g t | } t
d | | | | <| | | <t i | | i } | | | <| } n | d j o t i | | d } n | | |
} | d j o t i | | d } n | S( Ni i˙˙˙˙( t Numerict asarrayt at nt Nonet shapet axist fft_cachet wsavet KeyErrort
init_functiont listt st slicet lent indext zerost typecodet zt swapaxest
work_functiont r( R R R R
R R R R R R R ( ( t5 /usr/lib64/python2.4/site-packages/Numeric/FFT/FFT.pyt _raw_fft s4
c C s t | | | t i t i t S( sp fft(a, n=None, axis=-1)
Will return the n point discrete Fourier transform of a. n defaults to the
length of a. If n is larger than a, then a will be zero-padded to make up
the difference. If n is smaller than a, the first n items in a will be
used.
The packing of the result is "standard": If A = fft(a, n), then A[0]
contains the zero-frequency term, A[1:n/2+1] contains the
positive-frequency terms, and A[n/2+1:] contains the negative-frequency
terms, in order of decreasingly negative frequency. So for an 8-point
transform, the frequencies of the result are [ 0, 1, 2, 3, 4, -3, -2, -1].
This is most efficient for n a power of two. This also stores a cache of
working memory for different sizes of fft's, so you could theoretically
run into memory problems if you call this too many times with too many
different n's.N( R R R R t fftpackt cfftit cfftft
_fft_cache( R R R ( ( R t fft= s c C sb t i | i t i } | d j o t i | | } n t | | | t
i t
i t
| S( sî inverse_fft(a, n=None, axis=-1)
Will return the n point inverse discrete Fourier transform of a. n
defaults to the length of a. If n is larger than a, then a will be
zero-padded to make up the difference. If n is smaller than a, then a will
be truncated to reduce its size.
The input array is expected to be packed the same way as the output of
fft, as discussed in it's documentation.
This is the inverse of fft: inverse_fft(fft(a)) == a within numerical
accuracy.
This is most efficient for n a power of two. This also stores a cache of
working memory for different sizes of fft's, so you could theoretically
run into memory problems if you call this too many times with too many
different n's.N( R R R t astypet ComplexR R R R R R R t cfftbR ( R R R ( ( R t inverse_fftS s
c C s: t i | i t i } t | | | t i t i
t S( sĹ real_fft(a, n=None, axis=-1)
Will return the n point discrete Fourier transform of the real valued
array a. n defaults to the length of a. n is the length of the input, not
the output.
The returned array will be the nonnegative frequency terms of the
Hermite-symmetric, complex transform of the real array. So for an 8-point
transform, the frequencies in the result are [ 0, 1, 2, 3, 4]. The first
term will be real, as will the last if n is even. The negative frequency
terms are not needed because they are the complex conjugates of the
positive frequency terms. (This is what I mean when I say
Hermite-symmetric.)
This is most efficient for n a power of two.N( R R R R t FloatR R R R t rfftit rfftft _real_fft_cache( R R R ( ( R t real_fftl s c C sj t i | i t i } | d j o t i | | d d } n t | | | t
i t
i t
| S( s inverse_real_fft(a, n=None, axis=-1)
Will return the real valued n point inverse discrete Fourier transform of
a, where a contains the nonnegative frequency terms of a Hermite-symmetric
sequence. n is the length of the result, not the input. If n is not
supplied, the default is 2*(len(a)-1). If you want the length of the
result to be odd, you have to say so.
If you specify an n such that a must be zero-padded or truncated, the
extra/removed values will be added/removed at high frequencies. One can
thus resample a series to m points via Fourier interpolation by: a_resamp
= inverse_real_fft(real_fft(a), m).
This is the inverse of real_fft:
inverse_real_fft(real_fft(a), len(a)) == a
within numerical accuracy.i i N( R R R R R R R R R R R R"