Giù Marcer
093faf3fe8
move all the functions to lib.c and lib.h; add this two librearies to makefile; make plot.py more easy to use for passing to one mode to the other (show or save figure); create fit_plot and create the figure 5-fit.pdf.
33 lines
913 B
Python
Executable File
33 lines
913 B
Python
Executable File
#!/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('Plain MC', loc='right')
|
||
plt.ylabel('$I^{oss}$')
|
||
plt.xlabel('calls')
|
||
plt.xscale('log')
|
||
|
||
plt.axhline(y=exact, color='#c556ea', linestyle='-', label='Exact value')
|
||
plt.errorbar(calls, I_MC, linestyle='', marker='o', yerr=σ_MC,
|
||
color='#92182b', label='Plain MC')
|
||
plt.errorbar(calls, I_MI, linestyle='', marker='o', yerr=σ_MI,
|
||
color='black', label='MISER')
|
||
plt.errorbar(calls, I_VE, linestyle='', marker='o', yerr=σ_VE,
|
||
color='gray', label='VEGAS')
|
||
plt.legend()
|
||
|
||
# plt.tight_layout()
|
||
# plt.savefig('notes/images/5-test.pdf')
|
||
plt.show()
|