We are trying to make sense of the numbers provided by the PC program FourierPainter for a 2D Fourier Transform of a diffraction pattern.

enter image description here

We would like to evaluate the ratio of the zeroth harmonic to the first harmonic intensities. Refer to the Notebook here. There are references to other Mathematica Stack Exchange Posts here and here in it as well as our analysis. Here is a sample of our code (two$D$image is the import of our image):

fftshift[dat_?ArrayQ, k : (_Integer?Positive | All) : All] :=Module[{dims = Dimensions[dat]}, RotateRight[dat,If[k === All, Quotient[dims, 2], Quotient[dims[[k]], 2] UnitVector[Length[dims], k]]]]

img = ColorConvert[two$D$image, "Grayscale"];

(tst = Abs[fftshift[
      Fourier[ImageData[img], FourierParameters -> {1, -1}]]]^2);

(tst$arg = Arg[fftshift[Fourier[ImageData[img], FourierParameters -> {1, -1}]]]);

abs = Log[1 + tst]

Manipulate[DynamicModule[{b = {}, i = slice},Do[AppendTo[b, {j - (2616/2), abs[[j, i]]}],{j, 1, Dimensions[abs][[1]]}];ListPlot[Total[#] & /@ Partition[b, group], PlotLabel -> "Pixels referenced to center " <> ToString[(3488/2) - i], PlotRange -> {Full, Full}]],{{slice, 3488/2}, 1, 3488, 1}, {{group, 1}, InputField}]

FourierPainter gives numbers for this pattern of the order of 5000/3000 for the intensities of the harmonics while Mathematica gives numbers of the order of 10$^{13}$/10$^{11}$ for the power spectrum of the same file. How to reconcile these numbers?

  • 1
    $\begingroup$ Look at FourierParameters -- chances are FourierPainter and the Mathematica default are different. $\endgroup$ – bill s Apr 22 '18 at 1:20
  • $\begingroup$ We can't find the FourierParameters of FourierPainter. Mathematica documentation has only the combination FourierParameters->{0,1}, {-1,1} (data analysis) and {1,-1} (signal processing). I looked at Fourier[] and the FourierParameters can be arbitrary {a,b}... What is the right way to extract the an intensity from a Fourier analysis? There are 2 orders of magnitude difference in our analysis... $\endgroup$ – Gwanguy Apr 22 '18 at 20:27
  • $\begingroup$ The difference between the various methods is scaling... and this is usually proportional to the number of points in the FFT, so depending on how many points are in the image, this can be a huge difference. I have no idea what FourierPainter is, so you will have to figure out what parameters they use. FourierParameters lets you specify any {a,b} pair for the scaling. $\endgroup$ – bill s Apr 22 '18 at 21:54
  • $\begingroup$ Thank you for your interest! Ok so the ratio between the points should be the same. We are interested in the ratio between the zeroth order and the first order in a diffraction pattern. If we forget scaling, we don't find that ratio to be the same from the programs. That's what puzzling to us. $\endgroup$ – Gwanguy Apr 23 '18 at 12:21
  • $\begingroup$ Are you looking at real + imaginary or at magnitude + phase? If phase, is it in radians or degrees? $\endgroup$ – bill s Apr 23 '18 at 16:27

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.