I am working on FFT analysis AFM like the one shown below. I am currently at a point where I understand fairly well what an FFT does, and how to think about the information it gives. I currently have an $M\times N$ matrix of Fourier coefficients (FC) for a 2D-image like the one below. Choosing to look at the real and imaginary part of the FC's gives the amplitudes for sine and cosine terms in the Fourier expansion. I use the notation $X[k,l]$ to index the FC's. For some of my images the real and imaginary parts of the FFT look something like what is shown below.

Sample Image:

Real part of FC's:

Imaginary part of FC's:

Note that the above FC plots are not for the image shown above. I am looking now to pull out the dominant functional forms. In general with these experiments it is expected that there will be 2 two-directions along which there are dominant sinusoids.

Are there standard ways of computing an average amplitude for 2D-FFT's? I was thinking that there is probably a way to perform a weighted average using the magnitudes of the Fourier coefficients. References and suggestions appreciated.


I am thinking something like this in order to compute the average amplitude:

$\langle X \rangle=\sum_{k=0}^{M-1}\sum_{l=0}^{M-1}\frac{X_R^2}{X_R^2+X_I^2}X_R(k,l)-\frac{X_I^2}{X_R^2+X_I^2}X_I(k,l)$

The terms in front of $X_R$ and $X_I$ are my crude way to weight the importance of each sinusoid to the total signal. I have no justification for my choice, which is something I would like clarified. Perhaps there is an accepted way to weight the amplitudes. Clearly, my average is bad because of when $X_R=X_I=0$ I get a 0/0.



The definition posted by @user3661852 is a good one : it arises from the Parseval's_theorem. This theorem states the L2 norm of any square integrable signal $x$ is equal to the L2 norm of its fft $X$. See this link for a similar version for periodic signals, which writes :


where $X^*(i)$ is the complex conjugate of $X(i)$.

For a 2D NxM signal :


If $x$ is not null, a weight $w(k,l)$ can be defined as :


The sum of weights is 1.

EDIT : In this question, the formula may be applied on the dft if the dft is defined as :

$X(k,l)=\displaystyle\sum_{i=0}^{N-1}\sum_{j=0}^{M-1}x(i,j)e^{-2\pi\sqrt{-1}\frac iN}e^{-2\pi\sqrt{-1}\frac jM}$

This formula for dft is the one used by numpy.fft , cufft and fftw. If a scale factor is added to your definition, to adjust it correctly, compute the zero frequency $X(0,0)$ : it is related to the average of the signal.

  • $\begingroup$ If I am using the definition $x(m,n)=\sum_k\sum_l (X(k,l)\exp(+))$ and $X(k,l)=(1/MN)\sum_m\sum_n(x(m,n)\exp(-))$, it is correct to write $\langle X\rangle=\sqrt{\sum_k\sum_l(X_R^2+X_I^2)}$, right? I am mentally stuck on using a definition from a textbook, when SciPy uses 1/(MN) factor on the opposite terms than myself. $\endgroup$ – wgwz Apr 16 '15 at 20:44
  • $\begingroup$ Yes, it is correct since the definition of dft you wrote is already normalized. Notice that it is not the case if you are using numpy.fft , cufft or fftw. The scale factor is just a matter of convention. To adjust it correctly, compute the zero frequency $X(0,0)$ : it should be scaled to the average of the signal. $\endgroup$ – francis Apr 17 '15 at 6:59

Easy thing first: You might want to look into spatial statistics

Long Stuff:

The trouble with comparing materials science information (eg AFM) is that the piece of material was measured at a position in space and time. It is difficult to quantitatively compare images in one place and an image in another place.

When you take the Fourier transform, you are measuring the frequency of that material at a position in space and time.

You can remove the spatial dependency by taking a convolution of the Fourier transform with itself. This process is akin to Point Distribution Functions, N-Point Statistics, or Joint Probability Density Functions. The Spatial Statistics Matlab library can be applied to most image data.

  • $\begingroup$ Thanks! I will check out those first two resources and consider using them. For the experiments I am working with, I am currently taking the AFM images at point in time where the dynamics should be very slow. At least slow enough that I don't think that image will change very much as its being imaged. I will definitely look into removing spatial dependency. Any ideas on the type of averaging for the FC's I am looking to do? $\endgroup$ – wgwz Apr 16 '15 at 15:59
  • $\begingroup$ It is important to the experiment that the dynamics are slow, but that is a physical property implied in the data. When you are comparing images from many experiments different sources of uncertainty are introduced. For example, AFM is very sensitive to humidity, pressure, electrostatics, and also how much coffee you may have drank. When you average the information over many experiments, you must compare the images in a statistical way. The statistics of the images allow for objective comparisons over many experiments. $\endgroup$ – Tony Fast Apr 17 '15 at 20:35
  • $\begingroup$ Thanks for explaining that. I will definitely look more into Spatial Statistics. Do you know of any similiar Spatial Statistics libraries that are written in Python? I have used Matlab, but not nearly as much as I've used Python. p.s. I'm a big fan of coffee, just saying. $\endgroup$ – wgwz Apr 17 '15 at 22:38
  • $\begingroup$ I would take a look at the issues in pymks. This toolbox has a lot of advanced statistical and machine learning tools specifically design for materials science. this is a stand alone function in an python notebook, it's not tested at all though. $\endgroup$ – Tony Fast Apr 19 '15 at 1:57

Take the average of the amplitudes for each frequency.

$$ \langle X_{amplitude} \rangle = \frac{1}{NM} \sum_{k=0}^{M-1} \sum_{l=0}^{N-1} X[k,l] X^{*}[k, l]$$

$X^{*}$ is the complex conjugate of $X$.

  • $\begingroup$ This is a trivial point, but does this average amplitude expression assume that the (1/N*M) factor is in front of the expansion of the signal or the Fourier coefficients? Thanks, for the responses! @francis same question applies for your post. $\endgroup$ – wgwz Apr 16 '15 at 18:02

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.