ex-1: redo fig.3 both in the code and in the md
This commit is contained in:
parent
d3d1846a11
commit
b4a2dd730c
@ -1,9 +1,49 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
from pylab import *
|
||||
from matplotlib import pyplot as plt
|
||||
import numpy as np
|
||||
import sys
|
||||
|
||||
x, y = loadtxt(sys.stdin, unpack=True)
|
||||
title('Landau distribution', loc='right')
|
||||
plot(x, y, color='#92182b')
|
||||
show()
|
||||
|
||||
plt.figure()
|
||||
# plt.figure(figsize=(5, 3))
|
||||
# plt.rcParams['font.size'] = 8
|
||||
|
||||
# useful coordinates
|
||||
y_min = -0.0086 # y min axes
|
||||
y_max = 0.1895 # y max axes
|
||||
me = -0.22 # mode
|
||||
f_me = 0.1806 # f(mode)
|
||||
h_f_me = f_me/2 # falf f(mode)
|
||||
x_m = -1.5867 # x₋
|
||||
x_p = 2.4330 # x₊
|
||||
|
||||
# prepare plot
|
||||
x, y = np.loadtxt(sys.stdin, unpack=True)
|
||||
plt.title('Landau distribution', loc='right')
|
||||
plt.xlim(-10, 10)
|
||||
plt.ylim(y_min, y_max)
|
||||
|
||||
# draw the lines
|
||||
plt.plot([-10, me], [f_me, f_me], color='gray')
|
||||
plt.plot([me, me], [f_me, y_min], color='gray')
|
||||
plt.plot([-10, x_p], [h_f_me, h_f_me], color='gray')
|
||||
plt.plot([x_m, x_m], [y_min, h_f_me], color='gray')
|
||||
plt.plot([x_p, x_p], [y_min, h_f_me], color='gray')
|
||||
|
||||
# draw the function
|
||||
plt.plot(x, y, color='#92182b')
|
||||
|
||||
# draw the notes
|
||||
s = 0.012
|
||||
S = 0.2
|
||||
plt.annotate('$f(m_e)$', [-10 + S, f_me - s])
|
||||
plt.annotate('$f(m_e)/2$', [-10 + S, h_f_me - s])
|
||||
plt.annotate('$x_-$', [x_m + S, y_min + s/2])
|
||||
plt.annotate('$x_+$', [x_p + S, y_min + s/2])
|
||||
plt.annotate('$m_e$', [me + S, y_min + s/2])
|
||||
|
||||
|
||||
plt.tight_layout()
|
||||
plt.show()
|
||||
# plt.savefig('notes/images/1-notes.pdf')
|
||||
|
BIN
notes/images/1-notes.pdf
Normal file
BIN
notes/images/1-notes.pdf
Normal file
Binary file not shown.
@ -99,29 +99,8 @@ PDF, very few parameters can be easily checked: mode, median and full width at
|
||||
half maximum (FWHM).
|
||||
|
||||
![Landau distribution with emphatized mode $m_e$ and
|
||||
FWHM = ($x_+ - x_-$).](images/1-landau.pdf)
|
||||
FWHM = ($x_+ - x_-$).](images/1-notes.pdf)
|
||||
|
||||
\begin{figure}
|
||||
\hypertarget{fig:parameters}{%
|
||||
\begin{tikzpicture}[overlay]
|
||||
\begin{scope}[shift={(0,0.4)}]
|
||||
% Mode
|
||||
\draw [thick, dashed] (7.57,3.1) -- (7.57,8.55);
|
||||
\draw [thick, dashed] (1.9,8.55) -- (7.57,8.55);
|
||||
\node [above right] at (7.6,3.1) {$m_e$};
|
||||
\node [below right] at (1.9,8.55) {$f(m_e)$};
|
||||
% FWHM
|
||||
\draw [thick, dashed] (1.9,5.95) -- (9.05,5.95);
|
||||
\draw [thick, dashed] (6.85,5.83) -- (6.85,3.1);
|
||||
\draw [thick, dashed] (8.95,5.83) -- (8.95,3.1);
|
||||
\node [below right] at (1.9,5.95) {$\frac{f(m_e)}{2}$};
|
||||
\node [above right] at (6.85,3.1) {$x_-$};
|
||||
\node [above right] at (8.95,3.1) {$x_+$};
|
||||
\end{scope}
|
||||
\end{tikzpicture}}
|
||||
\end{figure}
|
||||
|
||||
\vspace{30pt}
|
||||
|
||||
#### Mode
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user