-
Notifications
You must be signed in to change notification settings - Fork 0
/
plotting.py
36 lines (27 loc) · 955 Bytes
/
plotting.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
import pickle
import matplotlib.pylab as plt
import pints
import pints.plot
def plotting(old_model=False):
if old_model:
results_file = 'results2.pickle'
names = ['k0', 'E0', 'Cdl', 'Ru', 'alpha', 'omega', 'sigma']
else:
results_file = 'results.pickle'
names = ['k0', 'E0', 'a', 'Ru', 'Cdl', 'omega', 'sigma']
(xs, log_posterior, log_prior, chains, mcmc_method) = pickle.load(
open(results_file, 'rb'))
print(
'Found results using mcmc={} containing {} chains with {} samples'.format(
mcmc_method, len(chains), chains[0].shape[0]
)
)
print(chains.shape)
pints.plot.trace(chains)
plt.savefig('electrochem_pde_trace.pdf')
pints.plot.pairwise(chains[0, :, :])
plt.savefig('electrochem_pde_chains.pdf')
results = pints.MCMCSummary(chains, parameter_names=names)
print(results)
if __name__ == '__main__':
plotting(old_model=False)