![]() |
My implementation of a wrapper for FFTW for use with ROOT thing. More...
Enumerations | |
enum | conventionFlag { kSum = 0, kAverage = 1, kTimeIntegral = 2, kPowSpecDensity = 3, kPowSpecDensity_dBm = 4 } |
Flag to pass to FancyFFT functions specifying normalization of power spectra. | |
Functions | |
complex< double > * | doFFT (int len, double *input, bool copyOutputToNewArray, int threadInd=0) |
Does a forward fast fourier transform on a real input array. More... | |
complex< double > * | doFFT (int len, double *input, complex< double > *output, int threadInd=0) |
Does a forward fast fourier transform on a real input array. More... | |
complex< double > * | doFFT (int len, double *input, complex< double > *output, bool copyOutputToNewArray, int threadInd=0) |
Does a forward fast fourier transform on a real input array. More... | |
double * | doInvFFT (int len, complex< double > *input, bool copyOutputToNewArray, int threadInd=0) |
Does an inverse fast fourier transform on an array of complex<double>s. More... | |
double * | doInvFFT (int len, complex< double > *input, double *output, int threadInd=0) |
Does an inverse fast fourier transform on an array of complex<double>s. More... | |
double * | doInvFFT (int len, complex< double > *input, double *output, bool copyOutputToNewArray, int threadInd=0) |
Does an inverse fast fourier transform on an array of complex<double>s. More... | |
double * | getPowerSpectrum (int len, double *input, double dt, conventionFlag normFlag, int threadInd=0) |
Creates the power spectrum in an array of doubles of length (len/2 + 1). More... | |
double * | getPowerSpectrum (int len, double *input, double dt, conventionFlag normFlag, double *outputPtr, int threadInd=0) |
Creates the power spectrum in an array of doubles of length (len/2 + 1). More... | |
TGraph * | getPowerSpectrumTGraph (int len, double *input, double dt, conventionFlag normFlag, bool dBScale, int threadInd=0) |
Creates a power spectrum TGraph from an array of doubles. More... | |
double * | getFreqArray (int len, double dt) |
Get the array of frequencies to go with FFT output, determined by the tranform length and dt. More... | |
int | getNumFreqs (int len) |
Get the number of frequencies from the number of samples. More... | |
int | printListOfKeys () |
Prints the list of keys of plans to stdout. | |
double * | crossCorrelate (int len, double *v1, double *v2, int threadInd=0) |
Cross correlates the two input arrays. More... | |
double * | crossCorrelate (int len, complex< double > *fft1, complex< double > *fft2, int threadInd=0) |
Cross correlates the two input arrays. More... | |
double * | crossCorrelate (int len, complex< double > *fft1, complex< double > *fft2, double *output, int threadInd=0) |
Cross correlates the two input arrays. More... | |
int | extendToPowerOfTwo (int len) |
Find the next highest power of two. More... | |
complex< double > * | zeroPadFFT (complex< double > *fft, int numSamples, int numSamplesUpsampled) |
Zero padds FFTts,. More... | |
complex< double > * | zeroPadFFT (complex< double > *fft, complex< double > *output, int numSamples, int numSamplesUpsampled) |
Zero padds FFTts,. More... | |
bool | makeNewPlanIfNeeded (int len, int threadInd=0) |
Creates new fftw plan to handle 1D transforms of length len if they haven't been allocated already. More... | |
double * | getRealArray (std::pair< Int_t, Int_t > key) |
Get the real array of the internal fftw memory. Do not delete this! More... | |
My implementation of a wrapper for FFTW for use with ROOT thing.
Most functionality has been merged into FFTtools, except some of the threading options. Hopefully that will get done at some point in the future and this namespace can be done away with.
double * FancyFFTs::crossCorrelate | ( | int | len, |
double * | v1, | ||
double * | v2, | ||
int | threadInd = 0 |
||
) |
Cross correlates the two input arrays.
len | is the length of both arrays, v1 and 2. |
v1 | is the first input array. |
v2 | is the second input array. |
threadInd | uses a particular threads plans to do the ffts. |
Definition at line 541 of file FancyFFTs.cxx.
double * FancyFFTs::crossCorrelate | ( | int | len, |
complex< double > * | fft1, | ||
complex< double > * | fft2, | ||
int | threadInd = 0 |
||
) |
Cross correlates the two input arrays.
len | is the length of both arrays, v1 and 2. |
fft1 | is the fft of the first input array. |
fft2 | is the fft of the second input array. |
threadInd | uses a particular threads plans to do the ffts. |
Definition at line 593 of file FancyFFTs.cxx.
double * FancyFFTs::crossCorrelate | ( | int | len, |
complex< double > * | fft1, | ||
complex< double > * | fft2, | ||
double * | output, | ||
int | threadInd = 0 |
||
) |
Cross correlates the two input arrays.
len | is the length of the time domain input (not the length of the ffts). |
fft1 | is the fft of the first input array. |
fft2 | is the fft of the second input array. |
output | is a pointer to copy the outputted cross correlations to. |
threadInd | uses a particular threads plans to do the ffts. |
Definition at line 612 of file FancyFFTs.cxx.
complex< double > * FancyFFTs::doFFT | ( | int | len, |
double * | input, | ||
bool | copyOutputToNewArray, | ||
int | threadInd = 0 |
||
) |
Does a forward fast fourier transform on a real input array.
len | is the length of the input. |
input | is a pointer to an array of doubles of length len. |
copyOutputToNewArray | leave output in internal memory (false) or allocate new memory and copy (true). |
threadInd | uses a particular threads plans to do the ffts. |
Definition at line 212 of file FancyFFTs.cxx.
complex< double > * FancyFFTs::doFFT | ( | int | len, |
double * | input, | ||
complex< double > * | output, | ||
int | threadInd = 0 |
||
) |
Does a forward fast fourier transform on a real input array.
len | is the length of the input. |
input | is a pointer to an array of doubles of length len. |
output | is a pointer to an array of complex<double> to copy the output to. |
threadInd | uses a particular threads plans to do the ffts. |
Definition at line 228 of file FancyFFTs.cxx.
complex< double > * FancyFFTs::doFFT | ( | int | len, |
double * | input, | ||
complex< double > * | output, | ||
bool | copyOutputToNewArray, | ||
int | threadInd = 0 |
||
) |
Does a forward fast fourier transform on a real input array.
len | is the length of the input. |
input | is a pointer to an array of doubles of length len. |
output | is a pointer to an array of complex<double> to copy the output to. |
copyOutputToNewArray | leave output in internal memory (false) or allocate new memory and copy (true). |
threadInd | uses a particular threads plans to do the ffts. |
Definition at line 245 of file FancyFFTs.cxx.
double * FancyFFTs::doInvFFT | ( | int | len, |
complex< double > * | input, | ||
bool | copyOutputToNewArray, | ||
int | threadInd = 0 |
||
) |
Does an inverse fast fourier transform on an array of complex<double>s.
len | is the length of the real output array. |
input | is a pointer to an array of complex<double>s of length (len/2 +1). |
copyOutputToNewArray | leave output in internal memory (false) or allocate new memory and copy (true). |
threadInd | uses a particular threads plans to do the ffts. |
Definition at line 288 of file FancyFFTs.cxx.
double * FancyFFTs::doInvFFT | ( | int | len, |
complex< double > * | input, | ||
double * | output, | ||
int | threadInd = 0 |
||
) |
Does an inverse fast fourier transform on an array of complex<double>s.
len | is the length of the real output array. |
input | is a pointer to an array of complex<double>s of length (len/2 +1). |
output | is a pointer to an array of doubles to copy the output to. |
threadInd | uses a particular threads plans to do the ffts. |
Definition at line 306 of file FancyFFTs.cxx.
double * FancyFFTs::doInvFFT | ( | int | len, |
complex< double > * | input, | ||
double * | output, | ||
bool | copyOutputToNewArray, | ||
int | threadInd = 0 |
||
) |
Does an inverse fast fourier transform on an array of complex<double>s.
len | is the length of the real output array. |
input | is a pointer to an array of complex<double>s of length (len/2 +1). |
output | is a pointer to an array of doubles to copy the output to. |
copyOutputToNewArray | leave output in internal memory (false) or allocate new memory and copy (true). |
threadInd | uses a particular threads plans to do the ffts. |
Definition at line 325 of file FancyFFTs.cxx.
int FancyFFTs::extendToPowerOfTwo | ( | int | len | ) |
Find the next highest power of two.
len | is the number to find the next highest power of two. |
Definition at line 377 of file FancyFFTs.cxx.
double * FancyFFTs::getFreqArray | ( | int | len, |
double | dt | ||
) |
Get the array of frequencies to go with FFT output, determined by the tranform length and dt.
len | is the length of the real fft input. |
dt | is the time between real input samples. |
Definition at line 394 of file FancyFFTs.cxx.
int FancyFFTs::getNumFreqs | ( | int | len | ) |
Get the number of frequencies from the number of samples.
len | is the length of the real fft input. |
Definition at line 416 of file FancyFFTs.cxx.
double * FancyFFTs::getPowerSpectrum | ( | int | len, |
double * | input, | ||
double | dt, | ||
FancyFFTs::conventionFlag | normFlag, | ||
int | threadInd = 0 |
||
) |
Creates the power spectrum in an array of doubles of length (len/2 + 1).
len | is the length of the input. |
input | is a pointer to an array of doubles of length len. |
dt | is the time step between samples. |
normFlag | is a flag specifying how to normalize the output TGraph. |
threadInd | uses a particular threads plans to do the ffts. |
Definition at line 77 of file FancyFFTs.cxx.
double * FancyFFTs::getPowerSpectrum | ( | int | len, |
double * | input, | ||
double | dt, | ||
FancyFFTs::conventionFlag | normFlag, | ||
double * | outputPtr, | ||
int | threadInd = 0 |
||
) |
Creates the power spectrum in an array of doubles of length (len/2 + 1).
len | is the length of the input. |
input | is a pointer to an array of doubles of length len. |
dt | is the time step between samples. |
normFlag | is a flag specifying how to normalize the output TGraph. |
threadInd | uses a particular threads plans to do the ffts. |
outputPtr | can be used to direct FancyFFTs to copy the output into pre-allocatred memory. |
Definition at line 98 of file FancyFFTs.cxx.
TGraph * FancyFFTs::getPowerSpectrumTGraph | ( | int | len, |
double * | input, | ||
double | dt, | ||
FancyFFTs::conventionFlag | normFlag, | ||
bool | dBScale, | ||
int | threadInd = 0 |
||
) |
Creates a power spectrum TGraph from an array of doubles.
len | is the length of the input. |
input | is a pointer to an array of doubles of length len. |
dt | is the time step between samples. |
normFlag | is a flag specifying how to normalize the output TGraph. |
dBScale | specifies whether to return the TGraph in dB or linear scale. |
threadInd | specifies the thread index of the fftw plans to use. |
Definition at line 52 of file FancyFFTs.cxx.
double * FancyFFTs::getRealArray | ( | std::pair< Int_t, Int_t > | key | ) |
Get the real array of the internal fftw memory. Do not delete this!
key | is an std::pair of the real array length and the thread index of the plan. |
Definition at line 673 of file FancyFFTs.cxx.
bool FancyFFTs::makeNewPlanIfNeeded | ( | int | len, |
int | threadInd = 0 |
||
) |
Creates new fftw plan to handle 1D transforms of length len if they haven't been allocated already.
len | is the length of the input. |
threadInd | is the index of the thread that needs an fftw plan. |
Definition at line 19 of file FancyFFTs.cxx.
complex< double > * FancyFFTs::zeroPadFFT | ( | complex< double > * | fft, |
int | numSamples, | ||
int | numSamplesUpsampled | ||
) |
Zero padds FFTts,.
fft | is the unpadded fft. |
numSamples | is the length of the time domain of the fft (i.e. NOT the number of frequency bins) |
numSamplesUpsampled | is the length of the time domain of the padded fft (i.e. NOT the number of frequency bins) |
This is for doing interpolation in the time domain. Zero padding in the time/frequency domain is equivelent to interpolation in the time/frequency domain.
Definition at line 436 of file FancyFFTs.cxx.
complex< double > * FancyFFTs::zeroPadFFT | ( | complex< double > * | fft, |
complex< double > * | output, | ||
int | numSamples, | ||
int | numSamplesUpsampled | ||
) |
Zero padds FFTts,.
fft | is the unpadded fft. |
numSamples | is the length of the time domain of the fft (i.e. NOT the number of frequency bins) |
numSamplesUpsampled | is the length of the time domain of the padded fft (i.e. NOT the number of frequency bins) |
output | is where the padded fft should be copied to. |
This is for doing interpolation in the time domain. Zero padding in the time/frequency domain is equivelent to interpolation in the time/frequency domain.
Definition at line 457 of file FancyFFTs.cxx.