Formatting
This commit is contained in:
parent
ef1d54b776
commit
83468938bb
@ -4,35 +4,29 @@ import seaborn as sns
|
|||||||
sns.set_theme()
|
sns.set_theme()
|
||||||
params = {
|
params = {
|
||||||
"font.family": "Serif",
|
"font.family": "Serif",
|
||||||
"font.serif": "Roman",
|
"font.serif": "Roman",
|
||||||
"text.usetex": True,
|
"text.usetex": True,
|
||||||
"axes.titlesize": "large",
|
"axes.titlesize": "large",
|
||||||
"axes.labelsize": "large",
|
"axes.labelsize": "large",
|
||||||
"xtick.labelsize": "large",
|
"xtick.labelsize": "large",
|
||||||
"ytick.labelsize": "large",
|
"ytick.labelsize": "large",
|
||||||
"legend.fontsize": "medium"
|
"legend.fontsize": "medium",
|
||||||
}
|
}
|
||||||
plt.rcParams.update(params)
|
plt.rcParams.update(params)
|
||||||
|
|
||||||
|
|
||||||
def plot_from_file():
|
def plot_from_file():
|
||||||
files = [
|
files = [
|
||||||
# "output/burn_in_time/unordered_1_0_1421110368.txt",
|
"data/hp/burn_in_time/unordered_2_4_1212892317.txt",
|
||||||
# "output/burn_in_time/ordered_1_0_611577739.txt",
|
"data/hp/burn_in_time/ordered_2_4_2408603856.txt",
|
||||||
"output/burn_in_time/unordered_2_4_1212892317.txt",
|
|
||||||
"output/burn_in_time/ordered_2_4_2408603856.txt",
|
|
||||||
]
|
]
|
||||||
labels = [
|
labels = [
|
||||||
"Unordered",
|
"Unordered",
|
||||||
"Ordered",
|
"Ordered",
|
||||||
# "2.4, unordered",
|
|
||||||
# "2.4, ordered"
|
|
||||||
]
|
]
|
||||||
colors = [
|
colors = [
|
||||||
"darkred",
|
"darkred",
|
||||||
"seagreen",
|
"seagreen",
|
||||||
# "steelblue",
|
|
||||||
# "darkred",
|
|
||||||
# "darkgoldenrod",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
fig1, ax1 = plt.subplots()
|
fig1, ax1 = plt.subplots()
|
||||||
@ -57,14 +51,19 @@ def plot_from_file():
|
|||||||
ax1.set_xlabel("t")
|
ax1.set_xlabel("t")
|
||||||
ax1.set_ylabel(r"$\langle \epsilon \rangle$")
|
ax1.set_ylabel(r"$\langle \epsilon \rangle$")
|
||||||
ax1.legend(title="Initial state", loc="upper right")
|
ax1.legend(title="Initial state", loc="upper right")
|
||||||
fig1.savefig("../latex/images/burn_in_time_energy_2_4.pdf", bbox_inches="tight")
|
|
||||||
|
fig1.savefig("./latex/images/burn_in_time_energy_2_4.pdf", bbox_inches="tight")
|
||||||
ax2.set_ylabel(r"$\langle |m| \rangle$")
|
ax2.set_ylabel(r"$\langle |m| \rangle$")
|
||||||
ax2.set_xlabel("t")
|
ax2.set_xlabel("t")
|
||||||
ax2.legend(title="Initial state", loc="upper right")
|
ax2.legend(title="Initial state", loc="upper right")
|
||||||
fig2.savefig("../latex/images/burn_in_time_magnetization_2_4.pdf", bbox_inches="tight")
|
fig2.savefig(
|
||||||
|
"./latex/images/burn_in_time_magnetization_2_4.pdf", bbox_inches="tight"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
plot_from_file()
|
plot_from_file()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import os
|
from os import makedirs
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
@ -9,20 +9,20 @@ from scipy.stats import norm
|
|||||||
sns.set_theme()
|
sns.set_theme()
|
||||||
params = {
|
params = {
|
||||||
"font.family": "Serif",
|
"font.family": "Serif",
|
||||||
"font.serif": "Roman",
|
"font.serif": "Roman",
|
||||||
"text.usetex": True,
|
"text.usetex": True,
|
||||||
"axes.titlesize": "large",
|
"axes.titlesize": "large",
|
||||||
"axes.labelsize": "large",
|
"axes.labelsize": "large",
|
||||||
"xtick.labelsize": "large",
|
"xtick.labelsize": "large",
|
||||||
"ytick.labelsize": "large",
|
"ytick.labelsize": "large",
|
||||||
"legend.fontsize": "medium"
|
"legend.fontsize": "medium",
|
||||||
}
|
}
|
||||||
plt.rcParams.update(params)
|
plt.rcParams.update(params)
|
||||||
|
|
||||||
|
|
||||||
def plot(infile, outfile):
|
def plot(infile, outfile):
|
||||||
if not (outdir := Path(outfile).parent).exists():
|
if not (outdir := Path(outfile).parent).exists():
|
||||||
os.makedirs(outdir)
|
makedirs(outdir)
|
||||||
|
|
||||||
figure1, ax1 = plt.subplots()
|
figure1, ax1 = plt.subplots()
|
||||||
eps = []
|
eps = []
|
||||||
@ -32,21 +32,32 @@ def plot(infile, outfile):
|
|||||||
vals = line.strip().split(",")
|
vals = line.strip().split(",")
|
||||||
eps.append(float(vals[0]))
|
eps.append(float(vals[0]))
|
||||||
|
|
||||||
ax1.hist(eps, np.arange(min(eps), max(eps) + 0.02, 0.02), color="steelblue", density=True, ec="white", lw=0.2)
|
ax1.hist(
|
||||||
|
eps,
|
||||||
|
np.arange(min(eps), max(eps) + 0.02, 0.02),
|
||||||
|
color="steelblue",
|
||||||
|
density=True,
|
||||||
|
ec="white",
|
||||||
|
lw=0.2,
|
||||||
|
)
|
||||||
ax1.set_xlabel(r"$\epsilon$")
|
ax1.set_xlabel(r"$\epsilon$")
|
||||||
ax1.set_ylabel("Density")
|
ax1.set_ylabel("Density")
|
||||||
|
|
||||||
mu, sigma = np.mean(eps), np.std(eps)
|
mu, sigma = np.mean(eps), np.std(eps)
|
||||||
x = np.arange(min(eps), max(eps) + 0.02, 0.02)
|
x = np.arange(min(eps), max(eps) + 0.02, 0.02)
|
||||||
|
|
||||||
stats = (f"$\\langle \\epsilon \\rangle$ = {np.mean(eps):.4f}\n"
|
stats = (
|
||||||
f"Var$(\\epsilon)$ = {np.var(eps):.4f}")
|
f"$\\langle \\epsilon \\rangle$ = {np.mean(eps):.4f}\n"
|
||||||
|
f"Var$(\\epsilon)$ = {np.var(eps):.4f}"
|
||||||
|
)
|
||||||
bbox = dict(boxstyle="round", pad=0.3, fc="white", ec="white", alpha=0.5)
|
bbox = dict(boxstyle="round", pad=0.3, fc="white", ec="white", alpha=0.5)
|
||||||
ax1.text(0.95, 0.9, stats, bbox=bbox, transform=ax1.transAxes, ha="right", va="center")
|
ax1.text(
|
||||||
|
0.95, 0.9, stats, bbox=bbox, transform=ax1.transAxes, ha="right", va="center"
|
||||||
|
)
|
||||||
ax1.plot(x, norm.pdf(x, mu, sigma), color="mediumseagreen")
|
ax1.plot(x, norm.pdf(x, mu, sigma), color="mediumseagreen")
|
||||||
figure1.savefig(outfile, bbox_inches="tight")
|
figure1.savefig(outfile, bbox_inches="tight")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
plot("output/pd_estimate/estimate_1_0.txt", "../latex/images/pd_estimate_1_0.pdf")
|
plot("./data/hp/pd_estimate/estimate_1_0.txt", "./latex/images/pd_estimate_1_0.pdf")
|
||||||
plot("output/pd_estimate/estimate_2_4.txt", "../latex/images/pd_estimate_2_4.pdf")
|
plot("./data/hp/pd_estimate/estimate_2_4.txt", "./latex/images/pd_estimate_2_4.pdf")
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
from os import makedirs
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
@ -6,6 +7,9 @@ from scipy.stats import linregress
|
|||||||
|
|
||||||
|
|
||||||
def plot_phase_transition_alt(indir, outdir):
|
def plot_phase_transition_alt(indir, outdir):
|
||||||
|
if not (path := Path(outdir)).exists():
|
||||||
|
makedirs(path)
|
||||||
|
|
||||||
files = [
|
files = [
|
||||||
"size_20.txt",
|
"size_20.txt",
|
||||||
"size_40.txt",
|
"size_40.txt",
|
||||||
@ -84,6 +88,9 @@ def plot_phase_transition_alt(indir, outdir):
|
|||||||
|
|
||||||
|
|
||||||
def plot_phase_transition(indir, outdir):
|
def plot_phase_transition(indir, outdir):
|
||||||
|
if not (path := Path(outdir)).exists():
|
||||||
|
makedirs(path)
|
||||||
|
|
||||||
files = [
|
files = [
|
||||||
"size_20.txt",
|
"size_20.txt",
|
||||||
"size_40.txt",
|
"size_40.txt",
|
||||||
@ -168,24 +175,24 @@ def plot_phase_transition(indir, outdir):
|
|||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
plot_phase_transition_alt(
|
plot_phase_transition_alt(
|
||||||
"fox_output/phase_transition/wide/10M/",
|
"data/fox/phase_transition/wide/10M/",
|
||||||
"latex/images/phase_transition/fox/wide/10M/",
|
"latex/images/phase_transition/fox/wide/10M/",
|
||||||
)
|
)
|
||||||
plot_phase_transition(
|
plot_phase_transition(
|
||||||
"fox_output/phase_transition/wide/1M/",
|
"data/fox/phase_transition/wide/1M/",
|
||||||
"latex/images/phase_transition/fox/wide/1M/",
|
"latex/images/phase_transition/fox/wide/1M/",
|
||||||
)
|
)
|
||||||
plot_phase_transition(
|
plot_phase_transition(
|
||||||
"fox_output/phase_transition/narrow/10M/",
|
"data/fox/phase_transition/narrow/10M/",
|
||||||
"latex/images/phase_transition/fox/narrow/10M/",
|
"latex/images/phase_transition/fox/narrow/10M/",
|
||||||
)
|
)
|
||||||
plot_phase_transition(
|
plot_phase_transition(
|
||||||
"output/phase_transition/", "latex/images/phase_transition/hp/"
|
"data/hp/phase_transition/", "latex/images/phase_transition/hp/"
|
||||||
)
|
)
|
||||||
plot_phase_transition(
|
plot_phase_transition(
|
||||||
"output/phase_transition/", "latex/images/phase_transition/hp/"
|
"data/hp/phase_transition/", "latex/images/phase_transition/hp/"
|
||||||
)
|
)
|
||||||
plot_phase_transition(
|
plot_phase_transition(
|
||||||
"output/phase_transition/",
|
"data/hp/phase_transition/",
|
||||||
"latex/images/phase_transition/hp/",
|
"latex/images/phase_transition/hp/",
|
||||||
)
|
)
|
||||||
|
|||||||
@ -1,11 +1,13 @@
|
|||||||
|
from os import makedirs
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
import numpy as np
|
|
||||||
from scipy.stats import linregress
|
|
||||||
|
|
||||||
|
|
||||||
def plot_phase_transition(indir, outdir):
|
def plot(indir, outdir):
|
||||||
|
if not (path := Path(outdir)).exists():
|
||||||
|
makedirs(path)
|
||||||
|
|
||||||
files = [
|
files = [
|
||||||
"no_burn_in.txt",
|
"no_burn_in.txt",
|
||||||
"burn_in.txt",
|
"burn_in.txt",
|
||||||
@ -20,7 +22,6 @@ def plot_phase_transition(indir, outdir):
|
|||||||
figure3, ax3 = plt.subplots()
|
figure3, ax3 = plt.subplots()
|
||||||
figure4, ax4 = plt.subplots()
|
figure4, ax4 = plt.subplots()
|
||||||
|
|
||||||
|
|
||||||
for file, label in zip(files, labels):
|
for file, label in zip(files, labels):
|
||||||
t = []
|
t = []
|
||||||
e = []
|
e = []
|
||||||
@ -38,13 +39,11 @@ def plot_phase_transition(indir, outdir):
|
|||||||
CV.append(float(l[3]))
|
CV.append(float(l[3]))
|
||||||
X.append(float(l[4]))
|
X.append(float(l[4]))
|
||||||
|
|
||||||
|
|
||||||
ax1.plot(t, e, label=label)
|
ax1.plot(t, e, label=label)
|
||||||
ax2.plot(t, m, label=label)
|
ax2.plot(t, m, label=label)
|
||||||
ax3.plot(t, CV, label=label)
|
ax3.plot(t, CV, label=label)
|
||||||
ax4.plot(t, X, label=label)
|
ax4.plot(t, X, label=label)
|
||||||
|
|
||||||
|
|
||||||
figure1.legend()
|
figure1.legend()
|
||||||
figure2.legend()
|
figure2.legend()
|
||||||
figure3.legend()
|
figure3.legend()
|
||||||
@ -62,7 +61,7 @@ def plot_phase_transition(indir, outdir):
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
plot_phase_transition(
|
plot(
|
||||||
"output/test_burn_in_time/",
|
"./data/hp/test_burn_in_time/",
|
||||||
"../latex/images/test_burn_in",
|
"./latex/images/test_burn_in",
|
||||||
)
|
)
|
||||||
|
|||||||
@ -1,11 +1,13 @@
|
|||||||
|
from os import makedirs
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
import numpy as np
|
|
||||||
from scipy.stats import linregress
|
|
||||||
|
|
||||||
|
|
||||||
def plot_timing(indir, outdir):
|
def plot_timing(indir, outdir):
|
||||||
|
if not (path := Path(outdir)).exists():
|
||||||
|
makedirs(path)
|
||||||
|
|
||||||
files = [
|
files = [
|
||||||
"lattice_sizes.txt",
|
"lattice_sizes.txt",
|
||||||
"sample_sizes.txt",
|
"sample_sizes.txt",
|
||||||
@ -14,14 +16,8 @@ def plot_timing(indir, outdir):
|
|||||||
"Lattice sizes",
|
"Lattice sizes",
|
||||||
"Sample sizes",
|
"Sample sizes",
|
||||||
]
|
]
|
||||||
xlabels = [
|
xlabels = ["Lattice size", "Sampling size"]
|
||||||
"Lattice size",
|
outfiles = ["lattice_size.pdf", "sample_sizes.pdf"]
|
||||||
"Sampling size"
|
|
||||||
]
|
|
||||||
outfiles = [
|
|
||||||
"lattice_size.pdf",
|
|
||||||
"sample_sizes.pdf"
|
|
||||||
]
|
|
||||||
|
|
||||||
for file, label, xlabel, outfile in zip(files, labels, xlabels, outfiles):
|
for file, label, xlabel, outfile in zip(files, labels, xlabels, outfiles):
|
||||||
figure1, ax1 = plt.subplots()
|
figure1, ax1 = plt.subplots()
|
||||||
@ -35,7 +31,6 @@ def plot_timing(indir, outdir):
|
|||||||
x.append(float(l[0]))
|
x.append(float(l[0]))
|
||||||
t.append(float(l[1]))
|
t.append(float(l[1]))
|
||||||
|
|
||||||
|
|
||||||
ax1.plot(x, t, label=label)
|
ax1.plot(x, t, label=label)
|
||||||
ax1.set_xlabel(xlabel)
|
ax1.set_xlabel(xlabel)
|
||||||
ax1.set_ylabel("time (seconds)")
|
ax1.set_ylabel("time (seconds)")
|
||||||
@ -49,6 +44,6 @@ def plot_timing(indir, outdir):
|
|||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
plot_timing(
|
plot_timing(
|
||||||
"output/timing/",
|
"data/hp/timing/",
|
||||||
"../latex/images/timing",
|
"./latex/images/timing",
|
||||||
)
|
)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user