Why does pyfftw output zero?

You’re not calling execute(). Via the docs:

The actual FFT or iFFT is performed by calling the execute() method.

execute():
Execute the planned operation, taking the correct kind of FFT of the input array (i.e. FFTW.input_array), and putting the result in the output array (i.e. FFTW.output_array).

You might also want to use the “easier” interfaces described over here:

b = pyfftw.interfaces.numpy_fft.fft(a)

You need to call execute().

pyfftw.FFTW(a,b,axes = (-2,-1), direction = 'FFTW_FORWARD').execute()

Read more here: Source link