#include <das2/dft.h>
An amplitude preserving Discrete Fourier Transform converter.
This is small wrapper around fftw to handle memory management, normalization, and windowing
Public Member Functions | |
Das2Dft * | new_Dft (size_t uLen, const char *sWindow) |
Create a new DFT calculator. | |
void | del_Dft (Das2Dft *pThis) |
Free a DFT (Discrete Fourier Transform) calculator. | |
ErrorCode | Dft_calculate (Das2Dft *pThis, const double *pReal, const double *pImg, size_t uLen) |
Calculate a discrete Fourier transform. | |
const double * | Dft_getImg (Das2Dft *pThis, size_t *pLen) |
Return the imaginary component after a calculation. | |
const double * | Dft_getMagnitude (Das2Dft *pThis, size_t *pLen) |
Get the amplitude magnitude vector from a calculation. |
Das2Dft * new_Dft | ( | size_t | uLen, | |
const char * | sWindow | |||
) |
Create a new DFT calculator.
nLen | - The length of the data vectors that will be supplied to the calculate function | |
sWindow | - A named window to apply to the data. If NULL then no window will be used. |
void del_Dft | ( | Das2Dft * | pThis | ) |
Free a DFT (Discrete Fourier Transform) calculator.
pThis | the DFT calculator to free, the caller should set the object pointer to NULL after this call. |
Calculate a discrete Fourier transform.
Using the calculation plan setup in the constructor, calculate a discrete Fourier transform. When this function is called internal storage of any previous DFT calculations (if any) are over written.
pThis | The DFT object | |
pReal | A "time domain" input vector of length uLen | |
pImg | The imaginary (or quadrature phase) input vector of length uLen. For a purely real signal this vector is NULL. | |
uLen | The number of reals in the input signal. If this value changes between successive calls to this function for the same Dft object then you're code will take a performance hit. |
const double * Dft_getImg | ( | Das2Dft * | pThis, | |
size_t * | pLen | |||
) |
Return the imaginary component after a calculation.
pThis | ||
pLen |
const double * Dft_getMagnitude | ( | Das2Dft * | pThis, | |
size_t * | pLen | |||
) |
Get the amplitude magnitude vector from a calculation.
Scale the stored DFT so that it preserves amplitude, and get the magnitude. For real-valued inputs (complex pointer = 0) the 'positive' and 'negative' frequencies are combined. For complex input vectors this is not the case since all DFT output amplitudes are unique. Stated another way, for complex input signals components above the Nyquist frequency have meaningful information.
pThis | The DFT calculator object which has previously been called to calculate a result. | |
pLen | The vector length. In general this is *NOT* the same as the input time series length. For real-value input signals (complex input is NULL, this is N/2 + 1. For complex input signals this is N. |