Documentation
FFT function.
This function generates an fft of a real or complex data set. The
output can be either a power spectrum or the raw fft. The input data
can be either a single array of floats for real input data or an array
of pairs of floats for complex input data array.
- Returns:
- s -1 if error, 0 otherwise.
- Parameters:
- p_mode - For an explanation of possible values see above
Flags.
pset - A structure of type fftparam (see header fftmodule.h
for definition). pset->windowed_data and
pset->window_array should be allocated memory by the
calling function. pset->windowed_data should have
2*timeseries_length*sizeof(float) length if the data is
complex, or timeseries_length*sizeof(float) if real.
pset->window_array should be of size
timeseries_length*sizeof(float). This structure can be
kept between multiple function calls if psGen will be
called for the same sized data set multiple times for
the same data_type.
timeseries_length - The number of real or complex data points
in the time series. Should always be a
power of two. Function will return an error
(-1) if it is not.
data_type - Either DATA_REAL (0) or DATA_COMPLEX (1). Refers
to the timeseries data input.
data - An array of real or complex input data.
timestep - The time interval (s) between successive data points.
output_format - One of 5 choices
OUTPUT_AMPPERRTBIN (=0) a power spectrum with
normalization such that a sine wave input of
amplitude 1 yields a peak of height 1/sqrt2.
OUTPUT_PSD (=1) a power spectral density with
units rms amplitude per rtHz.
OUTPUT_COMPMINUSFTOF (=2) an fft output with the most
negative negative frequency { (-Fn*(n/2-1 / n/2))
where Fn is the nyquist frequency and n is the number
of timeseries bins } first and the nyquist frequency
last. Each bin has the real part first and the
imaginary second. The normalization is such that
the sum of contributions from -F and F yields
a power spectral density in amplitude rms per rtHz.
OUTPUT_COMPNATIVE (=3) returns data in the same format
as used by fftw. The relevant manual pages are in:
theory.lcs.mit.edu/~fftw/doc/fftw_3.htmlSEC17.For complex input data, the format is the same
as numerical recipes fig 12.2.2
OUTPUT_GDSFORMAT (=4) .For real input data the format
is r0 i0 r1 i1 ... r(n/2-1) i(n/2-1). The first
bin is DC, so i0=0. The last bin is the frequency
just below the nyquist frequency. For complex input
data, the format is the same as numerical recipes
figure 12.2.2 (DC first, then positive frequency
components in ascending order, then the nyquist
frequency, then from the most negative frequency
above (-) the nyquist frequency up to the bin just
below DC. Each bin is 2 elements, real then imag.
window - Determines the window type.
WINDOW_UNIFORM (=0) no windowing
WINDOW_HANNING (=1) from numerical recipes
WINDOW_FLATTOP (=2) from Stanford SR785 manual
WINDOW_WELCH (=3) from Numerical Recipes
WINDOW_BARTLETT (=4) from Numerical Recipes
WINDOW_BMH (=5) from Stanford SR785 manual
WINDOW_HAMMING (=6) from Blackman and Tukey (see top
of page)
result - Pointer to the result data. Always allocate
timeseries_length*2*sizeof(float) bytes to this pointer,
even if the output data set will be shorter than this.
- Author:
- Edward Daw, June 1999
alphabetic index hierarchy of classes