-
Notifications
You must be signed in to change notification settings - Fork 4
/
plot.py
32 lines (25 loc) · 882 Bytes
/
plot.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
import matplotlib.pyplot as plt
from numpy import loadtxt
plt.style.use('ggplot')
f, axarr = plt.subplots(3, sharex=True, figsize=(6,10))
# Load all data
truth = loadtxt('truth.txt')
obs = loadtxt('obs.txt')
first_guess = loadtxt('first_guess.txt')
final_guess = loadtxt('final_guess.txt')
# Plot all data
for i in range(3):
axarr[i].plot(truth[:,0], truth[:,i+1], label="truth")
axarr[i].plot(obs[:,0], obs[:,i+1], 'x', label="observations", alpha=0.5)
axarr[i].plot(first_guess[:,0], first_guess[:,i+1], '--', label="first guess", alpha=0.5)
axarr[i].plot(final_guess[:,0], final_guess[:,i+1], ':', label="final guess")
axarr[2].legend()
plt.tight_layout()
# Plot diagnostics
plt.figure(figsize=(6,4))
diagn = loadtxt('diagnostics.txt')
plt.semilogy(diagn[:,0], diagn[:,1])
plt.xlabel('Iterations')
plt.ylabel('Cost function')
plt.tight_layout()
plt.show()