cpp/process_ste.py
2024-12-15 18:34:05 +01:00

50 lines
1.9 KiB
Python

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()
ax_tau_ss.set_title('tau_ss')
fig_beta_ss, ax_beta_ss = plt.subplots()
ax_beta_ss.set_title('beta_ss')
fig_finfty_ss, ax_finfty_ss = plt.subplots()
ax_finfty_ss.set_title('f_infty_ss')
for conf_file in pathlib.Path('.').glob(f'IsotropicAngle/angle=*/Delta/tau=*/*_parameter.txt'):
print(conf_file)
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)
ax_tau_cc.semilogy(tau_cc[:, 0], tau_cc[:, 1], label=vary_string)
ax_tau_cc.axhline(tau_2[:, 1], color='k', linestyle='--')
ax_beta_cc.plot(*beta_cc.T, label=vary_string)
ax_finfty_cc.plot(*finfty_cc.T, label=vary_string)
ax_tau_ss.semilogy(tau_ss[:, 0], tau_ss[:, 1], label=vary_string)
ax_tau_ss.axhline(tau_2[:, 1], color='k', linestyle='--')
ax_beta_ss.plot(*beta_ss.T, label=vary_string)
ax_finfty_ss.plot(*finfty_ss.T, label=vary_string)
np.savetxt(
conf_file.with_name(f'ste_fit_{vary_string}.dat'),
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',
)
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()