ex-6: improve plots

This commit is contained in:
Michele Guerini Rocco 2020-05-01 00:43:50 +02:00
parent 3920539a3a
commit dc7d3b4b9b
23 changed files with 20 additions and 22 deletions

View File

@ -2,15 +2,14 @@
from pylab import * from pylab import *
import sys import sys
import matplotlib.pyplot as plt
plt.rcParams['font.size'] = 20 rcParams['font.size'] = 12
a, b, f = loadtxt(sys.stdin, unpack=True) a, b, f = loadtxt(sys.stdin, unpack=True)
suptitle('Fraunhofer diffraction')
title(sys.argv[1] if len(sys.argv) > 1 else "", loc='right') title(sys.argv[1] if len(sys.argv) > 1 else "", loc='right')
hist(a, np.insert(b, 0, a[0]), weights=f/sum(f), hist(a, np.insert(b, 0, a[0]), weights=100*f/sum(f),
color='#dbbf0d', edgecolor='#595856', linewidth=0.5) histtype='stepfilled', color='#e3c5ca', edgecolor='#92182b')
xlabel(r'$\theta$ (radians)') xlabel(r'$\theta$ (radians)')
ylabel(r'$I(\theta)$ (a.u.)') ylabel(r'$I(\theta)$ (a.u.)')
tight_layout()
show() show()

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
notes/images/fraun-rl-1.pdf Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,6 +1,6 @@
# Exercise 6 # Exercise 6
## Generating points according to Fraunhofer diffraction ## Generating points according to Fraunhöfer diffraction
The diffraction of a plane wave thorough a round slit must be simulated by The diffraction of a plane wave thorough a round slit must be simulated by
generating $N =$ 50'000 points according to the intensity distribution generating $N =$ 50'000 points according to the intensity distribution
@ -16,7 +16,7 @@ where:
- $E$ is the electric field amplitude, default set $E = \SI{1e4}{V/m}$; - $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}$; - $a$ is the radius of the slit aperture, default set $a = \SI{0.01}{m}$;
- $\theta$ is the angle specified in @fig:slit; - $\theta$ is the angle specified in @fig:slit;
- $J_1$ is the Bessel function of first order; - $J_1$ is a Bessel function of first kind;
- $k$ is the wavenumber, default set $k = \SI{1e-4}{m^{-1}}$; - $k$ is the wavenumber, default set $k = \SI{1e-4}{m^{-1}}$;
- $L$ default set $L = \SI{1}{m}$. - $L$ default set $L = \SI{1}{m}$.
@ -46,7 +46,7 @@ where:
\node [cyclamen] at (5.5,-0.4) {$\theta$}; \node [cyclamen] at (5.5,-0.4) {$\theta$};
\node [rotate=-90] at (10.2,0) {screen}; \node [rotate=-90] at (10.2,0) {screen};
\end{tikzpicture} \end{tikzpicture}
\caption{Fraunhofer diffraction.}\label{fig:slit} \caption{Fraunhöfer diffraction.}\label{fig:slit}
} }
\end{figure} \end{figure}
@ -88,8 +88,7 @@ omitted:
The sample was binned and stored in a histogram with a customizable number $n$ The sample was binned and stored in a histogram with a customizable number $n$
of bins default set $n = 150$. In @fig:original an example is shown. of bins default set $n = 150$. In @fig:original an example is shown.
![Example of sorted points according to ![Example of an intensity histogram.](images/fraun-original.pdf){#fig:original}
$I(\theta)$.](images/6_original.pdf){#fig:original}
## Gaussian noise convolution {#sec:convolution} ## Gaussian noise convolution {#sec:convolution}
@ -417,41 +416,41 @@ On the other hand, the Richardson-Lucy routine is less affected by this further
complication being already inaccurate in itself. complication being already inaccurate in itself.
<div id="fig:results1"> <div id="fig:results1">
![Convolved signal.](images/noise-0.05.pdf){width=12cm} ![Convolved signal.](images/fraun-conv-0.05.pdf){width=12cm}
![Deconvolved signal with FFT.](images/deco-fft-0.05.pdf){width=12cm} ![Deconvolved signal with FFT.](images/fraun-fft-0.05.pdf){width=12cm}
![Deconvolved signal with RL.](images/deco-rl-0.05.pdf){width=12cm} ![Deconvolved signal with RL.](images/fraun-rl-0.05.pdf){width=12cm}
Results for $\sigma = 0.05 \Delta \theta$, where $\Delta \theta$ is the bin Results for $\sigma = 0.05 \Delta \theta$, where $\Delta \theta$ is the bin
width. width.
</div> </div>
<div id="fig:results2"> <div id="fig:results2">
![Convolved signal.](images/noise-0.5.pdf){width=12cm} ![Convolved signal.](images/fraun-conv-0.5.pdf){width=12cm}
![Deconvolved signal with FFT.](images/deco-fft-0.5.pdf){width=12cm} ![Deconvolved signal with FFT.](images/fraun-fft-0.5.pdf){width=12cm}
![Deconvolved signal with RL.](images/deco-rl-0.5.pdf){width=12cm} ![Deconvolved signal with RL.](images/fraun-rl-0.5.pdf){width=12cm}
Results for $\sigma = 0.5 \Delta \theta$, where $\Delta \theta$ is the bin Results for $\sigma = 0.5 \Delta \theta$, where $\Delta \theta$ is the bin
width. width.
</div> </div>
<div id="fig:results3"> <div id="fig:results3">
![Convolved signal.](images/noise-1.pdf){width=12cm} ![Convolved signal.](images/fraun-conv-1.pdf){width=12cm}
![Deconvolved signal with FFT.](images/deco-fft-1.pdf){width=12cm} ![Deconvolved signal with FFT.](images/fraun-fft-1.pdf){width=12cm}
![Deconvolved signal with RL.](images/deco-rl-1.pdf){width=12cm} ![Deconvolved signal with RL.](images/fraun-rl-1.pdf){width=12cm}
Results for $\sigma = \Delta \theta$, where $\Delta \theta$ is the bin width. Results for $\sigma = \Delta \theta$, where $\Delta \theta$ is the bin width.
</div> </div>
<div id="fig:poisson"> <div id="fig:poisson">
![Deconvolved signal with FFT.](images/poisson-fft.pdf){width=12cm} ![Deconvolved signal with FFT.](images/fraun-noise-fft.pdf){width=12cm}
![Deconvolved signal withh RL.](images/poisson-rl.pdf){width=12cm} ![Deconvolved signal withh RL.](images/fraun-noise-rl.pdf){width=12cm}
Results for $\sigma = \Delta \theta$, poissoned data. Results for $\sigma = \Delta \theta$, with Poisson noise.
</div> </div>