-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfigures_util.py
134 lines (116 loc) · 4.08 KB
/
figures_util.py
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
import matplotlib.pyplot as plt
import numpy as np
def plot_figure10(g_true, b_exact, y_obs):
"""Function to plot figure 10 in the paper."""
cm_to_in = 1/2.54
f, axes = plt.subplots(
1,3, figsize=(17.8*cm_to_in, 6*cm_to_in), sharey=True)
t = np.linspace(0,1,251)
labels = np.linspace(0,1,5)
plt.sca(axes[0])
plt.plot(t,y_obs[:,0])
plt.plot(t,b_exact[:,0])
axes[0].legend([r'noisy data',r'exact data'], loc=1)
axes[0].set_xticks(labels)
axes[0].set_xticklabels(labels)
axes[0].set_xlim([-.05,1.05])
axes[0].set_ylim([-0.05,.55])
axes[0].set_xlabel(r'$\tau$')
axes[0].set_ylabel(r'$u(\xi_L)$')
axes[0].yaxis.labelpad = -3
axes[0].xaxis.labelpad = 0
axes[0].set_title(r'(a) data from left boundaries')
axes[0].grid()
plt.sca(axes[2])
plt.plot(t,y_obs[:,1])
plt.plot(t,b_exact[:,1])
axes[2].legend([r'noisy data',r'exact data'], loc=1)
axes[2].set_xticks(labels)
axes[2].set_xticklabels(labels)
axes[2].set_xlim([-.05,1.05])
axes[2].set_ylim([-0.05,.55])
axes[2].set_xlabel(r'$\tau$')
axes[2].set_ylabel(r'$u(\xi_R)$')
axes[2].yaxis.labelpad = -3
axes[2].xaxis.labelpad = 0
axes[2].set_title(r'(c) data from right boundaries')
axes[2].grid()
t = np.linspace(0,1,121)
labels = np.linspace(0,1,5)
plt.sca(axes[1])
plt.plot(t,g_true)
axes[1].set_xticks(labels)
axes[1].set_xticklabels(labels)
axes[1].set_xlim([-.05,1.05])
axes[1].set_ylim([-0.05,.55])
axes[1].set_xlabel(r'$\xi$')
axes[1].set_ylabel(r'$u(\xi)$')
axes[1].yaxis.labelpad = -3
axes[1].xaxis.labelpad = 0
axes[1].set_title(r'(b) initial pressure profile')
axes[1].grid()
plt.tight_layout()
def plot_figure11(g_true, samples_full, samples_half):
"""Function to plot figure 11 in the paper."""
cm_to_in = 1/2.54
f, axes = plt.subplots(
1,2, figsize=(17.8*cm_to_in, 6*cm_to_in), sharey=True)
labels = np.linspace(0,1,5)
plt.sca(axes[0])
samples_full.funvals.vector.plot_ci(95, exact=g_true, subplots=False)
axes[0].legend([r'95% CI',r'Mean',r'Exact'], loc=1)
axes[0].set_xticks(labels)
axes[0].set_xticklabels(labels)
axes[0].set_xlim([-.05,1.05])
axes[0].set_ylim([-0.3,0.7])
axes[0].set_xlabel(r'$\xi$')
axes[0].set_ylabel(r'$g$')
axes[0].yaxis.labelpad = -3
axes[0].xaxis.labelpad = 0
axes[0].set_title(r'(a) data from both boundaries')
axes[0].grid()
plt.sca(axes[1])
samples_half.funvals.vector.plot_ci(95, exact=g_true, subplots=False)
axes[1].legend([r'95% CI',r'Mean',r'Exact'], loc=1)
axes[1].set_xticks(labels)
axes[1].set_xticklabels(labels)
axes[1].set_xlim([-.05,1.05])
axes[1].set_ylim([-0.3,0.7])
axes[1].set_xlabel(r'$\xi$')
axes[1].yaxis.labelpad = -3
axes[1].xaxis.labelpad = 0
axes[1].set_title(r'(b) data from one boundaries')
axes[1].grid()
plt.tight_layout()
def plot_figure12(samples_full, samples_half):
"""Function to plot figure 12 in the paper."""
cm_to_in = 1/2.54
f, axes = plt.subplots(
1,2, figsize=(17.8*cm_to_in, 5*cm_to_in), sharey=True)
labels = list(range(0,36,7))
plt.sca(axes[0])
samples_full.plot_ci(95, plot_par=True, marker='.')
axes[0].legend([r'Mean',r'95% CT'], loc=4)
axes[0].set_xticks(labels)
axes[0].set_xticklabels(labels)
axes[0].set_xlim([-1,25])
axes[0].set_ylim([-2.5,2.5])
axes[0].grid()
axes[0].set_xlabel(r'$i$')
axes[0].set_ylabel(r'$x_i$')
axes[0].yaxis.labelpad = -3
axes[0].xaxis.labelpad = 0
axes[0].set_title(r'(a) data from both boundaries')
plt.sca(axes[1])
samples_half.plot_ci(95, plot_par=True, marker='.')
axes[1].legend([r'Mean',r'95% CT'], loc=4)
axes[1].set_xticks(labels)
axes[1].set_xticklabels(labels)
axes[1].set_xlim([-1,25])
axes[1].set_ylim([-2.5,2.5])
axes[1].grid()
axes[1].set_xlabel(r'$i$')
axes[1].yaxis.labelpad = -3
axes[1].xaxis.labelpad = 0
axes[1].set_title(r'(b) data from one boundary')
plt.tight_layout()