diff --git a/ex-4/plot.py b/ex-4/plot.py index 05ab11a..8c36ec3 100755 --- a/ex-4/plot.py +++ b/ex-4/plot.py @@ -5,19 +5,38 @@ import numpy as np import sys -bins = input() -step = input() -bins = int(bins.split("\t")[1]) -step = float(step.split("\t")[1]) -counts = np.loadtxt(sys.stdin) -edges = np.linspace(0, bins*step, bins+1) +def f(x, p_max): + return x * np.log(p_max/x)/np.arctan(np.sqrt(p_max**2/x**2 - 1)) -plt.rcParams['font.size'] = 17 -plt.hist(edges[:-1], edges, weights=counts, - histtype='stepfilled', color='#e3c5ca', edgecolor='#92182b') -plt.title('Vertical component distribution', loc='right') -plt.xlabel(r'$p_h$') -plt.ylabel(r'$\left<|p_v|\right>$') +def main(): + bins = input() + step = input() + bins = int(bins.split("\t")[1]) + step = float(step.split("\t")[1]) + counts = np.loadtxt(sys.stdin) + edges = np.linspace(0, bins*step, bins+1) -plt.show() + plt.figure() +# plt.figure(figsize=(5, 3)) +# plt.rcParams['font.size'] = 8 + + plt.hist(edges[:-1], edges, weights=counts, + histtype='stepfilled', color='#e3c5ca', edgecolor='#92182b') + + plt.title('Simulation', loc='right') + plt.xlabel(r'$p_h$') + plt.ylabel(r'$\left<|p_v|\right>$') + +# x = np.arange(0, 10, 0.001) +# y = f(x, 10) +# plt.plot(x, y, c='#92182b', linewidth=2) + + plt.tight_layout() + plt.show() +# plt.savefig('notes/images/4-fit.pdf') + + + +if __name__ == '__main__': + main() diff --git a/notes/images/4-dip.pdf b/notes/images/4-dip.pdf index 3dec796..c246dfe 100644 Binary files a/notes/images/4-dip.pdf and b/notes/images/4-dip.pdf differ diff --git a/notes/images/4-expected.pdf b/notes/images/4-expected.pdf index 5f17253..baf37c6 100644 Binary files a/notes/images/4-expected.pdf and b/notes/images/4-expected.pdf differ diff --git a/notes/images/4-fit.pdf b/notes/images/4-fit.pdf index 9aaab98..3a5e401 100644 Binary files a/notes/images/4-fit.pdf and b/notes/images/4-fit.pdf differ