Luna
Luna

Reputation: 13

numpy rfftn changes input dimensions

I want to compute the discrete Fourier Transform of a 3D numpy array. I'm using the numpy.fft.rfftn function but its output has different dimensions of the input, how can I fix this? Here it is my code:

np.shape(img_coll)
>>> (9997, 50, 50)
img_spectrum = np.fft.rfftn(img_coll, axes = [0])
np.shape(img_spectrum)
>>>(4999, 50, 50)

Thank you very much for helping.

Upvotes: 0

Views: 505

Answers (1)

dobkind
dobkind

Reputation: 426

There is nothing to fix in your code. If your signal is real, then its Fourier transform is conjugate symmetric. In other words, the frequency-domain signal img_spectrum (along the first axis axes=[0]) has even magnitude and odd phase, so the user is responsible of reconstructing the Fourier-transformed signal.

Upvotes: 1

Related Questions