fftwEngine

class fftwEngine : public kotekan::Stage

Kotekan Stage to Fourier Transform an input stream of samples.

Reads samples from an input buffer, FFTs them with FFTW, and writes the resulting complex spectra into an output buffer. Both input and output buffers’ frame lengths must be integer multiples of one FFT’s worth of data.

Two input formats are supported, selectable via input_type:

  • complex (default): packed int16 I/Q pairs. Each FFT consumes spectrum_length complex samples and emits spectrum_length complex bins. The output is fftshifted — the two halves of the raw FFT are swapped (memcpy of spectrum_length/2 bins each way) so DC lands at index spectrum_length/2 and bins run monotonically from -Fs/2 up to +Fs/2.

  • real: packed int16 real samples. Each FFT consumes 2*spectrum_length real samples and emits spectrum_length complex bins (the first half of an r2c transform; Nyquist bin discarded). No fftshift here — bins run 0 (DC) up to just below Fs/2.

Depends on libfftw3.

Buffers

  • in_buf Input kotekan buffer.

    • Format: Array of int16_t (real samples, or interleaved I/Q pairs)

    • Metadata: none

  • out_buf Output kotekan buffer.

    • Format: Array of fftwf_complex

    • Metadata: none

Author

Keith Vanderlinde

Param spectrum_length:

Int (default 128). Number of complex bins per output spectrum.

Param input_type:

String (default “complex”). One of “complex” or “real”.

Public Functions

fftwEngine(kotekan::Config &config, const std::string &unique_name, kotekan::bufferContainer &buffer_container)
~fftwEngine() override
virtual void main_thread() override