This commit is contained in:
2021-06-17 16:58:23 +02:00
parent 4ffd1c03c1
commit 1b00a76a17
7 changed files with 142 additions and 49 deletions

View File

@ -6,11 +6,12 @@ import pickle
import yaml
#import matplotlib.font_manager
from matplotlib import rc
rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']})
rc('text', usetex=True)
import matplotlib.font_manager
def is_ipython():
''' Check if script is run in IPython.
@ -98,10 +99,10 @@ def plot_parameters(dat, input_file, deparameterize=False, ref=None):
ids.append(bnd_c['id'])
ids_type.append('windkessel')
current_val.append(bnd_set['parameters']['R_d'])
labels.append('$R_' + str(bnd_c['id']))
labels.append('$R_' + str(bnd_c['id']-3))
if RC_flag:
current_val_C.append(bnd_set['parameters']['C'])
labels.append('$C_' + str(bnd_c['id']))
labels.append('$C_' + str(bnd_c['id']-3))
elif 'dirichlet' in bnd_c['type']:
@ -112,10 +113,9 @@ def plot_parameters(dat, input_file, deparameterize=False, ref=None):
fig1, axes1 = plt.subplots(1,1,figsize=(12,6))
fig1, axes1 = plt.subplots(1,1,figsize=(12,7))
if RC_flag:
fig2, axes2 = plt.subplots(1,1,figsize=(12,6))
fig2, axes2 = plt.subplots(1,1,figsize=(12,7))
t = dat['times']
@ -162,13 +162,22 @@ def plot_parameters(dat, input_file, deparameterize=False, ref=None):
if ids_type[i] == 'dirichlet':
pass
#axes3.plot(t, curve , '-', color=col_,label= legends_ + '= ' + str(rec_value) + '/' + str(true_values[cur_key]) + '$')
#axes3.fill_between(t, curve - np.sqrt(P[:, idx, idx]), curve + np.sqrt(P[:, idx, idx]), alpha=0.3, color=col_)
#legends_=next(legends)
#axes3.plot(t, dash_curve , color=col_,ls='--')
fig3, axes3 = plt.subplots(1,1,figsize=(12,5))
axes3.plot(t, curve , '-', color=col_,label= legends_ + '= ' + str(rec_value) + '/' + str(true_values[cur_key]) + '$', linewidth = 4)
axes3.fill_between(t, std_down, std_up, alpha=0.3, color=col_)
legends_=next(legends)
axes3.plot(t, dash_curve , color=col_,ls='--')
axes3.set_ylabel(r'$U$',fontsize=36)
axes3.legend(fontsize=36,loc='upper right')
axes3.set_xlim([-0.01,0.81])
axes3.set_xlabel(r'$t (s)$',fontsize=36)
axes3.set_box_aspect(1/4)
plt.xticks(fontsize=28)
plt.yticks(fontsize=28)
plt.savefig('U.png')
plt.close(fig3)
else:
axes1.plot(t, curve , '-', color=col_,label= legends_ + '= ' + str(rec_value) + '/' + str(true_values[cur_key]) + '$', linewidth = 2)
axes1.plot(t, curve , '-', color=col_,label= legends_ + '= ' + str(rec_value) + '/' + str(true_values[cur_key]) + '$', linewidth = 3)
axes1.fill_between(t, std_down, std_up, alpha=0.3, color=col_)
axes1.plot(t, dash_curve , color=col_,ls='--')
legends_=next(legends)
@ -199,19 +208,23 @@ def plot_parameters(dat, input_file, deparameterize=False, ref=None):
idx +=1
axes1.set_ylabel(r'$R_d$',fontsize=22)
axes1.legend(fontsize=18,loc='upper right')
axes1.set_ylabel(r'$R_d$',fontsize=36)
axes1.legend(fontsize=36,loc='upper right')
axes1.set_xlim([-0.01,0.81])
axes1.set_ylim([1700,35000])
axes1.set_xlabel(r'$t (s)$',fontsize=22)
plt.savefig('C.png')
axes1.set_ylim([1700,45000])
axes1.set_box_aspect(1/2)
plt.xticks(fontsize=28)
plt.yticks(fontsize=28)
axes1.set_xlabel(r'$t (s)$',fontsize=36)
plt.savefig('Rd.png')
if RC_flag:
axes2.set_ylabel(r'$C$',fontsize=22)
axes2.set_ylabel(r'$C$',fontsize=24)
axes2.legend(fontsize=18,loc='upper right')
axes2.set_xlim([-0.01,0.81])
axes2.set_xlabel(r'$t (s)$',fontsize=22)
axes2.set_xlabel(r'$t (s)$',fontsize=24)
fig2.savefig('C.png')
fig1.savefig('Rd.png')