-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot_diffusion_v_true_1D
More file actions
73 lines (40 loc) · 1.27 KB
/
plot_diffusion_v_true_1D
File metadata and controls
73 lines (40 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import numpy as np
import matplotlib.pyplot as plt
import csv
# Load TRUE Ising data
# ----------------------
true_rho = {}
with open("ising_1D_data.csv", "r") as f:
reader = csv.reader(f)
next(reader) # skip header
for row in reader:
T = float(row[0])
rho = float(row[1])
true_rho[T] = rho
# Load Diffusion results
# ----------------------
diffusion_data = np.load("diffusion_results.npy")
gen_rho = {}
for row in diffusion_data:
T, true_mean, gen_mean = row
gen_rho[T] = gen_mean
# Prepare plotting
# -------------------
Ts = sorted(true_rho.keys())
true_vals = [true_rho[T] for T in Ts]
gen_vals = [gen_rho[T] for T in Ts]
# Plot
# -------------------
plt.figure(figsize=(8,6))
plt.plot(Ts, true_vals, 'o-', linewidth=2, markersize=8,
label="True Ising")
plt.plot(Ts, gen_vals, 's--', linewidth=2, markersize=8,
label="Generated Ising (Diffusion)")
plt.xlabel("Temperature T", fontsize=12)
plt.ylabel("Domain Wall Density ρ", fontsize=12)
plt.title("Domain Wall Density vs Temperature\nTrue vs Generated 1D Ising", fontsize=14)
plt.legend()
plt.grid(True)
plt.savefig("1D_domain_wall_true_vs_generated.png", dpi=150, bbox_inches='tight')
plt.close()
print("Plot saved as 1D_domain_wall_true_vs_generated.png")