Skip to content

Commit

Permalink
updated plotter and bounds on std dev fraction
Browse files Browse the repository at this point in the history
  • Loading branch information
kylajones committed Jun 6, 2024
1 parent 80060ce commit 5f2c87d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
19 changes: 11 additions & 8 deletions linfa/plot_res.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,19 @@ def plot_log(log_file,out_dir,fig_format='png', use_dark_mode=False):
def plot_params(param_data,LL_data,idx1,idx2,out_dir,out_info,fig_format='png', use_dark_mode=False):

# Read data
param_data = np.loadtxt(param_data)
dent_data = np.loadtxt(LL_data)
param_data = np.loadtxt(param_data) # [5000, 3]
dent_data = np.loadtxt(LL_data) # [5000, ]

# Plot figure
plt.figure()
plt.scatter(param_data[:,idx1], param_data[:,idx2]/1000, lw = 0, s =7, marker = 'o', c = np.exp(dent_data))
plt.plot(1000, -21.0, 'r*')

#plt.plot(1000, -21.0, 'r*')
plt.colorbar()
plt.xlabel('Std. Pressure, '+r'$P_0$'+' [Pa]')
plt.ylabel('Ads. Energy, '+r'$E$'+' [kJ'+r'$\cdot$'+'mol'+r'$^{-1}$'+']')
# plt.xlabel('Std. Pressure, '+r'$P_0$'+' [Pa]')
# plt.ylabel('Ads. Energy, '+r'$E$'+' [kJ'+r'$\cdot$'+'mol'+r'$^{-1}$'+']')
plt.xlabel(r'$\theta_{K,'+str(idx1+1)+'}$')
plt.ylabel(r'$\theta_{K,'+str(idx2+1)+'}$')
plt.savefig(os.path.join(out_dir,'params_plot_' + out_info + '_'+str(idx1)+'_'+str(idx2)+'.'+fig_format))
plt.close()

Expand Down Expand Up @@ -164,10 +167,10 @@ def plot_outputs(sample_file,obs_file,idx1,idx2,out_dir,out_info,fig_format='png

# Plot 2D slice of posterior samples
if(os.path.isfile(param_file) and os.path.isfile(LL_file)):
tot_params = np.loadtxt(param_file).shape[1]
tot_params = np.loadtxt(param_file).shape[1] # extract total number of parameters inferred
print('Plotting posterior samples...')
for loopA in range(tot_params):
for loopB in range(loopA+1, tot_params):
for loopA in range(tot_params): # loop over total number of parameters
for loopB in range(loopA+1, tot_params): # get next parameter
plot_params(param_file,LL_file,loopA,loopB,out_dir,out_info,fig_format=args.img_format,use_dark_mode=args.use_dark_mode)
else:
print('File with posterior samples not found: '+param_file)
Expand Down
2 changes: 1 addition & 1 deletion linfa/tests/test_no_disc_TP15_error_estimation.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def run_test():
# Define transformation
trsf_info = [['tanh', -30.0, 30.0, 500.0, 1500.0],
['tanh', -30.0, 30.0, -30000.0, -15000.0],
['tanh', -7.0, 7.0, 0.01, 0.1]]
['tanh', -15.0, 15.0, 0.0001, 0.5]]
trsf = Transformation(trsf_info)

# Apply the transformation
Expand Down

0 comments on commit 5f2c87d

Please sign in to comment.