gr.fft_vfc, gr.fft_fcc



A very useful function, Fast Fourier Transform - the base software package, fftw (fastest fourier transform in the west) lives up to it's name. We can do forward and reverse transforms, with or without Hamming windowing, for user specified sizes. There are two flavors, both take a parallel vector input and produce complex vector output, but one takes float and the other complex. We convert a data stream to parallel vectors using gr.serial_to_parallel, then convert the output vectors to a stream using gr.parallel_to_serial.

Usage:
	gr.fft_vXc ( int fft_size, bool forward, bool window )
size is usually a power of 2 (256,512,2048), forward is 'True' or '1' for a forward (time domain to frequency domain) transform and 'False' for reverse (frequency domain to time domain), and window is 'True' for windowing.

Example (also see this):

	fft_size = 1024

        vec = []
        for i in range(0,19):           # 0 to 20
          vec += [1]
        for i in range(20,1024):        # 21 to 1023
          vec += [0]

        src = gr.vector_source_c(vec, 1)
        s2p = gr.serial_to_parallel (gr.sizeof_gr_complex, fft_size)
        ifft1 = gr.fft_vcc (fft_size,False,True) # inverse, windowing

        p2s = gr.parallel_to_serial (gr.sizeof_gr_complex, fft_size)
        ifft_out = gr.file_sink(gr.sizeof_gr_complex, "ifft")


The above creates a vector source pulse signal and performs an inverse fft with windowing, then writes the result to a disk file. You can then plot the data and every 1024 samples will be a window.