1

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?

Gwanguy
  • 333
  • 1
  • 8
  • 1
    Look at FourierParameters -- chances are FourierPainter and the Mathematica default are different. – bill s Apr 22 '18 at 01:20
  • 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... – Gwanguy Apr 22 '18 at 20:27
  • 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. – bill s Apr 22 '18 at 21:54
  • 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. – Gwanguy Apr 23 '18 at 12:21
  • Are you looking at real + imaginary or at magnitude + phase? If phase, is it in radians or degrees? – bill s Apr 23 '18 at 16:27
  • I look at the Abs[] (which is the Norm of the complex number) of the Fourier map squared (for the power spectrum). – Gwanguy Apr 23 '18 at 19:29
  • How does FourierPainter handle color? Maybe it deals with the three RGB channels rather than converting to Greyscale? – bill s Apr 23 '18 at 21:56
  • The reconstruction of the image in FourierPainter is in Grayscale, so that's why we started working with the Grayscale. It seems that handling colors requires more math like found in https://ieeexplore.ieee.org/document/723451/. – Gwanguy Apr 24 '18 at 10:50

0 Answers0