My question is at the boundary between signal processing and python.

I have a 2d power spectral density function (PSDF) constructed on Nx/2 + 1 and Ny/2 + 1 positive spatial frequency points superimposed with random phase (the random numbers are drawn from a uniform distribution). I would like to take its 2d inverse Fourier transform (in python numpy numpy.fft.iff2()) to retrieve its (Nx,Ny)) autocorrelation function. For this I have to construct 2d symmetries or mirrors of the complex PSDF.

Here is where my question comes in, how do I construct the mirrors? I found a tone of similar questions on the 1d fft case which is straightforward. It turns out that in 2d fft2, the mirrors have a different order ;

The 1st quadrant [1:Nx/2+1,1:Ny/2+1] is the complex conjugate mirror of the 4th quadrant [(Nx/2+2):Nx,(Ny/2+2):Ny] and the 2nd quadrant [1:(Nx/2 +1),(Ny/2+1):Ny] is the complex conjugate mirror of the 3rd quadrant [(Nx/2+2):Nx,1:(Ny/2+1)] (The convention of the slicing may differ between different languages and if Nx and Ny are even or odd, so pay little attention to that).

Given that 1st and 3rd quadrants are not mirrors of each other (same with the 2nd and 4th quadrant), does it mean that you cannot reconstruct the complete (Nx,Ny) autocorrelation function using the first (Nx/2+1,Ny/2+1) PSDF values ? Is there something I am missing here?

Below is a sample python code using numpy.fft.fft2d to show this :

import numpy as np
x1 = np.arange(6)*1e-5
y1 = np.arange(6)*0.25
z = np.zeros( (len(x1),len(y1)) )
z = (x1[:,np.newaxis] + 2* y1[np.newaxis,:])  + 3
z_fft = np.fft.fft2(z)

The screen output is the following :

[[  1.530e+02 +0.000e+00j  -9.000e+00 +1.559e+01j  -9.000e+00 +5.196e+00j  -9.000e+00 +0.000e+00j  -9.000e+00 -5.196e+00j  -9.000e+00 -1.559e+01j]
 [ -1.800e-04 +3.118e-04j  -7.692e-16 -2.546e-15j   1.392e-15 -8.802e-16j  -1.776e-15 +0.000e+00j   2.161e-15 -6.582e-16j   7.692e-16 +1.007e-15j]
 [ -1.800e-04 +1.039e-04j  -3.251e-16 +1.776e-15j  -1.717e-15 +1.110e-16j   1.776e-15 +0.000e+00j  -9.477e-16 -1.110e-16j   1.213e-15 -1.776e-15j]
 [ -1.800e-04 +0.000e+00j  -8.882e-16 +0.000e+00j   8.882e-16 +8.882e-16j  -1.776e-15 +0.000e+00j   8.882e-16 -8.882e-16j  -8.882e-16 -0.000e+00j]
 [ -1.800e-04 -1.039e-04j   1.213e-15 +1.776e-15j  -9.477e-16 +1.110e-16j   1.776e-15 +0.000e+00j  -1.717e-15 -1.110e-16j  -3.251e-16 -1.776e-15j]
 [ -1.800e-04 -3.118e-04j   7.692e-16 -1.007e-15j   2.161e-15 +6.582e-16j  -1.776e-15 +0.000e+00j   1.392e-15 +8.802e-16j  -7.692e-16 +2.546e-15j]]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.