jz87
jz87

Reputation: 9627

Why does numpy.fft.irfft2 output have non-power of 2 shape?

I input a 1024x512 array into numpy.fft.irfft2 and get back out a 1024x1022 array out. Why don't I get 1024x1024? I would like to get a square matrix out.

Upvotes: 1

Views: 350

Answers (1)

vroomfondel
vroomfondel

Reputation: 3106

"In the final transformed axis the length of the output when s is not given is 2*(m-1) where m is the length of the final transformed axis of the input."

You need to specify 's' as a parameter.

http://docs.scipy.org/doc/numpy/reference/generated/numpy.fft.irfftn.html#numpy.fft.irfftn

(irfftn has better docs than irfftn2, 's' does the same thing in both)

Upvotes: 1

Related Questions