Skip to content

Commit 6dbf581

Browse files
committed
organized old test files, found GP example and implmented
1 parent 89b6fa2 commit 6dbf581

18 files changed

Lines changed: 798 additions & 140 deletions

aiche_plots.py

Lines changed: 72 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -122,45 +122,92 @@
122122

123123
plt.savefig("normalized_density_fig", dpi = 300)
124124

125+
125126
import os
126127
import torch
127-
from linfa.models.discrepancy_models import PhysChem
128+
from linfa.models.discrepancy_models import PhysChem_error
128129
import matplotlib.pyplot as plt
129130

130131

131132

132-
samples = np.loadtxt('results/TP15_no_disc_error_estimation_aiche/TP15_no_disc_error_estimation_aiche_outputs_lf+noise_6000')
133-
observations = np.loadtxt("observations.csv", skiprows=1, delimiter=',')
133+
data = np.loadtxt("observations.csv", skiprows=1, delimiter=',')
134+
unique_values = np.unique(data[:, 0])
135+
mrkrs = ['o', 'v', 's']
136+
colores = ['m', 'red', 'orange']
137+
# Plot each unique value as a separate line
138+
plt.figure(figsize=(5, 5))
139+
140+
141+
# Add temperatures and pressures for each evaluation
142+
143+
samples = np.loadtxt('results/TP15_no_disc_error_estimation_aiche/TP15_no_disc_error_estimation_aiche_params_6000')
144+
temps = [350.0, 400.0, 450.0]
145+
pressures = np.linspace(0.0, 5.5).tolist()
146+
for i, temp in enumerate(temps):
147+
for j, sample in enumerate(samples):
148+
variable_inputs = [[temp], pressures]
149+
langmuir = PhysChem_error(variable_inputs)
150+
ssl = langmuir.solve_t(torch.tensor(sample))
151+
plt.plot(pressures, ssl, color = colores[i], linewidth = 0.1, alpha = 0.2)
152+
ssl_true = langmuir.solve_t(torch.tensor([1000, -21E3, 0.05]))
153+
if i == 0:
154+
plt.plot(pressures, ssl_true, 'k--', label = "True")
155+
plt.plot([], [], 'k-', alpha = 0.2, label = "Estimated")
156+
else:
157+
plt.plot(pressures, ssl_true, 'k--')
158+
159+
for i, val in enumerate(unique_values):
160+
subset = data[data[:, 0] == val]
161+
plt.plot(subset[:, 1], subset[:, 2], color = colores[i], marker = mrkrs[i], markeredgecolor = 'k', linestyle = "None", label=f'{int(val)} K')
162+
163+
plt.xlabel(r'Pressure, $P$ [Pa]')
164+
plt.ylabel(r'Coverage, [ ]')
165+
plt.xlim(0,5.5)
166+
plt.ylim(0,1.0)
167+
plt.legend()
168+
plt.savefig("results/TP15_no_disc_error_estimation_aiche/fxn_pred")
169+
134170

135171

136-
# Set variable grid
137-
T = [50.0, 400.0, 450.0]
138-
P = [1.0, 2.0, 3.0, 4.0, 5.0]
139172

140-
samples = samples.reshape(3,5,5000)
173+
# import os
174+
# import torch
175+
# from linfa.models.discrepancy_models import PhysChem
176+
# import matplotlib.pyplot as plt
141177

178+
# samples = np.loadtxt('results/TP15_no_disc_error_estimation_aiche/TP15_no_disc_error_estimation_aiche_outputs_lf+noise_6000')
142179

143-
# Plot the samples
144-
for i in range(5000):
145-
plt.plot(P, samples[0, :, i], 'm-', linewidth=0.005)
146-
plt.plot(P, samples[1, :, i], 'r-', linewidth=0.005)
147-
plt.plot(P, samples[2, :, i], color="orange", linestyle='-', linewidth=0.005)
148180

149-
# Plot observations
150-
plt.plot(observations[:, 1], observations[:, 2], 'ko')
181+
# samples = np.loadtxt('results/TP15_no_disc_error_estimation_aiche/TP15_no_disc_error_estimation_aiche_samples_6000')
182+
# observations = np.loadtxt("observations.csv", skiprows=1, delimiter=',')
151183

152-
# Add custom legend entries by plotting representative lines
153-
plt.plot([], [], 'm-', label="350 K") # Magenta line
154-
plt.plot([], [], 'r-', label="400 K") # Red line
155-
plt.plot([], [], color="orange", linestyle='-', label="450 K") # Orange line
156-
plt.plot([], [], 'ko', label="Observations") # Black circles for observations
184+
# # Set variable grid
185+
# T = [300.0, 400.0, 450.0]
186+
# P = [1.0, 2.0, 3.0, 4.0, 5.0]
157187

158-
# Add legend, labels, and limits
159-
plt.legend()
160-
plt.xlim(1, 5)
161-
plt.xlabel("Pressure, $P$ [Pa]")
162-
plt.ylabel("Coverage")
163-
plt.savefig("function", dpi=300)
188+
# samples = samples.reshape(3,5,5000)
189+
190+
# # Plot the samples
191+
# for i in range(5000):
192+
# plt.plot(P, samples[0, :, i], 'm-', linewidth=0.005)
193+
# plt.plot(P, samples[1, :, i], 'r-', linewidth=0.005)
194+
# plt.plot(P, samples[2, :, i], color="orange", linestyle='-', linewidth=0.005)
195+
196+
# # Plot observations
197+
# plt.plot(observations[:, 1], observations[:, 2], 'ko')
198+
199+
# # Add custom legend entries by plotting representative lines
200+
# plt.plot([], [], 'm-', label="350 K") # Magenta line
201+
# plt.plot([], [], 'r-', label="400 K") # Red line
202+
# plt.plot([], [], color="orange", linestyle='-', label="450 K") # Orange line
203+
# plt.plot([], [], 'ko', label="Observations") # Black circles for observations
204+
205+
# # Add legend, labels, and limits
206+
# plt.legend()
207+
# plt.xlim(1, 5)
208+
# plt.xlabel("Pressure, $P$ [Pa]")
209+
# plt.ylabel("Coverage")
210+
# plt.savefig("function", dpi=300)
164211

165212
# for i in range(5000):
166213
# plt.plot(P, samples[0,:,i],'m-', linewidth = 0.005)
File renamed without changes.

linfa/tests/test_no_disc_TP15_error_estimation_uniform_prior.py renamed to linfa/tests/old/test_no_disc_TP15_error_estimation_uniform_prior.py

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)