changes in figure2
This commit is contained in:
@ -30,7 +30,7 @@ def load_data(file):
|
||||
return dat
|
||||
|
||||
|
||||
def plot_parameters(dat, deparameterize=False, ref=None):
|
||||
def plot_parameters(dat, input_file, deparameterize=False, ref=None):
|
||||
''' Plot the parameters in separate subplots with uncertainties.
|
||||
|
||||
Args:
|
||||
@ -42,21 +42,29 @@ def plot_parameters(dat, deparameterize=False, ref=None):
|
||||
if is_ipython():
|
||||
plt.ion()
|
||||
|
||||
idx_a = input_file.find('/')
|
||||
idx_b = input_file[idx_a+1::].find('/')
|
||||
name_file = input_file[idx_a+1:idx_b+idx_a+1]
|
||||
inputfile_path = 'results/' + name_file + '/input.yaml'
|
||||
|
||||
|
||||
inputfile_path = 'results/aorta_C/input.yaml'
|
||||
with open(inputfile_path) as file:
|
||||
inputfile = yaml.full_load(file)
|
||||
|
||||
#true_val = [10,250,250,250,30]
|
||||
true_val = [94,250,683,615,30]
|
||||
true_val = [10,60,220,160,100]
|
||||
|
||||
|
||||
current_val = []
|
||||
current_val.append(inputfile['boundary_conditions'][2]['value'][0])
|
||||
current_val.append(inputfile['boundary_conditions'][3]['value'][0])
|
||||
current_val.append(inputfile['boundary_conditions'][4]['value'][0])
|
||||
current_val.append(inputfile['boundary_conditions'][5]['value'][0])
|
||||
current_val.append(inputfile['boundary_conditions'][1]['parameters']['U'])
|
||||
|
||||
for bnd_c in inputfile['estimation']['boundary_conditions']:
|
||||
if 'windkessel' in bnd_c['type']:
|
||||
for bnd_set in inputfile['boundary_conditions']:
|
||||
if bnd_c['id'] == bnd_set['id']:
|
||||
current_val.append(bnd_set['value'][0])
|
||||
|
||||
|
||||
current_val.append(inputfile['boundary_conditions'][1]['parameters']['U'])
|
||||
|
||||
dim = dat['theta'].shape[-1]
|
||||
fig1, axes = plt.subplots(1,1,figsize=(8,6))
|
||||
@ -72,6 +80,8 @@ def plot_parameters(dat, deparameterize=False, ref=None):
|
||||
col = cycle(['C0', 'C1', 'C2', 'C3','C4'])
|
||||
ls = cycle(['-', '-', '--', '--', ':', ':', '-.', '-.'])
|
||||
legends = cycle(['$R_3$','$R_4$','$R_5$','$R_6$','$U$'])
|
||||
#legends = cycle(['$R_3$','$U$'])
|
||||
|
||||
|
||||
col_ = next(col)
|
||||
ls_ = next(ls)
|
||||
@ -100,7 +110,8 @@ def plot_parameters(dat, deparameterize=False, ref=None):
|
||||
# print('theta_peak: \t {}'.format(theta[round(len(theta)/2), :]))
|
||||
print('Final value theta: \t {}'.format(theta[-1, :]))
|
||||
print('Deparameterized: 2^theta_end: \t {}'.format(2**theta[-1, :]))
|
||||
print('Real values: \t {}'.format(np.round(2**theta[-1, :]*current_val,2)))
|
||||
print('Real values: \t {}'.format(true_val))
|
||||
print('Recon values: \t {}'.format(np.round(2**theta[-1, :]*current_val,2)))
|
||||
|
||||
|
||||
|
||||
@ -133,5 +144,5 @@ if __name__ == '__main__':
|
||||
args = get_parser().parse_args()
|
||||
|
||||
dat = load_data(args.file)
|
||||
|
||||
plot_parameters(dat, deparameterize=args.deparameterize, ref=args.ref)
|
||||
|
||||
plot_parameters(dat, args.file,deparameterize=args.deparameterize, ref=args.ref)
|
||||
|
Reference in New Issue
Block a user