Using the Fast Fourier Transform API

The "IntUtilWrapper" module provides FFT capabilities that can be used in your INTViewer modules.

In "IntUtilWrapper" module, the com.interactive.util.analysis.fft.cgStandardFFTFactory class can be used to create an instance of an FFT object. The following code initializes a cgComplexFFT object and performs a forward Fourier transform on a real data set _sample_trace with a specified sample rate.

String DEFAULT_FFT_IMPLEMENTATION = cgStandardFFTFactory.RADIX_2_4_8;
cgComplexFFT _fft = cgStandardFFTFactory.getInstance(DEFAULT_FFT_IMPLEMENTATION);
// Forward fast Fourier transformation
_fft.fft(_sample_trace, _sample_rate);
double[] real_trace = _fft.getFFTRealDbl();
double[] imag_trace = _fft.getFFTImagDbl();

If the data set to transform includes an imaginary component, the method fftcmplx(double[] real, double[] imag, double sampleRate) should be used instead. These methods do not specify an array length and will expand the input arrays to the next power of 2 multiple.

After the forward transform has been performed, the real and imaginary sections of the data can be queried using the getFFTRealDbl() and getFFTImagDbl() methods. Alternatively, the methods getFFTReal() and getFFTImag() are available to retrieve a float array.

// Inverse Fourier transform
_fft.ifftcmplx(real_trace, imag_trace, _sample_rate);
double[] filtered_real = _fft.getIFFTRealDbl();
double[] filtered_imag = _fft.getIFFTImagDbl();

The inverse transform is calculated in the same fashion using the ifftcmplx methods and the computed arrays can be queried using the getIFFTRealDbl() and _fft.getIFFTImagDbl() methods.