Move Python scripts
This commit is contained in:
44
python_scripts/burn_in_time.py
Normal file
44
python_scripts/burn_in_time.py
Normal file
@@ -0,0 +1,44 @@
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
def plot_from_file():
|
||||
files = [
|
||||
"output/burn_in_time/unordered_1_0.txt",
|
||||
"output/burn_in_time/ordered_1_0.txt",
|
||||
"output/burn_in_time/unordered_2_4.txt",
|
||||
"output/burn_in_time/ordered_2_4.txt",
|
||||
]
|
||||
labels = [
|
||||
"1.0, unordered",
|
||||
"1.0, ordered",
|
||||
"2.4, unordered",
|
||||
"2.4, ordered"
|
||||
]
|
||||
figure1, ax1 = plt.subplots()
|
||||
figure2, ax2 = plt.subplots()
|
||||
|
||||
for infile, label in zip(files, labels):
|
||||
with open(infile) as f:
|
||||
lines = f.readlines()
|
||||
|
||||
t = []
|
||||
energy = []
|
||||
magnetization = []
|
||||
for line in lines:
|
||||
items = line.strip().split(",")
|
||||
t.append(int(items[0]))
|
||||
energy.append(float(items[1]))
|
||||
magnetization.append(float(items[5]))
|
||||
|
||||
ax1.plot(t, energy, label=fr"$\langle \epsilon \rangle$ {label}")
|
||||
ax2.plot(t, magnetization, label=fr"$\langle | m | \rangle$ {label}")
|
||||
|
||||
figure1.legend()
|
||||
figure1.savefig("../latex/images/burn_in_time_energy.pdf")
|
||||
figure2.legend()
|
||||
figure2.savefig("../latex/images/burn_in_time_magnetization.pdf")
|
||||
|
||||
def main():
|
||||
plot_from_file()
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user