126 lines
2.8 KiB
Python

import numpy as np
import matplotlib.pyplot as plt
import scienceplots
i = 1
names = [
"omnes_integrand",
"omnes_integrand_zoom",
"omnes_integrand_tan",
"phi0_integrand",
"phi0_integrand_zoom",
"phi0_integrand_tan",
"delta",
"omnes",
"phi0",
"phi0_delta_rel_diff",
]
files = [open("exports/" + n + ".txt") for n in names]
export_filenames = ["figures/" + n + ".png" for n in names]
titles = [
r"$\frac{\delta_1^1(s') - \delta_1^1(s)}{s'(s'-s)}$, $\sqrt{s}=1$ GeV",
r"$\frac{\delta_1^1(s') - \delta_1^1(s)}{s'(s'-s)}$, $\sqrt{s}=1$ GeV",
r"$\frac{1}{\cos^2(u)}\frac{\delta_1^1(\tan{u}) - \delta_1^1(s)}{\tan{u}(\tan{u}-s)}$, $\sqrt{s}=1$ GeV",
r"$\frac{\ln{|\frac{F(s')}{F(s)}|^2}}{(x^2+s_0)(x^2+s_0-s)}$, $\sqrt{s}=1$ GeV",
r"$\frac{\ln{|\frac{F(s')}{F(s)}|^2}}{(x^2+s_0)(x^2+s_0-s)}$, $\sqrt{s}=1$ GeV",
r"$\frac{1}{\cos^2(u)}\frac{\ln{|\frac{F(\tan^2{u}+s_0)}{F(s)}|^2}}{(\tan^2{u}+s_0)(\tan^2{u}+s_0-s)}$, $\sqrt{s}=1$ GeV",
"",
"",
"",
"",
]
xlabels = [
r"$\sqrt{s}$ [GeV]",
r"$\sqrt{s}$ [GeV]",
r"$u$",
r"$x$",
r"$x$",
r"$u$",
r"$\sqrt{s}$ [GeV]",
r"$\sqrt{s}$ [GeV]",
r"$\sqrt{s}$ [GeV]",
r"$\sqrt{s}$ [GeV]",
]
ylabels = [
r"integrand",
r"integrand",
r"integrand",
r"integrand",
r"integrand",
r"integrand",
r"$\delta_1^1(s)$",
r"$|\Omega(s)|^2$",
r"$\phi_0(s)$",
r"$\frac{\phi_0(s)}{\delta_1^1(s)}$",
]
y_logarithmic = [
False,
False,
False,
False,
False,
False,
False,
True,
False,
False,
]
x_sqrt = [
True,
True,
False,
False,
False,
False,
True,
True,
True,
True,
]
for i in range(len(names)):
print(i)
plt.figure()
filecont = []
for line in files[i]:
filecont.append(line.split(','))
data = []
for curve in filecont:
curve_numbers = []
for val in curve:
try:
curve_numbers.append(float(val))
except ValueError:
continue
if x_sqrt[i]:
curve_numbers_paired = np.array([[x**0.5 for x in curve_numbers[0::2]], curve_numbers[1::2]])
else:
curve_numbers_paired = np.array([curve_numbers[0::2], curve_numbers[1::2]])
data.append(curve_numbers_paired)
# Plotting
plt.style.use(['science'])
plt.figure(figsize=(4,3))
plt.title(titles[i], fontsize = 15)
if y_logarithmic[i]:
plt.yscale('log')
for j in range(len(data)):
plt.plot(data[j][0], data[j][1])
plt.xlabel(xlabels[i], fontsize = 12)
plt.ylabel(ylabels[i], fontsize = 12)
plt.grid(which='major', color='#000000', linestyle='-', alpha = 0.3)
plt.grid(which='minor', color='#000000', linestyle='-', alpha=0.1)
plt.savefig(export_filenames[i], dpi=400)
plt.close()