cpp/main.py

55 lines
1.8 KiB
Python
Raw Normal View History

2024-11-28 14:50:26 +01:00
import matplotlib.pyplot as plt
2024-11-28 11:07:44 +01:00
from python.ste import *
from python.helpers import *
# Simulation parameter
motion = 'IsotropicAngle'
distribution = 'Delta'
2024-11-28 14:50:26 +01:00
# parameter = {}
2024-11-28 11:07:44 +01:00
parameter = {
2024-11-28 14:50:26 +01:00
"angle": [10, 109.47],
2024-11-28 11:07:44 +01:00
}
parameter = prepare_rw_parameter(parameter)
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 14:50:26 +01:00
ax_tau_ss.set_title('tau_ss')
2024-11-28 11:07:44 +01:00
fig_beta_ss, ax_beta_ss = plt.subplots()
2024-11-28 14:50:26 +01:00
ax_beta_ss.set_title('beta_ss')
2024-11-28 11:07:44 +01:00
fig_finfty_ss, ax_finfty_ss = plt.subplots()
2024-11-28 14:50:26 +01:00
ax_finfty_ss.set_title('f_infty_ss')
2024-11-28 11:07:44 +01:00
for variation in parameter:
print(f"\nRun RW for {motion}/{distribution} with arguments {variation}\n")
2024-11-28 14:50:26 +01:00
run_sims(motion, distribution, ste=True, spectrum=False, **variation)
2024-11-28 11:07:44 +01:00
2024-11-28 14:50:26 +01:00
conf_file = find_config_file(motion, distribution, variation)
2024-11-28 11:07:44 +01:00
2024-11-28 14:50:26 +01:00
vary_string, tau_cc, beta_cc, finfty_cc = fit_and_save_ste(conf_file, 'coscos', plot_decays=False, verbose=False)
_, tau_ss, beta_ss, finfty_ss = fit_and_save_ste(conf_file, 'sinsin', plot_decays=False, verbose=False)
_, tau_2, beta_2, finfty_2 = fit_and_save_ste(conf_file, 'f2', plot_decays=True, verbose=True)
2024-11-28 11:07:44 +01:00
2024-11-28 14:50:26 +01: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 11:07:44 +01:00
ax_beta_cc.plot(*beta_cc.T, label=vary_string)
ax_finfty_cc.plot(*finfty_cc.T, label=vary_string)
2024-11-28 14:50:26 +01: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 11:07:44 +01:00
ax_beta_ss.plot(*beta_ss.T, label=vary_string)
ax_finfty_ss.plot(*finfty_ss.T, label=vary_string)
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()