analistica/notes/sections/6.md

7.4 KiB

Exercise 6

Generating points according to Fraunhofer diffraction

The diffraction of a plane wave thorough a round slit must be simulated by generating N = 50'000 points according to the intensity distribution I(\theta) on a screen at a great distance L from the slit iself:


  I(\theta) = \frac{E^2}{2} \left( \frac{2 \pi a^2 \cos{\theta}}{L}
  \frac{J_1(x)}{x} \right)^2 \with x = k a \sin{\theta}

where:

  • E is the electric field amplitude, default set E = \SI{1e4}{V/m};
  • a is the radius of the slit aperture, default set a = \SI{0.01}{m};
  • \theta is the angle specified in @fig:fenditure;
  • J_1 is the Bessel function of first order;
  • k is the wavenumber, default set k = \SI{1e-4}{m^{-1}};
  • L default set L = \SI{1}{m}.

\begin{figure} \hypertarget{fig:fenditure}{% \centering \begin{tikzpicture} \definecolor{cyclamen}{RGB}{146, 24, 43} % Walls \draw [thick] (-1,3) -- (1,3) -- (1,0.3) -- (1.2,0.3) -- (1.2,3) -- (9,3); \draw [thick] (-1,-3) -- (1,-3) -- (1,-0.3) -- (1.2,-0.3) -- (1.2,-3) -- (9,-3); \draw [thick] (10,3) -- (9.8,3) -- (9.8,-3) -- (10,-3); % Lines \draw [thick, gray] (0.7,0.3) -- (0.5,0.3); \draw [thick, gray] (0.7,-0.3) -- (0.5,-0.3); \draw [thick, gray] (0.6,0.3) -- (0.6,-0.3); \draw [thick, gray] (1.2,0) -- (9.8,0); \draw [thick, gray] (1.2,-0.1) -- (1.2,0.1); \draw [thick, gray] (9.8,-0.1) -- (9.8,0.1); \draw [thick, cyclamen] (1.2,0) -- (9.8,-2); \draw [thick, cyclamen] (7,0) to [out=-90, in=50] (6.6,-1.23); % Nodes \node at (0,0) {$2a$}; \node at (5.5,0.4) {$L$}; \node [cyclamen] at (5.5,-0.4) {$\theta$}; \node [rotate=-90] at (10.2,0) {screen}; \end{tikzpicture} \caption{Fraunhofer diffraction.}\label{fig:fenditure} } \end{figure}

Once again, the try and catch method described in @sec:3 was implemented and the same procedure about the generation of \theta was employed. This time, though, \theta must be evenly distributed on half sphere:

\begin{align*} \frac{d^2 P}{d\omega^2} = const = \frac{1}{2 \pi} &\thus d^2 P = \frac{1}{2 \pi} d\omega^2 = \frac{1}{2 \pi} d\phi \sin{\theta} d\theta \ &\thus \frac{dP}{d\theta} = \int_0^{2 \pi} d\phi \frac{1}{2 \pi} \sin{\theta} = \frac{1}{2 \pi} \sin{\theta} , 2 \pi = \sin{\theta} \end{align*}

\begin{align*} \theta = \theta (x) &\thus \frac{dP}{d\theta} = \frac{dP}{dx} \cdot \left| \frac{dx}{d\theta} \right| = \left. \frac{dP}{dx} \middle/ , \left| \frac{d\theta}{dx} \right| \right. \ &\thus \sin{\theta} = \left. 1 \middle/ , \left| \frac{d\theta}{dx} \right| \right. \end{align*}

If \theta is chosen to grew together with x, then the absolute value can be omitted:

\begin{align*} \frac{d\theta}{dx} = \frac{1}{\sin{\theta}} &\thus d\theta \sin(\theta) = dx \ &\thus - \cos (\theta') |_{0}^{\theta} = x(\theta) - x(0) = x - 0 = x \ &\thus - \cos(\theta) + 1 =x \ &\thus \theta = \text{acos} (1 -x) \end{align*}

The sample was stored and plotted in a histogram with a customizable number $n$ of bins default set n = 150. In \textcolor{red}{fig} an example is shown.

\textcolor{red}{missing plot.}

Gaussian noise convolution

The sample must then be smeared with a gaussian noise with the aim to recover the original sample afterwards, implementing a deconvolution routine.
For this purpose, a 'kernel' histogram with a odd number m of bins and the same bin width of the previous one, but a smaller number of them (m < n), was filled with m points according to a gaussian distribution with mean \mu, corresponding to the central bin, and variance \sigma.
Then, the original histogram was convolved with the kernel in order to obtain the smeared signal. The procedure is summed up in \textcolor{red}{fig}.

\textcolor{red}{missing plots.}

The third histogram was obtained by keeping the same edges of the original signal and a number of bins n +m -1 (?). The convolution was obtained by permorming the dot product between the invere kernel and the clean signal for each relative position of the two histograms. For a better understaing, see \textcolor{red}{fig}.

\begin{figure} \hypertarget{fig:dot_conv}{% \centering \begin{tikzpicture} \definecolor{cyclamen}{RGB}{146, 24, 43} % original histogram \draw [thick, cyclamen, fill=cyclamen!15!white] (0.0,0) rectangle (0.5,2.5); \draw [thick, cyclamen, fill=cyclamen!15!white] (0.5,0) rectangle (1.0,2.8); \draw [thick, cyclamen, fill=cyclamen!15!white] (1.0,0) rectangle (1.5,2.3); \draw [thick, cyclamen, fill=cyclamen!15!white] (1.5,0) rectangle (2.0,1.8); \draw [thick, cyclamen, fill=cyclamen!15!white] (2.0,0) rectangle (2.5,1.4); \draw [thick, cyclamen, fill=cyclamen!15!white] (2.5,0) rectangle (3.0,1.0); \draw [thick, cyclamen, fill=cyclamen!15!white] (3.0,0) rectangle (3.5,1.0); \draw [thick, cyclamen, fill=cyclamen!15!white] (3.5,0) rectangle (4.0,0.6); \draw [thick, cyclamen, fill=cyclamen!15!white] (4.0,0) rectangle (4.5,0.4); \draw [thick, cyclamen, fill=cyclamen!15!white] (4.5,0) rectangle (5.0,0.2); \draw [thick, cyclamen, fill=cyclamen!15!white] (5.0,0) rectangle (5.5,0.2); \draw [thick, cyclamen] (6.0,0) -- (6.0,0.2); \draw [thick, cyclamen] (6.5,0) -- (6.5,0.2); \draw [thick, <->] (0,3.3) -- (0,0) -- (7,0); % kernel histogram \draw [thick, cyclamen, fill=cyclamen!15!white] (1.0,-1) rectangle (1.5,-1.2); \draw [thick, cyclamen, fill=cyclamen!15!white] (1.5,-1) rectangle (2.0,-1.4); \draw [thick, cyclamen, fill=cyclamen!15!white] (2.0,-1) rectangle (2.5,-1.8); \draw [thick, cyclamen, fill=cyclamen!15!white] (2.5,-1) rectangle (3.0,-1.4); \draw [thick, cyclamen, fill=cyclamen!15!white] (3.0,-1) rectangle (3.5,-1.2); \draw [thick, <->] (1,-2) -- (1,-1) -- (4,-1); % arrows \draw [thick, <->] (1.25,-0.2) -- (1.25,-0.8); \draw [thick, <->] (1.75,-0.2) -- (1.75,-0.8); \draw [thick, <->] (2.25,-0.2) -- (2.25,-0.8); \draw [thick, <->] (2.75,-0.2) -- (2.75,-0.8); \draw [thick, <->] (3.25,-0.2) -- (3.25,-0.8); \draw [thick, ->] (2.25,-2.0) -- (2.25,-4.2); % smeared histogram \begin{scope}[shift={(0,-1)}] \draw [thick, cyclamen, fill=cyclamen!15!white] (-1.0,-4.5) rectangle (-0.5,-4.3); \draw [thick, cyclamen, fill=cyclamen!15!white] (-0.5,-4.5) rectangle ( 0.0,-4.2); \draw [thick, cyclamen, fill=cyclamen!15!white] ( 0.0,-4.5) rectangle ( 0.5,-2.0); \draw [thick, cyclamen, fill=cyclamen!15!white] ( 0.5,-4.5) rectangle ( 1.0,-1.6); \draw [thick, cyclamen, fill=cyclamen!15!white] ( 1.0,-4.5) rectangle ( 1.5,-2.3); \draw [thick, cyclamen, fill=cyclamen!15!white] ( 1.5,-4.5) rectangle ( 2.0,-2.9); \draw [thick, cyclamen, fill=cyclamen!15!white] ( 2.0,-4.5) rectangle ( 2.5,-3.4); \draw [thick, cyclamen] (3.0,-4.5) -- (3.0,-4.3); \draw [thick, cyclamen] (3.5,-4.5) -- (3.5,-4.3); \draw [thick, cyclamen] (4.0,-4.5) -- (4.0,-4.3); \draw [thick, cyclamen] (4.5,-4.5) -- (4.5,-4.3); \draw [thick, cyclamen] (5.0,-4.5) -- (5.0,-4.3); \draw [thick, cyclamen] (5.5,-4.5) -- (5.5,-4.3); \draw [thick, cyclamen] (6.0,-4.5) -- (6.0,-4.3); \draw [thick, cyclamen] (6.5,-4.5) -- (6.5,-4.3); \draw [thick, cyclamen] (7.0,-4.5) -- (7.0,-4.3); \draw [thick, cyclamen] (7.5,-4.5) -- (7.5,-4.3); \draw [thick, <->] (-1,-2.5) -- (-1,-4.5) -- (8,-4.5); \end{scope} \end{tikzpicture} \caption{Dot product as a step of the convolution between the original signal (above) and the kernel (below). The final result is the lower fledging histogram.}\label{fig:dot_conv} } \end{figure}