cpp/process_ste.py

50 lines
1.9 KiB
Python
Raw Permalink Normal View History

2024-11-28 10:07:44 +00:00
from python.ste import *
fig_tau_cc, ax_tau_cc = plt.subplots()
ax_tau_cc.set_title('tau_cc')
fig_beta_cc, ax_beta_cc = plt.subplots()
ax_beta_cc.set_title('beta_cc')
fig_finfty_cc, ax_finfty_cc = plt.subplots()
ax_finfty_cc.set_title('f_infty_cc')
fig_tau_ss, ax_tau_ss = plt.subplots()
2024-11-28 13:50:26 +00:00
ax_tau_ss.set_title('tau_ss')
2024-11-28 10:07:44 +00:00
fig_beta_ss, ax_beta_ss = plt.subplots()
2024-11-28 13:50:26 +00:00
ax_beta_ss.set_title('beta_ss')
2024-11-28 10:07:44 +00:00
fig_finfty_ss, ax_finfty_ss = plt.subplots()
2024-11-28 13:50:26 +00:00
ax_finfty_ss.set_title('f_infty_ss')
2024-11-28 10:07:44 +00:00
for conf_file in pathlib.Path('.').glob(f'IsotropicAngle/angle=*/Delta/tau=*/*_parameter.txt'):
print(conf_file)
2024-11-30 15:15:38 +00:00
vary_string, tau_cc, beta_cc, finfty_cc = fit_ste(conf_file, f'coscos', plot_decays=False, verbose=False)
_, tau_ss, beta_ss, finfty_ss = fit_ste(conf_file, f'sinsin', plot_decays=False, verbose=False)
_, tau_2, beta_2, finfty_2 = fit_ste(conf_file, f'f2', plot_decays=True, verbose=True)
2024-11-28 10:07:44 +00:00
2024-11-28 13:50:26 +00:00
ax_tau_cc.semilogy(tau_cc[:, 0], tau_cc[:, 1], label=vary_string)
ax_tau_cc.axhline(tau_2[:, 1], color='k', linestyle='--')
2024-11-28 10:07:44 +00:00
ax_beta_cc.plot(*beta_cc.T, label=vary_string)
ax_finfty_cc.plot(*finfty_cc.T, label=vary_string)
2024-11-28 13:50:26 +00:00
ax_tau_ss.semilogy(tau_ss[:, 0], tau_ss[:, 1], label=vary_string)
ax_tau_ss.axhline(tau_2[:, 1], color='k', linestyle='--')
2024-11-28 10:07:44 +00:00
ax_beta_ss.plot(*beta_ss.T, label=vary_string)
ax_finfty_ss.plot(*finfty_ss.T, label=vary_string)
2024-11-30 15:15:38 +00:00
np.savetxt(
conf_file.with_name(f'ste_fit_{vary_string}.dat'),
2024-11-30 15:15:38 +00:00
np.c_[
tau_cc, beta_cc[:, 1], finfty_cc[:, 1],
tau_ss[:, 1], beta_ss[:, 1], finfty_ss[:, 1],
],
header=f'Fit STE {vary_string}\n'
f'F2: tau={tau_2[0, 1]} beta={beta_2[0, 1]} finfty={finfty_2[0, 1]}\n'
f'tevo\ttaucc\tbetacc\tfinftycc\ttauss\tbetass\tfinftyss',
)
2024-11-28 10:07:44 +00:00
for ax in [ax_tau_cc, ax_beta_cc, ax_finfty_cc, ax_tau_ss, ax_beta_ss, ax_finfty_ss]:
ax.legend()
plt.show()