analistica/ex-5/plots/fit.py

32 lines
705 B
Python
Executable File
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#!/usr/bin/env python
import matplotlib.pyplot as plt
import numpy as np
import sys
table = np.loadtxt(sys.stdin, unpack=True, skiprows=2, delimiter='|')
calls, I_MC, σ_MC, I_MI, σ_MI, I_VE, σ_VE, chi = table
exact = 1.7182818285
plt.figure()
# plt.figure(figsize=(5, 3))
# plt.rcParams['font.size'] = 8
plt.title('Integral uncertainty', loc='right')
plt.ylabel('$\sigma_I$')
plt.xlabel('calls')
plt.xscale('log')
plt.yscale('log')
plt.plot(calls, σ_MC, linestyle='', marker='o',
color='#92182b', label='$\sigma_I$')
x = np.logspace(1, 8, 5)
a = 0.48734
b = -0.49938
plt.plot(x, a*(x**b), color='gray')
plt.tight_layout()
# plt.savefig('notes/images/5-fit.pdf')
plt.show()