Skip to content
Snippets Groups Projects
Commit 3a394dce authored by freba's avatar freba :call_me:
Browse files

Added code block captions.

parent 1b434670
Branches
No related tags found
No related merge requests found
......@@ -241,6 +241,7 @@ def select_Xi_parsimony_sweep(msindyc):
#+end_src
#+NAME: c0
#+CAPTION: This code block is associated with the upper subplot in Figure 1.
#+begin_src python :noweb strip-export :exports both :tangle ./Scripts/c0.py :results file :return filepath
cluster=0
......@@ -265,6 +266,7 @@ filepath = plot_clusterModels(
#+end_src
#+NAME: c1
#+CAPTION: This code block is associated with the lower subplot in Figure 1.
#+begin_src python :noweb strip-export :exports both :tangle ./Scripts/c1.py :results file :return filepath
cluster=1
<<sindyc_header>>
......@@ -298,7 +300,9 @@ filepath = plot_clusterModels(
#+end_src
#+NAME: cosimulate_ID_c0
#+CAPTION: This code block is associated with Figure 2.
#+begin_src python :results file :exports both :return filename :tangle ./Scripts/cosimulate_ID_c0.py :noweb yes
import copy
import numpy as np
......@@ -362,6 +366,7 @@ filename = plot_sns(
#+end_src
#+NAME: one_step_prediction_surface
#+CAPTION: This code block is associated with Figure 3.
#+begin_src python :tangle ./Scripts/one_step_prediction_surface.py :exports both :results file :return filepath :noweb yes
<<paper_simulation_header>>
<<paper_simulation_class>>
......@@ -479,7 +484,8 @@ filepath = plot_one_step_prediction_map(mp, xs, us, cluster=[0])
* TODO Markov Chain Monte Carlo
#+NAME: c0_stan
#+begin_src python :noweb strip-export :exports none :results file :tangle ./Scripts/c0_stan.py :return filepath
#+CAPTION: This code block is associated with subfigure (a) in Figure 4.
#+begin_src python :noweb strip-export :exports both :results file :tangle ./Scripts/c0_stan.py :return filepath
cluster=0
<<sindyc_header>>
<<code_stan_fitModel>>
......@@ -529,10 +535,9 @@ filepath = Plotter.plot_density(
#+end_src
#+NAME: c0_stan_ppc
#+CAPTION: Posterior-Predictive check.
#+begin_src python :exports none :results file :tangle ./Scripts/c0_stan_ppc.py :noweb yes :return filepath
#+CAPTION: This code block is associated with subfigure (a) in Figure 5.
#+begin_src python :exports both :results file :tangle ./Scripts/c0_stan_ppc.py :noweb yes :return filepath
import numpy as np
<<paper_plotting_header>>
import arviz as az
......@@ -581,9 +586,57 @@ filepath = Plotter.plot_ppc(
#+end_src
#+NAME: c1_stan
#+CAPTION: This code block is associated with subfigure (b) in Figure 4.
#+begin_src python :noweb strip-export :exports both :results file :tangle ./Scripts/c1_stan.py :return filepath
cluster=1
<<simo_IDCL_sindy_header>>
<<code_stan_fitModel>>
<<paper_simulation_header>>
data = read_from_disc('data_simo_IDCL_c1.pkl')
msindy = data['msindy']
Xistar = select_Xi_parsimony_sweep(msindy)
print(Xistar)
df = data['df'][0]
obs = df
sigma_y_init = df.filter(regex='y').iloc[0, :].std()
stan_results = Simulator.identify_stan(obs,
Xistar,
sigma_y_init=sigma_y_init,
name='c1',
fitnewmodel=True)
var_names = {'plot_labels': [], 'labels': []}
nXi = Xistar[Xistar != 0].shape[0]
for n in range(nXi):
subscript = f'{n+2}' # Only valid for this scenario
# var_names.append(r'\xi_' + subscript)
var_names['plot_labels'].append(r'$\xi_' + subscript + r'$')
var_names['labels'].append(f'Xi[{n+1}]')
filename = 'simo_IDCL_c1_stan.pdf'
filepath = os.path.join(PLOTPATH, filename)
filepath = Plotter.plot_density(stan_results,
var_names=var_names,
var_prior=Xistar,
labels=[[
'True parameter', 'Posterior',
'SINDyc (prior mean)',
r'95% confidence interval',
'MAP'
], None],
original_model_obj=mp,
show=False,
save=True,
filename=filepath)
#+END_SRC
#+NAME: c1_stan_ppc
#+CAPTION: Posterior-Predictive check.
#+CAPTION: This code block is associated with subfigure (b) in Figure 5.
#+begin_src python :exports none :results file :tangle ./Scripts/c1_stan_ppc.py :noweb yes :return filepath
import numpy as np
<<paper_plotting_header>>
......@@ -632,8 +685,8 @@ filepath = Plotter.plot_ppc(
#+end_src
#+NAME: stan_cosimulate_ID_c0
#+CAPTION: This code block is associated with Figure 6.
#+begin_src python :results file :exports results :return filename :tangle ./Scripts/stan_cosimulate_ID_c0.py :noweb yes
from collections import OrderedDict
import numpy as np
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment