# Calibration of SEIRD model using Approximate Bayesian Computation (ABC)

Based on code of Lander De Visscher

## Background

### Approximate Bayesian Computation (ABC)
ABC methods are part of **Bayesian methods** for parameter inference. In the Bayesian framework, we base our inference on the **posterior distribution** $P(\theta|y_{obs})$ of a parameter $\theta$ given the observed data $y_{obs}$ (and given the model for which we perform our inference). This conditional probability distribution can be derived from Bayes' theorem:

$$
\begin{equation}
P(\theta|y_{obs}) = \frac{P(y_{obs}|\theta)\,P(\theta)}{P(y_{obs})},
\end{equation}
$$

with
- $P(y_{obs}|\theta)$ the likelihood function (i.e. how likely it is to observe the data with our model, given the parameter $\theta$),
- $P(\theta)$ the prior distribution (i.e. the probability distribution that reflects our prior believes/the prior evidence of the parameter distribution)
- $P(y_{obs})$ the marginal likelihood.

Since the marginal likelihood $P(y_{obs})$ is often not (analytically) tractable, most Bayesian methods will use the property that the $posterior \propto likelihood \times prior$ in a **sampling algorithm**, that can generate a (approximate) sample from the posterior distribution.

When the likelihood function $P(y_{obs}|\theta)$ is also unknown/intractable but we can generate simulations $y$ with our model given the parameter $\theta$, **Approximate Bayesian Computation** methods come in. **ABC** will approximate the likelihood function as:

$$
p_{\epsilon}(s_{obs}|\theta) = \int K_\epsilon(\parallel s- s_{obs}\parallel)\,p(s|\theta)\mathrm{d} s
$$

The approximations of these methods are twofold.
1. Instead of using the whole (simulated) data $y$, we work with (lower-dimensional) summary statistics $$s = S(y),$$ in which $S$ is the **summary statistics function**.
2. Instead of conditioning on $y = y_{obs}$ (as in the true likelihood), we condition on $$K_\epsilon(\parallel s- s_{obs}\parallel)$$ in which
    - $K_\epsilon$ is a **smoothing kernel** with **bandwith** $\epsilon$
    - $\parallel . - .\parallel$ is a distance metric.

These methods result in an **approximated partial posterior distribution $p_{\epsilon}(\theta|s_{obs})$**. The ABC method is illustrated in the following image (Beaumont 2009).

### SMC

In the current implementation ABC inference is performed using **Sequential Markov Chain Monte Carlo (SMC MCMC)**, a variant of ABC where a population of so-called **particles** (which are **weighted samples**) are propagated through intermediate proposal distributions, starting from the **prior distribution $ p(\theta)$**.  These proposal distributions are adaptively constructed during the SMC iterations ($i_{SMC}$) and arise from decreasing the bandwith $\epsilon$ of the smoothing kernel function. The decrease is based on the effective sample size (ESS), which is a measure of the particle degeneracy (i.e. when few particles contain most of the particle weight).

This amounts to the following procedure:
>- At $i_{SMC} = 0$: $N$ particles are drawn from the **prior** and all particle weights are set to $1/N$.
>- At $i_{SMC} > 0$:
    1. reweight: $\epsilon$ is reduced so that the ESS is decreased with a fixed (relative) amount $\alpha$
    2. resample: if ESS drops below a specified threshold, $N_{particles}$ particles are drawn from the weighted sample and all particle weights are set to $1/N$.
    3. move: particles $\theta$ with weight > 0 are perturbed with a MCMC kernel and the perturbed particle $\theta'$ is accepted with a probability
    $$\min\left(1,\frac{K_\epsilon(\parallel s(\theta') - s_{obs} \parallel)\,p(\theta')}{K_\epsilon(\parallel s(\theta) - s_{obs} \parallel) \,p(\theta)}\right) $$

**REMARK**: at the moment, code is only usable for **uniform priors**

### SEIRD model

The example model of this notebook is a simple SEIRD epidemic model, with state variables
- $S$ : number of suseptible individuals,
- $E$  : number of exposed individuals,
- $I$  : number of infected individuals,
- $R$  : number of resistant individuals,
- $D$ : number of dead individuals (due to disease),

that are coupled through a system of ODE's:
$$
\begin{eqnarray}
\dot{S} &=& - \beta \cdot S \cdot I,\\
\dot{E} &=&  \beta \cdot S \cdot I - \gamma \cdot E,\\
\dot{I} &=&  \gamma \cdot E  - \omega \cdot I - \delta \cdot I,\\
\dot{R} &=&  \omega \cdot I,\\
\dot{D} &=&  \delta \cdot I.\\
\end{eqnarray}
$$

The model is calibrated with the observed data from the 2020 COVID-19 outbreak in Belgium.

## Initialisations

```python
## For SEIRD model
import numpy as np
import matplotlib.pyplot as plt
from IPython.display import Image
from ipywidgets import interact,fixed,FloatSlider,IntSlider,ToggleButtons
import pandas as pd
import scipy
from scipy.integrate import odeint
import matplotlib.dates as mdates
import matplotlib
import scipy.stats as st
import networkx # to install networkx in your environment: conda install networkx
from covid19model.models import models
from covid19model.data import google, sciensano, polymod, parameters
from covid19model.visualization import output
# OPTIONAL: Load the "autoreload" extension so that package code can change
%load_ext autoreload
# OPTIONAL: always reload modules so that as you change code in src, it gets loaded
%autoreload 2
```

    WARNING (theano.configdefaults): install mkl with `conda install mkl-service`: No module named 'mkl'

```python
## for ABC
import seaborn as sns

import os
from datetime import datetime

from covid19model.ABC import ABC
from covid19model.ABC import store_results
from covid19model.ABC import metadata
%load_ext autoreload
# OPTIONAL: always reload modules so that as you change code in src, it gets loaded
%autoreload 2
```

    The autoreload extension is already loaded. To reload it, use:
      %reload_ext autoreload

```python
modulde_versions_global = metadata.list_module_versions(globals(), return_dict = True)
```

    numpy 1.18.1
    pandas 1.0.3
    scipy 1.4.1
    matplotlib 3.1.3
    networkx 2.4
    seaborn 0.10.1

### Seed
Set seed to ensure reproducibility.

```python
sim_seed = 300494
np.random.seed(sim_seed)
```

### Model parameters

```python
params = parameters.get_COVID19_SEIRD_parameters(stratified=False)
```

```python
initN = polymod.get_interaction_matrices()[0]
initN = np.array([initN.sum()])
```

```python
levels = initN.size
initial_states = {'S': initN, 'E': np.ones(levels)*20, 'I': np.ones(levels)*2}
```

```python
params
```

    {'Nc': array([11.2]),
     'a': array([0.43]),
     'h': array([0.2]),
     'icu': array([0.33333333]),
     'm0': array([0.5]),
     'c': array([0.66666667]),
     'm': array([0.57]),
     'da': 7.0,
     'dm': 7.0,
     'dc': 6.0,
     'dICU': 8.0,
     'dICUrec': 6.5,
     'dhospital': 7.5,
     'sigma': 3.2,
     'omega': 2.0,
     'dq': 14.0,
     'zeta': 0.0,
     'psi_FP': 0.0,
     'psi_PP': 0.0,
     'totalTests': 0.0,
     'beta': 0.03492}

```python
model = models.COVID19_SEIRD(initial_states, params)
```

```python
# -> user runs a simulation for a defined time period
time = [0, 200]
out = model.sim(time, checkpoints={'time':[20], 'Nc':[np.array([1])]})
```

For now: compare C and ICU (simulated) with data. (Later: take all inflow into hospital)

```python
out#['C']# gedraagt zich als array
```

<svg style="position: absolute; width: 0; height: 0; overflow: hidden">
<defs>
<symbol id="icon-database" viewBox="0 0 32 32">
<title>Show/Hide data repr</title>
<path d="M16 0c-8.837 0-16 2.239-16 5v4c0 2.761 7.163 5 16 5s16-2.239 16-5v-4c0-2.761-7.163-5-16-5z"></path>
<path d="M16 17c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z"></path>
<path d="M16 26c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z"></path>
</symbol>
<symbol id="icon-file-text2" viewBox="0 0 32 32">
<title>Show/Hide attributes</title>
<path d="M28.681 7.159c-0.694-0.947-1.662-2.053-2.724-3.116s-2.169-2.030-3.116-2.724c-1.612-1.182-2.393-1.319-2.841-1.319h-15.5c-1.378 0-2.5 1.121-2.5 2.5v27c0 1.378 1.122 2.5 2.5 2.5h23c1.378 0 2.5-1.122 2.5-2.5v-19.5c0-0.448-0.137-1.23-1.319-2.841zM24.543 5.457c0.959 0.959 1.712 1.825 2.268 2.543h-4.811v-4.811c0.718 0.556 1.584 1.309 2.543 2.268zM28 29.5c0 0.271-0.229 0.5-0.5 0.5h-23c-0.271 0-0.5-0.229-0.5-0.5v-27c0-0.271 0.229-0.5 0.5-0.5 0 0 15.499-0 15.5 0v7c0 0.552 0.448 1 1 1h7v19.5z"></path>
<path d="M23 26h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z"></path>
<path d="M23 22h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z"></path>
<path d="M23 18h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z"></path>
</symbol>
</defs>
</svg>

xarray.Dataset

<input id='section-7e2ba797-bd59-4e8b-9e8d-6bc54ec88f8e' class='xr-section-summary-in' type='checkbox' disabled >Dimensions:

stratification: 1

time: 201

<input id='section-9e1bbca5-62fc-4c94-bbb4-e9ccdfd597c1' class='xr-section-summary-in' type='checkbox'  checked>Coordinates: (2)

stratification

(stratification)

int64

0
<input id='attrs-d1ee5e16-3846-46be-afa0-0004e72e7c36' class='xr-var-attrs-in' type='checkbox' disabled><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg><input id='data-78859882-4fce-4245-be7e-d51380397e26' class='xr-var-data-in' type='checkbox'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg>

array([0])

time

(time)

int64

0 1 2 3 4 5 ... 195 196 197 198 199
<input id='attrs-061b0880-492b-4b3e-a1d4-de194d4a62a6' class='xr-var-attrs-in' type='checkbox' disabled><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg><input id='data-0bc158be-9d15-4da3-abf2-5fe01f24e1c8' class='xr-var-data-in' type='checkbox'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg>

array([  0,   1,   2, ..., 197, 198, 199])

<input id='section-82d083df-f289-4242-99ca-ce77baf578b6' class='xr-section-summary-in' type='checkbox'  >Data variables: (18)

S

(stratification, time)

float64

1.154e+07 1.154e+07 ... 1.154e+07
<input id='attrs-4719e5c8-fc7d-4c30-9876-32945ea0ce8a' class='xr-var-attrs-in' type='checkbox' disabled><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg><input id='data-502d2892-cc74-404b-b98a-b8faec4fbd29' class='xr-var-data-in' type='checkbox'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg>

array([[11539326.        , 11539324.2870092 , 11539321.2280508 ,
        11539317.28336064, 11539312.66704562, 11539307.4655959 ,
        11539301.70046553, 11539295.35871101, 11539288.4095765 ,
        11539280.80190263, 11539272.48675138, 11539263.40011886,
        11539253.46850536, 11539242.61655003, 11539230.765476  ,
        11539217.82091166, 11539203.67637995, 11539188.21939121,
        11539171.33148431, 11539152.88822666, 11539132.7476439 ,
        11539132.7476439 , 11539130.81417296, 11539128.85725027,
        11539126.96304741, 11539125.17490988, 11539123.51565416,
        11539121.98979299, 11539120.59865204, 11539119.33472869,
        11539118.19036904, 11539117.15777298, 11539116.22652299,
        11539115.38768828, 11539114.63357141, 11539113.95567697,
        11539113.34632731, 11539112.79889973, 11539112.3076081 ,
        11539111.86660579, 11539111.47072939, 11539111.11538884,
        11539110.79652515, 11539110.51050457, 11539110.25386844,
        11539110.02363281, 11539109.81709349, 11539109.63181165,
        11539109.46561067, 11539109.31648358, 11539109.18270027,
        11539109.06271867, 11539108.95512486, 11539108.85863312,
        11539108.77208589, 11539108.69445066, 11539108.62480287,
        11539108.56232384, 11539108.50627596, 11539108.45599998,
        11539108.41090985, 11539108.37046212, 11539108.33418272,
        11539108.30164351, 11539108.27245736, 11539108.24627643,
        11539108.2227866 , 11539108.2017188 , 11539108.18282744,
        11539108.16588732, 11539108.15069357, 11539108.13706166,
        11539108.12483026, 11539108.11385948, 11539108.10402127,
        11539108.09519866, 11539108.08728568, 11539108.0801873 ,
        11539108.07381875, 11539108.06810619, 11539108.06298271,
        11539108.05838755, 11539108.05426606, 11539108.05056971,
        11539108.04725405, 11539108.04427975, 11539108.04161172,
        11539108.0392184 , 11539108.03707174, 11539108.03514685,
        11539108.03342017, 11539108.03187131, 11539108.03048195,
        11539108.0292357 , 11539108.02811801, 11539108.02711543,
        11539108.02621613, 11539108.02540955, 11539108.0246861 ,
        11539108.02403721, 11539108.02345513, 11539108.02293295,
        11539108.02246462, 11539108.02204463, 11539108.02166795,
        11539108.02133009, 11539108.021027  , 11539108.02075509,
        11539108.0205112 , 11539108.02029247, 11539108.02009628,
        11539108.01992033, 11539108.01976255, 11539108.01962104,
        11539108.01949408, 11539108.01938015, 11539108.01927792,
        11539108.01918622, 11539108.01910405, 11539108.0190304 ,
        11539108.01896431, 11539108.018905  , 11539108.01885174,
        11539108.01880397, 11539108.0187612 , 11539108.01872284,
        11539108.01868843, 11539108.01865753, 11539108.01862979,
        11539108.01860493, 11539108.01858266, 11539108.01856269,
        11539108.01854477, 11539108.01852867, 11539108.01851422,
        11539108.01850126, 11539108.01848968, 11539108.0184793 ,
        11539108.01846998, 11539108.01846159, 11539108.01845404,
        11539108.01844726, 11539108.01844121, 11539108.01843584,
        11539108.01843103, 11539108.01842669, 11539108.01842275,
        11539108.01841917, 11539108.01841596, 11539108.01841315,
        11539108.01841068, 11539108.01840846, 11539108.01840643,
        11539108.01840456, 11539108.01840286, 11539108.01840137,
        11539108.0184001 , 11539108.01839896, 11539108.0183979 ,
        11539108.01839693, 11539108.01839604, 11539108.01839528,
        11539108.01839462, 11539108.01839403, 11539108.01839347,
        11539108.01839296, 11539108.01839249, 11539108.01839209,
        11539108.01839177, 11539108.01839147, 11539108.01839118,
        11539108.0183909 , 11539108.01839064, 11539108.01839041,
        11539108.01839025, 11539108.01839013, 11539108.01839001,
        11539108.01838987, 11539108.0183897 , 11539108.01838953,
        11539108.01838941, 11539108.01838936, 11539108.01838933,
        11539108.01838928, 11539108.0183892 , 11539108.0183891 ,
        11539108.01838904, 11539108.01838902, 11539108.01838901,
        11539108.01838898, 11539108.01838893, 11539108.01838888,
        11539108.01838885, 11539108.01838885, 11539108.01838885,
        11539108.01838884, 11539108.01838881, 11539108.01838876,
        11539108.01838873, 11539108.01838872, 11539108.01838873]])

E

(stratification, time)

float64

20.0 16.14 ... 1.31e-07 9.508e-08
<input id='attrs-42240df2-6ef4-4d3d-adba-7e95fcf7085c' class='xr-var-attrs-in' type='checkbox' disabled><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg><input id='data-5edd9ae9-6f71-4ee6-a139-466fd0331a58' class='xr-var-data-in' type='checkbox'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg>

array([[2.00000000e+01, 1.61412940e+01, 1.44596757e+01, 1.39835975e+01,
        1.42086799e+01, 1.48747499e+01, 1.58465755e+01, 1.70538016e+01,
        1.84577215e+01, 2.00545199e+01, 2.18297891e+01, 2.37909548e+01,
        2.59555848e+01, 2.83335046e+01, 3.09290912e+01, 3.37651123e+01,
        3.68749225e+01, 4.02856581e+01, 4.40179165e+01, 4.80857560e+01,
        5.25174923e+01, 5.25174923e+01, 4.00839993e+01, 3.10065735e+01,
        2.43086275e+01, 1.93191847e+01, 1.55543209e+01, 1.26900544e+01,
        1.04738970e+01, 8.74597598e+00, 7.38129016e+00, 6.28241530e+00,
        5.39391536e+00, 4.66744745e+00, 4.05969898e+00, 3.54881161e+00,
        3.11908396e+00, 2.75340240e+00, 2.43498680e+00, 2.15761681e+00,
        1.91714413e+00, 1.70822899e+00, 1.52455462e+00, 1.36020234e+00,
        1.21425635e+00, 1.08523646e+00, 9.71236523e-01, 8.70054374e-01,
        7.79219454e-01, 6.97446066e-01, 6.24375502e-01, 5.59339858e-01,
        5.01549071e-01, 4.50090923e-01, 4.03931035e-01, 3.62077951e-01,
        3.24501246e-01, 2.90897907e-01, 2.60857299e-01, 2.33958250e-01,
        2.09789223e-01, 1.88106721e-01, 1.68684307e-01, 1.51290554e-01,
        1.35701290e-01, 1.21703186e-01, 1.09137508e-01, 9.78744214e-02,
        8.77867976e-02, 7.87513755e-02, 7.06487625e-02, 6.33655507e-02,
        5.68236667e-02, 5.09594873e-02, 4.57082652e-02, 4.10060886e-02,
        3.67898810e-02, 3.29982350e-02, 2.95900606e-02, 2.65349942e-02,
        2.38005138e-02, 2.13534514e-02, 1.91599930e-02, 1.71860393e-02,
        1.54105151e-02, 1.38192244e-02, 1.23952460e-02, 1.11209554e-02,
        9.97802488e-03, 8.94878703e-03, 8.02467756e-03, 7.19686768e-03,
        6.45579298e-03, 5.79175656e-03, 5.19501620e-03, 4.65883498e-03,
        4.17818979e-03, 3.74769102e-03, 3.36202416e-03, 3.01594982e-03,
        2.70479298e-03, 2.42559148e-03, 2.17544881e-03, 1.95148261e-03,
        1.75083708e-03, 1.57068295e-03, 1.40852654e-03, 1.26296008e-03,
        1.13261376e-03, 1.01604979e-03, 9.11767571e-04, 8.18203728e-04,
        7.33795957e-04, 6.57809229e-04, 5.89763554e-04, 5.29013274e-04,
        4.74795740e-04, 4.26231317e-04, 3.82336726e-04, 3.42691984e-04,
        3.07195595e-04, 2.75535587e-04, 2.47304685e-04, 2.22000316e-04,
        1.99076047e-04, 1.78428929e-04, 1.59968066e-04, 1.43509783e-04,
        1.28818954e-04, 1.15609007e-04, 1.03628442e-04, 9.28636278e-05,
        8.32572020e-05, 7.47131550e-05, 6.70995069e-05, 6.02483073e-05,
        5.39866626e-05, 4.83186789e-05, 4.32716718e-05, 3.88265919e-05,
        3.49204031e-05, 3.14460830e-05, 2.82526224e-05, 2.52278703e-05,
        2.24810127e-05, 2.00931815e-05, 1.80760642e-05, 1.63721686e-05,
        1.48548231e-05, 1.33315166e-05, 1.18061149e-05, 1.04594195e-05,
        9.36143061e-06, 8.50022673e-06, 7.78196490e-06, 7.03088062e-06,
        6.20271978e-06, 5.47288086e-06, 4.89038720e-06, 4.44626473e-06,
        4.07354206e-06, 3.65337602e-06, 3.20853570e-06, 2.82685427e-06,
        2.53486607e-06, 2.32255108e-06, 2.14333496e-06, 1.91773783e-06,
        1.65231852e-06, 1.42256004e-06, 1.26539560e-06, 1.18325079e-06,
        1.14404362e-06, 1.08118452e-06, 9.13435043e-07, 7.01929424e-07,
        5.47572837e-07, 4.98302402e-07, 5.49011716e-07, 6.41550852e-07,
        6.64726359e-07, 5.17919799e-07, 3.55816703e-07, 2.69045846e-07,
        2.78305785e-07, 3.43678822e-07, 3.64631001e-07, 2.68550563e-07,
        1.76086692e-07, 1.34799938e-07, 1.51778074e-07, 1.96220605e-07,
        1.99438772e-07, 1.25556336e-07, 5.20825313e-08, 2.29942090e-08,
        5.03080508e-08, 1.14100624e-07, 1.62508383e-07, 1.31042548e-07,
        9.50798018e-08]])

I

(stratification, time)

float64

2.0 5.559 ... -9.798e-07 -5.674e-07
<input id='attrs-c62e37c0-b0a1-45e8-8450-3abfe5fc33a0' class='xr-var-attrs-in' type='checkbox' disabled><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg><input id='data-16b3aeea-6b87-4e6f-a16d-f1531793e25a' class='xr-var-data-in' type='checkbox'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg>

array([[ 2.00000000e+00,  5.55890300e+00,  7.08566627e+00,
         7.77143504e+00,  8.17211653e+00,  8.53310495e+00,
         8.95740325e+00,  9.48465315e+00,  1.01329080e+01,
         1.08897483e+01,  1.17694948e+01,  1.27679068e+01,
         1.38779635e+01,  1.51072969e+01,  1.64750563e+01,
         1.79841026e+01,  1.96294229e+01,  2.14183780e+01,
         2.33711241e+01,  2.55206128e+01,  2.78861149e+01,
         2.78861149e+01,  2.81013555e+01,  2.56305038e+01,
         2.22460217e+01,  1.87639456e+01,  1.56201138e+01,
         1.28858768e+01,  1.06373537e+01,  8.78802015e+00,
         7.28374993e+00,  6.08601270e+00,  5.11468087e+00,
         4.32343994e+00,  3.68702691e+00,  3.16601355e+00,
         2.73405477e+00,  2.37364094e+00,  2.07313494e+00,
         1.81838303e+00,  1.60092830e+00,  1.41417536e+00,
         1.25279930e+00,  1.11253596e+00,  9.89680932e-01,
         8.81554266e-01,  7.86038929e-01,  7.01550885e-01,
         6.27040745e-01,  5.61531969e-01,  5.03188702e-01,
         4.50532165e-01,  4.02700010e-01,  3.59446315e-01,
         3.21141586e-01,  2.88350622e-01,  2.59233789e-01,
         2.32685429e-01,  2.08341868e-01,  1.86360315e-01,
         1.67218318e-01,  1.50191345e-01,  1.34787847e-01,
         1.20809083e-01,  1.08217691e-01,  9.70951641e-02,
         8.72052406e-02,  7.82896930e-02,  7.01964957e-02,
         6.28523300e-02,  5.62625838e-02,  5.04911591e-02,
         4.53893336e-02,  4.07798072e-02,  3.65671302e-02,
         3.27160004e-02,  2.92512627e-02,  2.62482697e-02,
         2.36253107e-02,  2.12503672e-02,  1.90588616e-02,
         1.70328137e-02,  1.52008412e-02,  1.36336809e-02,
         1.22827238e-02,  1.10548077e-02,  9.91459661e-03,
         8.85730511e-03,  7.90869869e-03,  7.10746255e-03,
         6.39843901e-03,  5.74964210e-03,  5.15095694e-03,
         4.60596976e-03,  4.13079435e-03,  3.71473684e-03,
         3.33811660e-03,  2.99363337e-03,  2.67950066e-03,
         2.39944577e-03,  2.15632335e-03,  1.93890789e-03,
         1.74094867e-03,  1.55935678e-03,  1.39401695e-03,
         1.24778755e-03,  1.12270518e-03,  1.01152637e-03,
         9.09365141e-04,  8.13900382e-04,  7.25302696e-04,
         6.46234387e-04,  5.81061845e-04,  5.25769398e-04,
         4.74750467e-04,  4.25490948e-04,  3.77932947e-04,
         3.34474781e-04,  2.99794918e-04,  2.72125484e-04,
         2.46450365e-04,  2.21106207e-04,  1.96209513e-04,
         1.73656638e-04,  1.56426338e-04,  1.42044902e-04,
         1.28371899e-04,  1.14804819e-04,  1.01703343e-04,
         9.03893503e-05,  8.19681151e-05,  7.46356730e-05,
         6.74188903e-05,  6.00054699e-05,  5.27063000e-05,
         4.64554535e-05,  4.23895529e-05,  3.94125075e-05,
         3.62468681e-05,  3.23166558e-05,  2.77131427e-05,
         2.31948511e-05,  2.01875538e-05,  1.96627582e-05,
         1.96477025e-05,  1.85934474e-05,  1.59414653e-05,
         1.21200781e-05,  8.54445661e-06,  7.57064773e-06,
         8.88504786e-06,  9.76510419e-06,  9.03652588e-06,
         6.67574553e-06,  3.80991928e-06,  2.71692660e-06,
         3.87155366e-06,  4.72657461e-06,  4.49569215e-06,
         3.20491986e-06,  1.69258225e-06,  1.52441152e-06,
         2.31334131e-06,  2.78101019e-06,  2.50381585e-06,
         1.56922383e-06,  5.75767582e-07,  5.82462053e-07,
         1.46101189e-06,  2.13374183e-06,  2.05996286e-06,
         1.17945585e-06, -8.75284616e-08, -8.40269407e-07,
         2.73289288e-08,  1.65113772e-06,  2.61757630e-06,
         2.24847593e-06,  6.02138080e-07, -1.52666550e-06,
        -2.60669283e-06, -1.25215609e-06,  3.84502951e-07,
         1.03959387e-06,  4.19652206e-07, -9.27673333e-07,
        -1.61362085e-06, -6.36064308e-07,  3.27847698e-07,
         6.14932315e-07,  1.23538143e-07, -7.22295299e-07,
        -9.72837576e-07, -1.33085966e-07,  7.20007552e-07,
         9.74720190e-07,  4.62670097e-07, -5.41461755e-07,
        -1.31993157e-06, -9.79769624e-07, -5.67352350e-07]])

A

(stratification, time)

float64

0.0 0.8149 ... 8.682e-07 6.024e-07
<input id='attrs-9a289ec2-8c41-4361-87ab-968d688a961c' class='xr-var-attrs-in' type='checkbox' disabled><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg><input id='data-20f85392-ad9e-4892-ab82-ccaa1b80c81e' class='xr-var-data-in' type='checkbox'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg>

array([[ 0.00000000e+00,  8.14886084e-01,  1.99772118e+00,
         3.23004745e+00,  4.39995237e+00,  5.48770293e+00,
         6.50884705e+00,  7.48990242e+00,  8.45642892e+00,
         9.43797422e+00,  1.04517501e+01,  1.15179064e+01,
         1.26546514e+01,  1.38758994e+01,  1.51924185e+01,
         1.66189365e+01,  1.81724819e+01,  1.98677841e+01,
         2.17171870e+01,  2.37306492e+01,  2.59238632e+01,
         2.59238632e+01,  2.81425084e+01,  2.98024838e+01,
         3.06250299e+01,  3.06526314e+01,  2.99967179e+01,
         2.88533335e+01,  2.73531827e+01,  2.56472920e+01,
         2.38380306e+01,  2.19963753e+01,  2.01841884e+01,
         1.84390729e+01,  1.67841279e+01,  1.52345422e+01,
         1.37944943e+01,  1.24664106e+01,  1.12510996e+01,
         1.01434089e+01,  9.13493188e+00,  8.21871774e+00,
         7.38939802e+00,  6.64199558e+00,  5.96814298e+00,
         5.36074579e+00,  4.81355588e+00,  4.32105118e+00,
         3.87840410e+00,  3.48045956e+00,  3.12294849e+00,
         2.80220226e+00,  2.51463108e+00,  2.25672405e+00,
         2.02504916e+00,  1.81642669e+00,  1.62907436e+00,
         1.46123703e+00,  1.31097921e+00,  1.17626459e+00,
         1.05506782e+00,  9.46247372e-01,  8.48717003e-01,
         7.61339453e-01,  6.82995213e-01,  6.12604548e-01,
         5.49389878e-01,  4.92720732e-01,  4.41968021e-01,
         3.96512251e-01,  3.55743517e-01,  3.19074406e-01,
         2.86122687e-01,  2.56588590e-01,  2.30154629e-01,
         2.06496918e-01,  1.85285172e-01,  1.66188672e-01,
         1.49009146e-01,  1.33613581e-01,  1.19845632e-01,
         1.07536790e-01,  9.65063900e-02,  8.65643178e-02,
         7.76104615e-02,  6.95888862e-02,  6.24185804e-02,
         5.60090342e-02,  5.02602401e-02,  4.50731412e-02,
         4.04138619e-02,  3.62427240e-02,  3.25120413e-02,
         2.91708116e-02,  2.61653933e-02,  2.34628810e-02,
         2.10409861e-02,  1.88731424e-02,  1.69321154e-02,
         1.51900019e-02,  1.36219946e-02,  1.22148769e-02,
         1.09548182e-02,  9.82745447e-03,  8.81798819e-03,
         7.91118871e-03,  7.09372449e-03,  6.35968105e-03,
         5.70288835e-03,  5.11633097e-03,  4.59218909e-03,
         4.12183845e-03,  3.69633317e-03,  3.31263013e-03,
         2.96931530e-03,  2.66352099e-03,  2.39130067e-03,
         2.14762896e-03,  1.92650470e-03,  1.72608801e-03,
         1.54681558e-03,  1.38738797e-03,  1.24566931e-03,
         1.11868732e-03,  1.00303426e-03,  8.98650999e-04,
         8.05476946e-04,  7.22674668e-04,  6.48954933e-04,
         5.82576717e-04,  5.22022614e-04,  4.67568368e-04,
         4.19103208e-04,  3.76188888e-04,  3.38080806e-04,
         3.03728000e-04,  2.72014955e-04,  2.43173502e-04,
         2.17590746e-04,  1.95278461e-04,  1.75891997e-04,
         1.58730290e-04,  1.42735854e-04,  1.27140103e-04,
         1.12888544e-04,  1.00699701e-04,  9.07414971e-05,
         8.26333195e-05,  7.54460152e-05,  6.77280556e-05,
         5.95597348e-05,  5.24022097e-05,  4.68442786e-05,
         4.28286032e-05,  3.96517089e-05,  3.59639848e-05,
         3.14445894e-05,  2.74929669e-05,  2.45145386e-05,
         2.24577387e-05,  2.08140138e-05,  1.86659182e-05,
         1.62059517e-05,  1.41354434e-05,  1.26734494e-05,
         1.17511730e-05,  1.10119647e-05,  9.83997275e-06,
         8.29387460e-06,  6.97236471e-06,  6.17095130e-06,
         5.91378779e-06,  5.95367284e-06,  5.77205035e-06,
         4.73490015e-06,  3.32544053e-06,  2.33880706e-06,
         2.15401658e-06,  2.73337233e-06,  3.62246392e-06,
         3.95016732e-06,  2.92817299e-06,  1.77261306e-06,
         1.19650619e-06,  1.36362951e-06,  1.96165042e-06,
         2.20212657e-06,  1.51577399e-06,  8.50809766e-07,
         5.81418301e-07,  7.63904485e-07,  1.15698943e-06,
         1.22181049e-06,  6.77119202e-07,  1.31985922e-07,
        -6.78858352e-08,  1.72203428e-07,  6.96106675e-07,
         1.09683034e-06,  8.68208837e-07,  6.02373376e-07]])

M

(stratification, time)

float64

0.0 1.081 ... 1.17e-06 8.164e-07
<input id='attrs-7f900c3f-3245-4d66-a3a3-75c093323afe' class='xr-var-attrs-in' type='checkbox' disabled><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg><input id='data-e9930b92-72d6-46e5-afdc-1c4f4840e95a' class='xr-var-data-in' type='checkbox'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg>

array([[ 0.00000000e+00,  1.08105518e+00,  2.65220196e+00,
         4.29141186e+00,  5.84997202e+00,  7.30126522e+00,
         8.66550734e+00,  9.97755902e+00,  1.12711211e+01,
         1.25852533e+01,  1.39427453e+01,  1.53703228e+01,
         1.68921901e+01,  1.85268772e+01,  2.02887588e+01,
         2.21974857e+01,  2.42757740e+01,  2.65433058e+01,
         2.90166145e+01,  3.17090847e+01,  3.46417063e+01,
         3.46417063e+01,  3.76100251e+01,  3.98387915e+01,
         4.09567054e+01,  4.10181348e+01,  4.01695069e+01,
         3.86697452e+01,  3.66918474e+01,  3.44360204e+01,
         3.20382850e+01,  2.95932031e+01,  2.71833930e+01,
         2.48593176e+01,  2.26521541e+01,  2.05826321e+01,
         1.86568488e+01,  1.68784664e+01,  1.52489091e+01,
         1.37617106e+01,  1.24060240e+01,  1.11728689e+01,
         1.00553036e+01,  9.04686307e+00,  8.13657896e+00,
         7.31511508e+00,  6.57424057e+00,  5.90667298e+00,
         5.30603681e+00,  4.76551047e+00,  4.27940955e+00,
         3.84283902e+00,  3.45101255e+00,  3.09925245e+00,
         2.78298972e+00,  2.49798880e+00,  2.24183477e+00,
         2.01215645e+00,  1.80635019e+00,  1.62168255e+00,
         1.45543735e+00,  1.30606401e+00,  1.17208720e+00,
         1.05196731e+00,  9.44190998e-01,  8.47300100e-01,
         7.60236432e-01,  6.82138097e-01,  6.12147282e-01,
         5.49420966e-01,  4.93130917e-01,  4.42480607e-01,
         3.96945214e-01,  3.56110709e-01,  3.19541201e-01,
         2.86793651e-01,  2.57417874e-01,  2.30964387e-01,
         2.07159467e-01,  1.85816808e-01,  1.66720203e-01,
         1.49638150e-01,  1.34323856e-01,  1.20518815e-01,
         1.08084002e-01,  9.69394703e-02,  8.69726854e-02,
         7.80590203e-02,  7.00617544e-02,  6.28458603e-02,
         5.63627966e-02,  5.05567720e-02,  4.53616969e-02,
         4.07073675e-02,  3.65203583e-02,  3.27548791e-02,
         2.93794380e-02,  2.63570721e-02,  2.36500882e-02,
         2.12200624e-02,  1.90328078e-02,  1.70696215e-02,
         1.53111276e-02,  1.37373284e-02,  1.23277370e-02,
         1.10613765e-02,  9.91986299e-03,  8.89471830e-03,
         7.97719955e-03,  7.15749055e-03,  6.42475566e-03,
         5.76713984e-03,  5.17240698e-03,  4.63617487e-03,
         4.15625830e-03,  3.72857657e-03,  3.34764784e-03,
         3.00658915e-03,  2.69725253e-03,  2.41701109e-03,
         2.16626966e-03,  1.94315519e-03,  1.74470362e-03,
         1.56685984e-03,  1.40500682e-03,  1.25896163e-03,
         1.12855246e-03,  1.01258974e-03,  9.09294644e-04,
         8.16299191e-04,  7.31537454e-04,  6.55318620e-04,
         5.87448137e-04,  5.27302961e-04,  4.73859385e-04,
         4.25693046e-04,  3.81298056e-04,  3.40951411e-04,
         3.05138743e-04,  2.73852278e-04,  2.46615734e-04,
         2.22484330e-04,  2.00044782e-04,  1.78267126e-04,
         1.58385557e-04,  1.41335900e-04,  1.27328536e-04,
         1.15851113e-04,  1.05668557e-04,  9.48575778e-05,
         8.35167593e-05,  7.35672219e-05,  6.57798220e-05,
         6.00735995e-05,  5.55157778e-05,  5.03217639e-05,
         4.40644478e-05,  3.85863815e-05,  3.44192779e-05,
         3.14923277e-05,  2.91321988e-05,  2.61264738e-05,
         2.27270220e-05,  1.98571500e-05,  1.78041975e-05,
         1.64759544e-05,  1.54006615e-05,  1.37647997e-05,
         1.16446944e-05,  9.82911638e-06,  8.70701326e-06,
         8.30948068e-06,  8.30976242e-06,  8.02325032e-06,
         6.61310688e-06,  4.71620971e-06,  3.38090409e-06,
         3.10671455e-06,  3.84356045e-06,  4.99175600e-06,
         5.40201021e-06,  4.03429577e-06,  2.49243670e-06,
         1.71668092e-06,  1.92285939e-06,  2.69884574e-06,
         3.00455630e-06,  2.08898620e-06,  1.20268393e-06,
         8.39080617e-07,  1.07234329e-06,  1.58414424e-06,
         1.66366104e-06,  9.39864112e-07,  2.16035527e-07,
        -5.19080292e-08,  2.60888391e-07,  9.48425717e-07,
         1.47385086e-06,  1.16951048e-06,  8.16373506e-07]])

C

(stratification, time)

float64

0.0 0.007945 ... 8.843e-08
<input id='attrs-3de0f7f7-c93b-45e8-895c-398451e9c888' class='xr-var-attrs-in' type='checkbox' disabled><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg><input id='data-66d8c908-7955-4584-ba9e-41f88e42ad7c' class='xr-var-data-in' type='checkbox'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg>

array([[0.00000000e+00, 7.94547917e-03, 3.73761302e-02, 8.89053137e-02,
        1.58800636e-01, 2.42574131e-01, 3.36469078e-01, 4.37774059e-01,
        5.44850159e-01, 6.56767407e-01, 7.73346067e-01, 8.94794828e-01,
        1.02180534e+00, 1.15519243e+00, 1.29588046e+00, 1.44504586e+00,
        1.60398354e+00, 1.77408724e+00, 1.95685353e+00, 2.15388190e+00,
        2.36678890e+00, 2.36678890e+00, 2.59646181e+00, 2.83370975e+00,
        3.06218969e+00, 3.26429457e+00, 3.42893412e+00, 3.54819238e+00,
        3.62053366e+00, 3.64686773e+00, 3.63083966e+00, 3.57732795e+00,
        3.49237620e+00, 3.38185708e+00, 3.25091869e+00, 3.10498458e+00,
        2.94902191e+00, 2.78689479e+00, 2.62156021e+00, 2.45605276e+00,
        2.29273524e+00, 2.13341597e+00, 1.97939360e+00, 1.83160448e+00,
        1.69087509e+00, 1.55753688e+00, 1.43181430e+00, 1.31384808e+00,
        1.20369741e+00, 1.10130880e+00, 1.00629093e+00, 9.18226830e-01,
        8.36762750e-01, 7.61608169e-01, 6.92535786e-01, 6.29327110e-01,
        5.71453040e-01, 5.18481674e-01, 4.70054699e-01, 4.25857295e-01,
        3.85607446e-01, 3.48971982e-01, 3.15642838e-01, 2.85345547e-01,
        2.57832617e-01, 2.32880755e-01, 2.10263575e-01, 1.89769862e-01,
        1.71208516e-01, 1.54406524e-01, 1.39208959e-01, 1.25477393e-01,
        1.13072005e-01, 1.01866297e-01, 9.17471588e-02, 8.26123669e-02,
        7.43705828e-02, 6.69408523e-02, 6.02435240e-02, 5.42061848e-02,
        4.87645960e-02, 4.38610057e-02, 3.94441487e-02, 3.54690755e-02,
        3.18915484e-02, 2.86709318e-02, 2.57717612e-02, 2.31623779e-02,
        2.08149293e-02, 1.87047627e-02, 1.68070505e-02, 1.51003132e-02,
        1.35654612e-02, 1.21854682e-02, 1.09453270e-02, 9.83079350e-03,
        8.82909928e-03, 7.92893325e-03, 7.12007239e-03, 6.39338178e-03,
        5.74059934e-03, 5.15413142e-03, 4.62736498e-03, 4.15427106e-03,
        3.72939489e-03, 3.34785584e-03, 3.00525143e-03, 2.69756842e-03,
        2.42128767e-03, 2.17321558e-03, 1.95048066e-03, 1.75053357e-03,
        1.57112868e-03, 1.41010995e-03, 1.26553245e-03, 1.13568299e-03,
        1.01905853e-03, 9.14366242e-04, 8.20517999e-04, 7.36370250e-04,
        6.60819786e-04, 5.92952145e-04, 5.31984579e-04, 4.77266058e-04,
        4.28253261e-04, 3.84296069e-04, 3.44827656e-04, 3.09374750e-04,
        2.77535598e-04, 2.48979969e-04, 2.23407883e-04, 2.00465517e-04,
        1.79862229e-04, 1.61350038e-04, 1.44722139e-04, 1.29812896e-04,
        1.16483427e-04, 1.04542880e-04, 9.38138491e-05, 8.41535882e-05,
        7.54525429e-05, 6.76343492e-05, 6.06558336e-05, 5.44689613e-05,
        4.89336613e-05, 4.39307941e-05, 3.93821474e-05, 3.52503180e-05,
        3.15387123e-05, 2.82898796e-05, 2.54544420e-05, 2.28995792e-05,
        2.05519618e-05, 1.83833230e-05, 1.64104582e-05, 1.46952255e-05,
        1.32351869e-05, 1.19186199e-05, 1.07007293e-05, 9.56819341e-06,
        8.53916324e-06, 7.66010164e-06, 6.90620607e-06, 6.22101106e-06,
        5.58062500e-06, 4.98082729e-06, 4.43706833e-06, 3.98258408e-06,
        3.60715749e-06, 3.26608314e-06, 2.93503917e-06, 2.60791150e-06,
        2.29679385e-06, 2.03198771e-06, 1.85178144e-06, 1.72155432e-06,
        1.58648768e-06, 1.41932844e-06, 1.22043019e-06, 1.01775316e-06,
        8.66864268e-07, 8.18077427e-07, 7.90017160e-07, 7.34531617e-07,
        6.39735615e-07, 5.25200560e-07, 4.41954446e-07, 4.26683933e-07,
        4.16226361e-07, 3.85308919e-07, 3.29649180e-07, 2.64617943e-07,
        2.25239234e-07, 2.29615238e-07, 2.37260703e-07, 2.25079597e-07,
        1.86536006e-07, 1.31643759e-07, 8.69664235e-08, 8.56263180e-08,
        8.84250155e-08]])

Cicurec

(stratification, time)

float64

0.0 7.464e-05 ... 2.508e-07
<input id='attrs-879c1017-e6f5-479e-ad7a-ab0195053fc1' class='xr-var-attrs-in' type='checkbox' disabled><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg><input id='data-00e86f7b-a364-42a3-a975-217d27d3ab4b' class='xr-var-data-in' type='checkbox'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg>

array([[0.00000000e+00, 7.46435879e-05, 6.87381922e-04, 2.44450709e-03,
        5.82430208e-03, 1.11291428e-02, 1.85026784e-02, 2.79798545e-02,
        3.95269912e-02, 5.30678676e-02, 6.85373574e-02, 8.58674777e-02,
        1.04991298e-01, 1.25892823e-01, 1.48601182e-01, 1.73146000e-01,
        1.99590824e-01, 2.28035859e-01, 2.58616670e-01, 2.91504186e-01,
        3.26897134e-01, 3.26897134e-01, 3.64998972e-01, 4.05937703e-01,
        4.49355650e-01, 4.94483466e-01, 5.40145150e-01, 5.85045798e-01,
        6.27904108e-01, 6.67526217e-01, 7.02946188e-01, 7.33468757e-01,
        7.58562058e-01, 7.77956351e-01, 7.91621013e-01, 7.99642054e-01,
        8.02261140e-01, 7.99815612e-01, 7.92715816e-01, 7.81411875e-01,
        7.66433937e-01, 7.48282021e-01, 7.27417861e-01, 7.04273493e-01,
        6.79315072e-01, 6.52992446e-01, 6.25695138e-01, 5.97751982e-01,
        5.69432256e-01, 5.41004201e-01, 5.12728482e-01, 4.84818498e-01,
        4.57449432e-01, 4.30758254e-01, 4.04843718e-01, 3.79775964e-01,
        3.55648838e-01, 3.32517037e-01, 3.10415104e-01, 2.89363502e-01,
        2.69369526e-01, 2.50431915e-01, 2.32537088e-01, 2.15665864e-01,
        1.99794487e-01, 1.84894961e-01, 1.70934871e-01, 1.57875009e-01,
        1.45675873e-01, 1.34298459e-01, 1.23704261e-01, 1.13855091e-01,
        1.04710171e-01, 9.62280070e-02, 8.83689806e-02, 8.10952981e-02,
        7.43709914e-02, 6.81618360e-02, 6.24336885e-02, 5.71535308e-02,
        5.22903038e-02, 4.78147058e-02, 4.36991926e-02, 3.99179566e-02,
        3.64463044e-02, 3.32610479e-02, 3.03405197e-02, 2.76643824e-02,
        2.52136287e-02, 2.29705626e-02, 2.09187613e-02, 1.90430380e-02,
        1.73291920e-02, 1.57639883e-02, 1.43351551e-02, 1.30313875e-02,
        1.18423801e-02, 1.07585509e-02, 9.77098557e-03, 8.87143790e-03,
        8.05231031e-03, 7.30673825e-03, 6.62846527e-03, 6.01165833e-03,
        5.45090534e-03, 4.94121522e-03, 4.47801189e-03, 4.05723297e-03,
        3.67520198e-03, 3.32848495e-03, 3.01388897e-03, 2.72846224e-03,
        2.46949712e-03, 2.23460753e-03, 2.02168116e-03, 1.82874699e-03,
        1.65396842e-03, 1.49564327e-03, 1.35220465e-03, 1.22227479e-03,
        1.10465046e-03, 9.98208773e-04, 9.01905024e-04, 8.14772667e-04,
        7.35926018e-04, 6.64596994e-04, 6.00102853e-04, 5.41807058e-04,
        4.89119046e-04, 4.41494231e-04, 3.98438244e-04, 3.59529059e-04,
        3.24386695e-04, 2.92656108e-04, 2.64007107e-04, 2.38134361e-04,
        2.14759144e-04, 1.93647655e-04, 1.74595921e-04, 1.57411814e-04,
        1.41914719e-04, 1.27935527e-04, 1.15316641e-04, 1.03918668e-04,
        9.36342303e-05, 8.43642818e-05, 7.60137538e-05, 6.84915757e-05,
        6.17106750e-05, 5.55881581e-05, 5.00596709e-05, 4.50774852e-05,
        4.05930003e-05, 3.65580753e-05, 3.29250296e-05, 2.96466428e-05,
        2.66855715e-05, 2.40185169e-05, 2.16195272e-05, 1.94624448e-05,
        1.75209065e-05, 1.57685894e-05, 1.41873605e-05, 1.27643353e-05,
        1.14854903e-05, 1.03364792e-05, 9.30263358e-06, 8.36910575e-06,
        7.52587071e-06, 6.76724656e-06, 6.08670793e-06, 5.47691717e-06,
        4.92972439e-06, 4.43616738e-06, 3.98731202e-06, 3.58085489e-06,
        3.21664054e-06, 2.89269065e-06, 2.60520031e-06, 2.34853803e-06,
        2.11524576e-06, 1.89861201e-06, 1.70253449e-06, 1.52853960e-06,
        1.37554387e-06, 1.24023124e-06, 1.11705302e-06, 1.00172299e-06,
        8.97769502e-07, 8.05968055e-07, 7.25584657e-07, 6.54477420e-07,
        5.89096556e-07, 5.27269978e-07, 4.71404794e-07, 4.22655341e-07,
        3.80959791e-07, 3.45040926e-07, 3.12406146e-07, 2.80110416e-07,
        2.50778330e-07]])

ICU

(stratification, time)

float64

0.0 0.004022 ... 1.761e-07
<input id='attrs-61d4049d-4c23-4e5a-a39b-43cc7f961dab' class='xr-var-attrs-in' type='checkbox' disabled><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg><input id='data-bd6717f1-23d6-4525-8923-3fc23387947d' class='xr-var-data-in' type='checkbox'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg>

array([[0.00000000e+00, 4.02235445e-03, 1.91436875e-02, 4.60685116e-02,
        8.32397610e-02, 1.28603765e-01, 1.80366631e-01, 2.37185762e-01,
        2.98210740e-01, 3.62918688e-01, 4.31171357e-01, 5.03023894e-01,
        5.78774643e-01, 6.58818274e-01, 7.43634608e-01, 8.33829627e-01,
        9.30092243e-01, 1.03318417e+00, 1.14394097e+00, 1.26327200e+00,
        1.39211332e+00, 1.39211332e+00, 1.53103935e+00, 1.67553419e+00,
        1.81718331e+00, 1.94667121e+00, 2.05767751e+00, 2.14539756e+00,
        2.20823466e+00, 2.24587822e+00, 2.25954120e+00, 2.25123503e+00,
        2.22366259e+00, 2.17961304e+00, 2.12166790e+00, 2.05262097e+00,
        1.97513745e+00, 1.89138773e+00, 1.80313094e+00, 1.71218908e+00,
        1.62009735e+00, 1.52808938e+00, 1.43711424e+00, 1.34791720e+00,
        1.26121117e+00, 1.17744736e+00, 1.09698291e+00, 1.02009242e+00,
        9.46969942e-01, 8.77753227e-01, 8.12404300e-01, 7.50841364e-01,
        6.92990354e-01, 6.38784936e-01, 5.88166508e-01, 5.41062989e-01,
        4.97261579e-01, 4.56573633e-01, 4.18835192e-01, 3.83895748e-01,
        3.51613456e-01, 3.21815834e-01, 2.94335641e-01, 2.69019444e-01,
        2.45724938e-01, 2.24319749e-01, 2.04667499e-01, 1.86635570e-01,
        1.70101569e-01, 1.54952789e-01, 1.41086207e-01, 1.28407562e-01,
        1.16820438e-01, 1.06234972e-01, 9.65693410e-02, 8.77484426e-02,
        7.97038890e-02, 7.23737063e-02, 6.56967703e-02, 5.96164579e-02,
        5.40815059e-02, 4.90450203e-02, 4.44644763e-02, 4.03016212e-02,
        3.65193436e-02, 3.30833433e-02, 2.99628436e-02, 2.71297894e-02,
        2.45588480e-02, 2.22271010e-02, 2.01123806e-02, 1.81949555e-02,
        1.64568815e-02, 1.48818274e-02, 1.34550524e-02, 1.21627989e-02,
        1.09926637e-02, 9.93339994e-03, 8.97470005e-03, 8.10719562e-03,
        7.32234208e-03, 6.61237823e-03, 5.97039250e-03, 5.39001117e-03,
        4.86539202e-03, 4.39122430e-03, 3.96268074e-03, 3.57543921e-03,
        3.22564821e-03, 2.90975704e-03, 2.62451340e-03, 2.36696338e-03,
        2.13444473e-03, 1.92453295e-03, 1.73506772e-03, 1.56408311e-03,
        1.40979359e-03, 1.27059397e-03, 1.14505728e-03, 1.03184050e-03,
        9.29722122e-04, 8.37618554e-04, 7.54555337e-04, 6.79667123e-04,
        6.12187527e-04, 5.51365845e-04, 4.96541044e-04, 4.47123979e-04,
        4.02586516e-04, 3.62461530e-04, 3.26325215e-04, 2.93768800e-04,
        2.64438192e-04, 2.38014130e-04, 2.14211414e-04, 1.92778905e-04,
        1.73493511e-04, 1.56132240e-04, 1.40495401e-04, 1.26406821e-04,
        1.13712941e-04, 1.02282821e-04, 9.20081382e-05, 8.27884102e-05,
        7.44961093e-05, 6.70184904e-05, 6.02650193e-05, 5.41673268e-05,
        4.86792089e-05, 4.37759126e-05, 3.93980193e-05, 3.54544904e-05,
        3.18828804e-05, 2.86430382e-05, 2.57171066e-05, 2.31095225e-05,
        2.07987087e-05, 1.87173591e-05, 1.68294399e-05, 1.51141953e-05,
        1.35661474e-05, 1.21936849e-05, 1.09748302e-05, 9.87499561e-06,
        8.87489634e-06, 7.96468796e-06, 7.14396619e-06, 6.42092340e-06,
        5.78513898e-06, 5.21169898e-06, 4.68519313e-06, 4.19866838e-06,
        3.75362893e-06, 3.36003625e-06, 3.03177064e-06, 2.75068024e-06,
        2.48990525e-06, 2.23506829e-06, 1.98429280e-06, 1.74820299e-06,
        1.54992386e-06, 1.41041752e-06, 1.29203923e-06, 1.17209428e-06,
        1.04419677e-06, 9.16123446e-07, 8.09813736e-07, 7.40881940e-07,
        6.80379417e-07, 6.16382286e-07, 5.46406420e-07, 4.76809028e-07,
        4.22788650e-07, 3.92020157e-07, 3.66027195e-07, 3.34152410e-07,
        2.93172218e-07, 2.47292154e-07, 2.08146874e-07, 1.90330892e-07,
        1.76112716e-07]])

R

(stratification, time)

float64

0.0 0.1047 0.5187 ... 235.7 235.7
<input id='attrs-a94c08ce-41f4-4ab3-89e7-df0e8854179a' class='xr-var-attrs-in' type='checkbox' disabled><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg><input id='data-cb765b0a-0fdb-4823-bb4d-f75caeb440c2' class='xr-var-data-in' type='checkbox'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg>

array([[0.00000000e+00, 1.04732665e-01, 5.18739084e-01, 1.30001153e+00,
        2.44765852e+00, 3.94198105e+00, 5.76294398e+00, 7.89648818e+00,
        1.03369987e+01, 1.30845503e+01, 1.61483178e+01, 1.95418260e+01,
        2.32844728e+01, 2.74002647e+01, 3.19175765e+01, 3.68686474e+01,
        4.22894772e+01, 4.82209911e+01, 5.47090941e+01, 6.18046712e+01,
        6.95621098e+01, 6.95621098e+01, 7.80288786e+01, 8.71224506e+01,
        9.66358930e+01, 1.06312082e+02, 1.15938021e+02, 1.25322177e+02,
        1.34341816e+02, 1.42901793e+02, 1.50948147e+02, 1.58454302e+02,
        1.65414876e+02, 1.71838124e+02, 1.77739247e+02, 1.83144601e+02,
        1.88086392e+02, 1.92593865e+02, 1.96694173e+02, 2.00420085e+02,
        2.03804301e+02, 2.06875773e+02, 2.09659775e+02, 2.12179374e+02,
        2.14459842e+02, 2.16523326e+02, 2.18389858e+02, 2.20077521e+02,
        2.21602484e+02, 2.22980418e+02, 2.24225101e+02, 2.25348810e+02,
        2.26362996e+02, 2.27278287e+02, 2.28104487e+02, 2.28850494e+02,
        2.29523716e+02, 2.30130864e+02, 2.30678284e+02, 2.31171936e+02,
        2.31617334e+02, 2.32019024e+02, 2.32381098e+02, 2.32707397e+02,
        2.33001487e+02, 2.33266647e+02, 2.33505703e+02, 2.33721083e+02,
        2.33915053e+02, 2.34089731e+02, 2.34247089e+02, 2.34388939e+02,
        2.34516780e+02, 2.34631901e+02, 2.34735517e+02, 2.34828772e+02,
        2.34912736e+02, 2.34988399e+02, 2.35056573e+02, 2.35117939e+02,
        2.35173142e+02, 2.35222797e+02, 2.35267482e+02, 2.35307739e+02,
        2.35344002e+02, 2.35376630e+02, 2.35405971e+02, 2.35432355e+02,
        2.35456095e+02, 2.35477477e+02, 2.35496722e+02, 2.35514028e+02,
        2.35529588e+02, 2.35543580e+02, 2.35556173e+02, 2.35567507e+02,
        2.35577698e+02, 2.35586860e+02, 2.35595096e+02, 2.35602504e+02,
        2.35609170e+02, 2.35615166e+02, 2.35620555e+02, 2.35625398e+02,
        2.35629750e+02, 2.35633663e+02, 2.35637186e+02, 2.35640354e+02,
        2.35643201e+02, 2.35645757e+02, 2.35648053e+02, 2.35650116e+02,
        2.35651974e+02, 2.35653646e+02, 2.35655148e+02, 2.35656496e+02,
        2.35657706e+02, 2.35658793e+02, 2.35659772e+02, 2.35660653e+02,
        2.35661444e+02, 2.35662154e+02, 2.35662791e+02, 2.35663364e+02,
        2.35663879e+02, 2.35664343e+02, 2.35664759e+02, 2.35665133e+02,
        2.35665468e+02, 2.35665769e+02, 2.35666040e+02, 2.35666284e+02,
        2.35666503e+02, 2.35666699e+02, 2.35666875e+02, 2.35667033e+02,
        2.35667175e+02, 2.35667304e+02, 2.35667419e+02, 2.35667522e+02,
        2.35667614e+02, 2.35667696e+02, 2.35667771e+02, 2.35667838e+02,
        2.35667899e+02, 2.35667954e+02, 2.35668002e+02, 2.35668045e+02,
        2.35668083e+02, 2.35668118e+02, 2.35668151e+02, 2.35668180e+02,
        2.35668205e+02, 2.35668228e+02, 2.35668247e+02, 2.35668266e+02,
        2.35668283e+02, 2.35668298e+02, 2.35668311e+02, 2.35668323e+02,
        2.35668334e+02, 2.35668343e+02, 2.35668352e+02, 2.35668360e+02,
        2.35668367e+02, 2.35668373e+02, 2.35668379e+02, 2.35668384e+02,
        2.35668389e+02, 2.35668393e+02, 2.35668397e+02, 2.35668400e+02,
        2.35668402e+02, 2.35668405e+02, 2.35668407e+02, 2.35668410e+02,
        2.35668412e+02, 2.35668414e+02, 2.35668415e+02, 2.35668416e+02,
        2.35668417e+02, 2.35668418e+02, 2.35668420e+02, 2.35668421e+02,
        2.35668421e+02, 2.35668422e+02, 2.35668422e+02, 2.35668423e+02,
        2.35668424e+02, 2.35668424e+02, 2.35668425e+02, 2.35668425e+02,
        2.35668425e+02, 2.35668426e+02, 2.35668426e+02, 2.35668426e+02,
        2.35668427e+02, 2.35668426e+02, 2.35668426e+02, 2.35668427e+02,
        2.35668427e+02]])

D

(stratification, time)

float64

0.0 7.739e-05 ... 4.313 4.313
<input id='attrs-221944aa-4fe2-439c-ae9a-3dc664ce0063' class='xr-var-attrs-in' type='checkbox' disabled><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg><input id='data-edfd1947-1ee1-4294-9d76-db37f74a791e' class='xr-var-data-in' type='checkbox'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg>

array([[0.00000000e+00, 7.73856425e-05, 7.37837630e-04, 2.71767327e-03,
        6.71032670e-03, 1.32930506e-02, 2.29190094e-02, 3.59449360e-02,
        5.26573797e-02, 7.32974362e-02, 9.80967638e-02, 1.27278181e-01,
        1.61060765e-01, 1.99703596e-01, 2.43506529e-01, 2.92782463e-01,
        3.47874995e-01, 4.09184418e-01, 4.77168272e-01, 5.52341344e-01,
        6.35270202e-01, 6.35270202e-01, 7.26560093e-01, 8.26764854e-01,
        9.35946416e-01, 1.05366203e+00, 1.17890898e+00, 1.31038475e+00,
        1.44657887e+00, 1.58589713e+00, 1.72680112e+00, 1.86788715e+00,
        2.00782241e+00, 2.14548293e+00, 2.27996575e+00, 2.41047452e+00,
        2.53637807e+00, 2.65721704e+00, 2.77268171e+00, 2.88253622e+00,
        2.98667435e+00, 3.08505946e+00, 3.17771809e+00, 3.26472977e+00,
        3.34622911e+00, 3.42241327e+00, 3.49348415e+00, 3.55964593e+00,
        3.62110501e+00, 3.67808435e+00, 3.73085270e+00, 3.77967161e+00,
        3.82478414e+00, 3.86641488e+00, 3.90476994e+00, 3.94004512e+00,
        3.97247322e+00, 4.00226334e+00, 4.02960674e+00, 4.05468145e+00,
        4.07765339e+00, 4.09868487e+00, 4.11792743e+00, 4.13552178e+00,
        4.15159843e+00, 4.16627819e+00, 4.17967534e+00, 4.19189519e+00,
        4.20303540e+00, 4.21318650e+00, 4.22243185e+00, 4.23084789e+00,
        4.23850636e+00, 4.24547209e+00, 4.25180491e+00, 4.25756024e+00,
        4.26278905e+00, 4.26753796e+00, 4.27184989e+00, 4.27576328e+00,
        4.27931352e+00, 4.28253337e+00, 4.28545295e+00, 4.28809975e+00,
        4.29049876e+00, 4.29267229e+00, 4.29464084e+00, 4.29642335e+00,
        4.29803716e+00, 4.29949806e+00, 4.30082023e+00, 4.30201639e+00,
        4.30309829e+00, 4.30407670e+00, 4.30496146e+00, 4.30576146e+00,
        4.30648453e+00, 4.30713788e+00, 4.30772817e+00, 4.30826146e+00,
        4.30874328e+00, 4.30917847e+00, 4.30957138e+00, 4.30992604e+00,
        4.31024614e+00, 4.31053509e+00, 4.31079597e+00, 4.31103142e+00,
        4.31124380e+00, 4.31143534e+00, 4.31160806e+00, 4.31176383e+00,
        4.31190437e+00, 4.31203114e+00, 4.31214542e+00, 4.31224843e+00,
        4.31234125e+00, 4.31242490e+00, 4.31250032e+00, 4.31256829e+00,
        4.31262955e+00, 4.31268472e+00, 4.31273443e+00, 4.31277920e+00,
        4.31281953e+00, 4.31285586e+00, 4.31288858e+00, 4.31291804e+00,
        4.31294457e+00, 4.31296845e+00, 4.31298996e+00, 4.31300932e+00,
        4.31302675e+00, 4.31304244e+00, 4.31305655e+00, 4.31306926e+00,
        4.31308069e+00, 4.31309099e+00, 4.31310025e+00, 4.31310858e+00,
        4.31311608e+00, 4.31312282e+00, 4.31312888e+00, 4.31313434e+00,
        4.31313925e+00, 4.31314367e+00, 4.31314764e+00, 4.31315121e+00,
        4.31315443e+00, 4.31315732e+00, 4.31315991e+00, 4.31316224e+00,
        4.31316434e+00, 4.31316624e+00, 4.31316794e+00, 4.31316947e+00,
        4.31317083e+00, 4.31317207e+00, 4.31317318e+00, 4.31317417e+00,
        4.31317507e+00, 4.31317588e+00, 4.31317660e+00, 4.31317725e+00,
        4.31317783e+00, 4.31317836e+00, 4.31317884e+00, 4.31317926e+00,
        4.31317964e+00, 4.31317998e+00, 4.31318029e+00, 4.31318057e+00,
        4.31318082e+00, 4.31318104e+00, 4.31318124e+00, 4.31318142e+00,
        4.31318158e+00, 4.31318172e+00, 4.31318186e+00, 4.31318198e+00,
        4.31318209e+00, 4.31318218e+00, 4.31318226e+00, 4.31318234e+00,
        4.31318241e+00, 4.31318247e+00, 4.31318253e+00, 4.31318257e+00,
        4.31318262e+00, 4.31318266e+00, 4.31318269e+00, 4.31318273e+00,
        4.31318276e+00, 4.31318278e+00, 4.31318280e+00, 4.31318282e+00,
        4.31318284e+00, 4.31318286e+00, 4.31318288e+00, 4.31318289e+00,
        4.31318290e+00]])

SQ

(stratification, time)

float64

0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0
<input id='attrs-32ceae59-9dcc-4b71-81f6-31de27522a48' class='xr-var-attrs-in' type='checkbox' disabled><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg><input id='data-80184c47-f06a-490b-a0a7-278d3bb3d060' class='xr-var-data-in' type='checkbox'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg>

array([[0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
        0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
        0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
        0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
        0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
        0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
        0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
        0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
        0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
        0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
        0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
        0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
        0., 0., 0., 0., 0., 0., 0., 0., 0.]])

EQ

(stratification, time)

float64

0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0
<input id='attrs-a6fb03e3-3663-4a17-b1c7-9e174b622246' class='xr-var-attrs-in' type='checkbox' disabled><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg><input id='data-36ce71f9-31a5-45ad-acb2-cadbd90422d9' class='xr-var-data-in' type='checkbox'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg>

array([[0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
        0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
        0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
        0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
        0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
        0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
        0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
        0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
        0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
        0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
        0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
        0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
        0., 0., 0., 0., 0., 0., 0., 0., 0.]])

IQ

(stratification, time)

float64

0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0
<input id='attrs-c4fdbc81-43bb-49a7-86cf-d7ec2b787892' class='xr-var-attrs-in' type='checkbox' disabled><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg><input id='data-bcbb8243-c506-4965-af9b-90686c818e1c' class='xr-var-data-in' type='checkbox'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg>

array([[0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
        0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
        0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
        0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
        0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
        0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
        0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
        0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
        0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
        0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
        0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
        0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
        0., 0., 0., 0., 0., 0., 0., 0., 0.]])

AQ

(stratification, time)

float64

0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0
<input id='attrs-66ece59a-ba1c-4b4f-ba49-ee489a5500a9' class='xr-var-attrs-in' type='checkbox' disabled><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg><input id='data-39e274c9-8994-4437-8c6f-2e92b3298a8c' class='xr-var-data-in' type='checkbox'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg>

array([[0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
        0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
        0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
        0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
        0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
        0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
        0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
        0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
        0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
        0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
        0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
        0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
        0., 0., 0., 0., 0., 0., 0., 0., 0.]])

MQ

(stratification, time)

float64

0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0
<input id='attrs-88b37840-8444-4e33-bfad-a76dbde3651f' class='xr-var-attrs-in' type='checkbox' disabled><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg><input id='data-25bd20cb-ff0a-4d0b-811a-327c069865ca' class='xr-var-data-in' type='checkbox'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg>

array([[0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
        0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
        0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
        0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
        0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
        0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
        0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
        0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
        0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
        0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
        0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
        0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
        0., 0., 0., 0., 0., 0., 0., 0., 0.]])

RQ

(stratification, time)

float64

0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0
<input id='attrs-32dcc8de-8ba5-4193-80f6-49b9b0501f00' class='xr-var-attrs-in' type='checkbox' disabled><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg><input id='data-ea5d7816-5576-4221-825c-dcc81045d27f' class='xr-var-data-in' type='checkbox'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg>

array([[0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
        0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
        0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
        0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
        0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
        0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
        0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
        0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
        0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
        0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
        0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
        0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
        0., 0., 0., 0., 0., 0., 0., 0., 0.]])

C_total

(stratification, time)

float64

0.0 0.00802 ... 3.657e-07 3.392e-07
<input id='attrs-c3637264-dc6b-4f08-9f5c-d9b183e14900' class='xr-var-attrs-in' type='checkbox' disabled><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg><input id='data-51670de3-1e52-4c46-a45c-541ba7c21199' class='xr-var-data-in' type='checkbox'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg>

array([[0.00000000e+00, 8.02012276e-03, 3.80635121e-02, 9.13498208e-02,
        1.64624938e-01, 2.53703274e-01, 3.54971757e-01, 4.65753914e-01,
        5.84377150e-01, 7.09835274e-01, 8.41883424e-01, 9.80662306e-01,
        1.12679664e+00, 1.28108525e+00, 1.44448164e+00, 1.61819186e+00,
        1.80357437e+00, 2.00212310e+00, 2.21547020e+00, 2.44538608e+00,
        2.69368603e+00, 2.69368603e+00, 2.96146079e+00, 3.23964745e+00,
        3.51154534e+00, 3.75877803e+00, 3.96907927e+00, 4.13323817e+00,
        4.24843777e+00, 4.31439395e+00, 4.33378585e+00, 4.31079671e+00,
        4.25093826e+00, 4.15981343e+00, 4.04253971e+00, 3.90462664e+00,
        3.75128305e+00, 3.58671040e+00, 3.41427603e+00, 3.23746464e+00,
        3.05916918e+00, 2.88169800e+00, 2.70681147e+00, 2.53587798e+00,
        2.37019016e+00, 2.21052932e+00, 2.05750944e+00, 1.91160006e+00,
        1.77312966e+00, 1.64231300e+00, 1.51901941e+00, 1.40304533e+00,
        1.29421218e+00, 1.19236642e+00, 1.09737950e+00, 1.00910307e+00,
        9.27101877e-01, 8.50998711e-01, 7.80469804e-01, 7.15220797e-01,
        6.54976971e-01, 5.99403897e-01, 5.48179926e-01, 5.01011411e-01,
        4.57627104e-01, 4.17775716e-01, 3.81198446e-01, 3.47644871e-01,
        3.16884389e-01, 2.88704983e-01, 2.62913220e-01, 2.39332484e-01,
        2.17782176e-01, 1.98094304e-01, 1.80116139e-01, 1.63707665e-01,
        1.48741574e-01, 1.35102688e-01, 1.22677212e-01, 1.11359716e-01,
        1.01054900e-01, 9.16757115e-02, 8.31433412e-02, 7.53870321e-02,
        6.83378528e-02, 6.19319797e-02, 5.61122808e-02, 5.08267603e-02,
        4.60285580e-02, 4.16753253e-02, 3.77258118e-02, 3.41433512e-02,
        3.08946532e-02, 2.79494565e-02, 2.52804821e-02, 2.28621810e-02,
        2.06714794e-02, 1.86874841e-02, 1.68910580e-02, 1.52648197e-02,
        1.37929096e-02, 1.24608697e-02, 1.12558303e-02, 1.01659294e-02,
        9.18030023e-03, 8.28907106e-03, 7.48326333e-03, 6.75480139e-03,
        6.09648965e-03, 5.50170052e-03, 4.96436962e-03, 4.47899581e-03,
        4.04062580e-03, 3.64471747e-03, 3.28721362e-03, 2.96442998e-03,
        2.67302695e-03, 2.41000952e-03, 2.17272265e-03, 1.95864504e-03,
        1.76547024e-03, 1.59116092e-03, 1.43388960e-03, 1.29203872e-03,
        1.16417928e-03, 1.04889306e-03, 9.44930509e-04, 8.51181808e-04,
        7.66654643e-04, 6.90474200e-04, 6.21846127e-04, 5.59994576e-04,
        5.04248924e-04, 4.54006146e-04, 4.08729246e-04, 3.67947257e-04,
        3.31242571e-04, 2.98190535e-04, 2.68409770e-04, 2.41565402e-04,
        2.17367261e-04, 1.95569876e-04, 1.75972474e-04, 1.58387629e-04,
        1.42567892e-04, 1.28295076e-04, 1.15395901e-04, 1.03741894e-04,
        9.32493873e-05, 8.38780377e-05, 7.55141129e-05, 6.79770644e-05,
        6.11449621e-05, 5.49413983e-05, 4.93354878e-05, 4.43418683e-05,
        3.99207584e-05, 3.59371368e-05, 3.23202565e-05, 2.90306382e-05,
        2.60600698e-05, 2.34286910e-05, 2.10935665e-05, 1.89853464e-05,
        1.70661153e-05, 1.53173065e-05, 1.37397019e-05, 1.23516898e-05,
        1.11330282e-05, 1.00333297e-05, 9.02174710e-06, 8.08482868e-06,
        7.22651824e-06, 6.46815509e-06, 5.83909346e-06, 5.30240920e-06,
        4.80312822e-06, 4.31201909e-06, 3.82563050e-06, 3.36629119e-06,
        2.98211002e-06, 2.71668944e-06, 2.49255165e-06, 2.26307122e-06,
        2.01527949e-06, 1.76543180e-06, 1.55900746e-06, 1.42840692e-06,
        1.31399586e-06, 1.19127697e-06, 1.05523384e-06, 9.19095363e-07,
        8.14335790e-07, 7.56885216e-07, 7.08665497e-07, 6.47734939e-07,
        5.67495797e-07, 4.76684685e-07, 3.99372570e-07, 3.65736734e-07,
        3.39203346e-07]])

H

(stratification, time)

float64

0.0 0.01204 ... 5.561e-07 5.153e-07
<input id='attrs-8cf6f86c-fc53-4082-9cd0-2f894edc85ef' class='xr-var-attrs-in' type='checkbox' disabled><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg><input id='data-7758cf16-9ada-442f-94aa-3b2c65e707e7' class='xr-var-data-in' type='checkbox'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg>

array([[0.00000000e+00, 1.20424772e-02, 5.72071996e-02, 1.37418332e-01,
        2.47864699e-01, 3.82307039e-01, 5.35338388e-01, 7.02939676e-01,
        8.82587890e-01, 1.07275396e+00, 1.27305478e+00, 1.48368620e+00,
        1.70557128e+00, 1.93990353e+00, 2.18811625e+00, 2.45202149e+00,
        2.73366661e+00, 3.03530727e+00, 3.35941117e+00, 3.70865809e+00,
        4.08579935e+00, 4.08579935e+00, 4.49250014e+00, 4.91518164e+00,
        5.32872866e+00, 5.70544925e+00, 6.02675679e+00, 6.27863574e+00,
        6.45667243e+00, 6.56027217e+00, 6.59332705e+00, 6.56203174e+00,
        6.47460084e+00, 6.33942648e+00, 6.16420761e+00, 5.95724761e+00,
        5.72642050e+00, 5.47809813e+00, 5.21740696e+00, 4.94965371e+00,
        4.67926653e+00, 4.40978738e+00, 4.14392571e+00, 3.88379517e+00,
        3.63140134e+00, 3.38797669e+00, 3.15449235e+00, 2.93169249e+00,
        2.72009961e+00, 2.52006623e+00, 2.33142372e+00, 2.15388669e+00,
        1.98720254e+00, 1.83115136e+00, 1.68554601e+00, 1.55016606e+00,
        1.42436346e+00, 1.30757234e+00, 1.19930500e+00, 1.09911655e+00,
        1.00659043e+00, 9.21219731e-01, 8.42515567e-01, 7.70030854e-01,
        7.03352042e-01, 6.42095465e-01, 5.85865946e-01, 5.34280441e-01,
        4.86985957e-01, 4.43657772e-01, 4.03999427e-01, 3.67740046e-01,
        3.34602614e-01, 3.04329276e-01, 2.76685480e-01, 2.51456108e-01,
        2.28445463e-01, 2.07476395e-01, 1.88373983e-01, 1.70976173e-01,
        1.55136406e-01, 1.40720732e-01, 1.27607818e-01, 1.15688653e-01,
        1.04857196e-01, 9.50153230e-02, 8.60751244e-02, 7.79565497e-02,
        7.05874059e-02, 6.39024262e-02, 5.78381924e-02, 5.23383067e-02,
        4.73515347e-02, 4.28312838e-02, 3.87355345e-02, 3.50249799e-02,
        3.16641431e-02, 2.86208841e-02, 2.58657580e-02, 2.33720153e-02,
        2.11152517e-02, 1.90732479e-02, 1.72262227e-02, 1.55559406e-02,
        1.40456923e-02, 1.26802954e-02, 1.14459441e-02, 1.03302406e-02,
        9.32213786e-03, 8.41145756e-03, 7.58888302e-03, 6.84595919e-03,
        6.17507053e-03, 5.56925042e-03, 5.02228133e-03, 4.52851309e-03,
        4.08282054e-03, 3.68060349e-03, 3.31777993e-03, 2.99048554e-03,
        2.69519237e-03, 2.42877947e-03, 2.18844494e-03, 1.97170585e-03,
        1.77636681e-03, 1.60025891e-03, 1.44147155e-03, 1.29830579e-03,
        1.16924116e-03, 1.05293573e-03, 9.48171342e-04, 8.53763376e-04,
        7.68687116e-04, 6.92020277e-04, 6.22940660e-04, 5.60726162e-04,
        5.04736082e-04, 4.54322776e-04, 4.08905171e-04, 3.67972223e-04,
        3.31080202e-04, 2.97852697e-04, 2.67980613e-04, 2.41176039e-04,
        2.17064001e-04, 1.95313566e-04, 1.75660920e-04, 1.57909221e-04,
        1.41928596e-04, 1.27653950e-04, 1.14912132e-04, 1.03431555e-04,
        9.30278425e-05, 8.35844365e-05, 7.50525945e-05, 6.74513908e-05,
        6.07194670e-05, 5.46544958e-05, 4.91496964e-05, 4.41448335e-05,
        3.96262171e-05, 3.56223759e-05, 3.20683968e-05, 2.88603420e-05,
        2.59410116e-05, 2.32819944e-05, 2.08836681e-05, 1.87726132e-05,
        1.69181672e-05, 1.52450287e-05, 1.37069402e-05, 1.22834971e-05,
        1.09801472e-05, 9.82819134e-06, 8.87086410e-06, 8.05308945e-06,
        7.29303346e-06, 6.54708738e-06, 5.80992329e-06, 5.11449418e-06,
        4.53203388e-06, 4.12710696e-06, 3.78459089e-06, 3.43516550e-06,
        3.05947625e-06, 2.68155525e-06, 2.36882120e-06, 2.16928886e-06,
        1.99437528e-06, 1.80765926e-06, 1.60164026e-06, 1.39590439e-06,
        1.23712444e-06, 1.14890537e-06, 1.07469269e-06, 9.81887349e-07,
        8.60668015e-07, 7.23976839e-07, 6.07519443e-07, 5.56067626e-07,
        5.15316062e-07]])

<input id='section-b85d8826-2182-43a5-a809-aedb94cff76c' class='xr-section-summary-in' type='checkbox'  checked>Attributes: (1)

parameters :

{'beta': 0.03492, 'sigma': 3.2, 'omega': 2.0, 'zeta': 0.0, 'a': array([0.43]), 'm': array([0.57]), 'da': 7.0, 'dm': 7.0, 'dc': 6.0, 'dICU': 8.0, 'dICUrec': 6.5, 'dhospital': 7.5, 'totalTests': 0.0, 'psi_FP': 0.0, 'psi_PP': 0.0, 'dq': 14.0, 'h': array([0.2]), 'c': array([0.66666667]), 'm0': array([0.5]), 'icu': array([0.33333333]), 'Nc': array([11.2])}

```python
output.infected(out)
```

#### Lander model

Set SEIRD model parameters.
Following assumptions are made:
- $S_0 = 1.1\,10^7$ (population of Belgium)
- $I_0 = 2$ (first recorded number of infected individuals @ March 1)
- $E_0 = I_0 * 10$ (estimation of initial number of exposed individuals)

```python
# Initial values
# s_0 = 11*10**6     # initial susceptible population (population of Belgium)
# e_0 = 20.0         # initial exposed population
# i_0 = 2.0          # initial infectious population (from data)
# r_0 = 0.0          # initial recovered population
# d_0 = 0.0          # initial dead population

# y_0 = [s_0, e_0, i_0, r_0, d_0] # Bundle initial conditions for ODE solver

# Make time array for simulation (measured in days)
tStop = 21.
tInc =  1.
t_vec = np.arange(0., tStop, tInc)

# Bundle fixed parameters as dict
fixed_model_parameters = {}
fixed_model_parameters["y_0"] = y_0
fixed_model_parameters["t_vec"] = t_vec
```

### Summary statistic function
For this example the "summary statistics" are the number of infected, recovered and dead individuals of the first 20 days of the outbreak.

```python
def summary_stat_f(y):
    """
    Selects the infected, recovered and dead individuals of the first 20 days.
    And ravels them to a 1D array.
    """
    return y[:21,:].ravel()
```

### Load observed data

```python
sciensano_data = sciensano.get_sciensano_COVID19_data(update=False)

```

```python
y_obs_ICU = sciensano_data.ICU_tot
y_obs_C = sciensano_data.H_tot - sciensano_data.ICU_tot
```

```python
y_obs = np.full((y_obs_ICU.shape[0],2),np.nan)
y_obs[:,0] = y_obs_ICU
y_obs[:,1] = y_obs_C

s_obs = summary_stat_f(y_obs)
```

```python
plt.plot(y_obs_ICU[:21], ".")
```

```python
plt.plot(y_obs_C[:21], ".")
```

### ABC hyperparameters
#### Dimensions

```python
n_s = s_obs.shape #shape of summary statistic array
n_particles = 1000 # number of particles
```

#### Priors

```python
#distribution of parameter vectors [beta, sigma] # took just some parameters for now
# if you take more parameters, also fill in min, max values and param_bounds
n_param = 2
theta_min = (1e-9, 0)   # minimum values of uniform priors
theta_max = (1e-7, 1)   # maximum value of prior
param_bounds = np.array([[0,      0],       # lower parameter bounds
                         [np.nan, np.nan]]) # upper parameter bounds
def uniform_priors(N_param, theta_min = theta_min, theta_max = theta_max, n_param = n_param):
    """
    Uniform prior distributions for parameter vectors [BETA, GAMMA, OMEGA, DELTA]

    Parameters
    ----------
    N_param : int
        Number of particles to be drawn.

    theta_min : ndarray
        minimum values of uniform priors.

    theta_max : ndarray
        maximum value of uniform priors.
    n_param : int
        number of parameters to be inferred.

    Returns
    -------
    param_dist_0
        initial parameter vector distribution.

    """
    theta_min = np.array(theta_min)
    theta_max = np.array(theta_max)
    return np.random.uniform(theta_min, theta_max, (N_param,n_param))
```

#### Construct generative function

```python
def GM_dist(params_dist,
       n_draws_per_param,
       summary_stat_f,
       n_s,
       t_vec,
       y_0):
    """
    Generative model for the SEIRD epidemic model.
    The outputs that are generated are the specified summary statistics of the
    model output.

    Parameters
    ----------
    params_dist : ndarray,
        array containing distribution of parameter vectors [BETA, GAMMA, OMEGA, DELTA] of the SEIRD model
    n_draws_per_param : int,
        number of times the simulated data are generated per parameter vector
    summary_stat_f : JIT-compiled function:
        summary statistic of model outputs
    n_s :
        shape of the summary statistic array
    t_vec : ndarray
        sequence of time points for which to solve for the system of equations
    y_0 : ndarray
        number of generations

    Returns
    -------
    stat_dist : ndarray
        distribution of summary statistics of model outputs, generated with
        the distribution of parameter vectors.
    """
    N = params_dist.shape[0]
    stat_dist = np.empty((N, n_draws_per_param, *n_s))
    for i in range(0,N):
        current_params = params_dist[i]
        params['beta'] = current_params[0]
        params['sigma'] = current_params[1]
#         params['omega'] = current_params[2]
#         params['m0'] = np.array([current_params[3]])
        model = models.COVID19_SEIRD(initial_states, params)
        time = [0, 20]
        out = model.sim(time)
        y = np.full((out['ICU'].shape[1],2),np.nan)
        y[:,0] = out['ICU']
        y[:,1] = out['C']
        stat_dist[i,:,:] = summary_stat_f(y)
    return stat_dist

```

```python
# params_dist = uniform_priors(N_param=1)
# params['beta'] = params_dist[0,0]
# params['sigma'] = params_dist[0,1]
# params['omega'] = params_dist[0,2]
# params['m0'] = np.array([params_dist[0,3]])
```

```python
# model = models.COVID19_SEIRD(initial_states, params)
# time = [0, 20]
# out = model.sim(time)
```

```python
# y = np.full((out['ICU'].shape[1],2),np.nan)
# y[:,0] = out['ICU']
# y[:,1] = out['C']
```

#### Create SMC_MCMC object
The ABC module contains the class `SMC_MCMC` which, upon creation, sets all necessary hyperparameters and functions as attributes/methods.
To make an SMC_MCMC object, you have to provide at least the following:
- `generative_model` : a function that accepts following arguments
    - `params_dist` : the particle distribution (i.e. `n_particles` parameter vectors of size length `n_param`
    - `n_draws_per_param` : number of times the simulated data are generated per parameter vector (for deterministic models, use 1)
    - `summary_stat_f` : summary statistic function
    - `n_s` : shape (tuple) of the summary statistic array
    - some fixed model parameters

- `priors` : function that can draw particles from the prior distribution (**REMARK**: at the moment, code is only usable for **uniform priors**)
- `n_param` : number of parameters that are to be inferred
- `y_obs` : observed outputs
- `summary_stat_f` : summary statistic function

Next to that, additional hyperparameters can be set:

- `ESS_min_factor` : ESS threshold for resampling (= fraction of n_particles)
- `fixed_model_parameters` : arguments of the `generative_model` that are fixed during calibration
- `max_SMC_iter`: maximum number of SMC iterations
- `distance_f` : distance function to be used (here Euclidean distance), custom functions can be used directly or added to the distances.py module
- `smoothing_kernel_f`: function to be used as smoothing kernel (-> gaussian leads to smoother behaviour than uniform)
- `alpha_ESS`: factor to decrease the ESS at every iteration (keep around 0.9)

Lastly, some words on the MCMC kernel (used in the move step). This is implemented as a separate class, of which the attributes are passed in the dict `MCMC_kernel_specifics`.
To ensure convergence, the scale of the parameter perturbation also needs to decrease during iterations.
When the mode `dynamic_param_dist_range` is selected, the scale is set as a fraction (`r_MCMC`) of the range of particles with weights above 0.
Finally, the range of the parameters can be bounded (see -> priors).

```python
covid_ABC = ABC.SMC_MCMC(GM_dist, #SEIRD.GM_dist
                              priors = uniform_priors,
                              n_param = n_param,
                              y_obs = y_obs,
                              summary_stat_f = summary_stat_f,
                              s_obs = False,
                              ESS_min_factor = 0.5,
                              n_particles = n_particles,
                              n_draws_per_param = 1,
                              fixed_model_parameters = fixed_model_parameters,
                              max_SMC_iter = 151,
                              zero_tol = 5e-4,
                              distance_f = "Euclidean",
                              smoothing_kernel_f = "gaussian",
                              alpha_ESS = 0.9,
                              MCMC_kernel_specifics = {
                                  "kernel_f" : "gaussian",
                                  "scale_mode":"dynamic_param_dist_range",
                                  "r_MCMC" : 0.2,
                                  "bounds" : param_bounds})
```

### Create results folder

```python
obs_group = "COVID19_BE"
timestamp = str(datetime.now()).replace(":","-").split(".")[0]
results_folder = f"SMC_{timestamp}"
results_path = os.path.join("..","results","COVID19", obs_group, "demo", results_folder)

```

## Run ABC

**Not working when sampling 2 instead of 4 param**

```python
# =============================================================================
# %% Run algorithm
# =============================================================================
param_distributions, weight_distributions, ABC_bandwiths = covid_ABC.run(results_path,seed = sim_seed)
```

    INFO:root:
    =========================================================================================================================
    Approximate Bayesian Computation

    Version:                                       [ABC_implementation]-Merge branch 'master' into ABC_implementation-0d7409b3a6e41aecc1c13bfce2daed1b25cddc16
    SMC-MCMC algorithm started at                  2020-06-12 12:10:36.714884
    with seed 300494
    =========================================================================================================================

    INFO:root:iter	 bandwith	ESS
    INFO:root:  0	   38373.41	1000
    INFO:root:  1	     667.95	1000:            1000 particles moved of the 1000 candidates
    INFO:root:  2	     255.13	nan:
    ERROR:root:
    -------------------------------------------------------------------------------------------------------------------------
    Iteration   2:
        all particle weights are zero.

    SMC-MCMC algorithm stopped at                  2020-06-12 12:13:30.766322
    =========================================================================================================================
    NoneType: None

```python

```

If the algorithm is terminated before the maximum nuber of iterations is reached, this is probably due to issues with the decreasing the bandwith below the (unknown) minimum. Use the particle distribution of the iteration before the last resample as end result.

```python
# =============================================================================
# %% Write results
# =============================================================================
metadata_dict = metadata.get_metadata_from_attributes(covid_ABC,
                                                      skip_attributes = ["param_distributions","weight_distributions","ABC_bandwiths", "logger_header", "logger_sim"],
                                                      custom_classes = {ABC.MCMC_kernel : lambda x : metadata.get_metadata_from_attributes(x,skip_attributes = ["MCMC_object"]),
                                                                        datetime : lambda x : str(x)})
metadata_dict["modulde_versions_global"] = modulde_versions_global

file_path = store_results.write_results_hdf5(
    os.path.join(results_path,results_folder),
                                 metadata_dict,
                                 param_distributions = param_distributions,
                                 weight_distributions = weight_distributions,
                                 ABC_bandwiths = ABC_bandwiths)
```

## Plot results

#### diagnostic plots of ABC convergence

```python
plt.figure()
plt.semilogy(ABC_bandwiths)
plt.title("Evolution of tolerated distance from observations")
plt.xlabel("iteration")

plt.figure()
plt.title("Evolution of number of moved particles")
plt.xlabel("iteration")
plt.plot(covid_ABC.moved_particles[:covid_ABC.i_SMC])

plt.figure()
plt.title("Evolution of number of move candidates")
plt.xlabel("iteration")
plt.plot(covid_ABC.move_candidates[:covid_ABC.i_SMC])

plt.figure()
plt.title("Evolution of ratio of moved particles/move candidates")
plt.xlabel("iteration")
plt.plot(covid_ABC.moved_particles[:covid_ABC.i_SMC]/covid_ABC.move_candidates[:covid_ABC.i_SMC])
```

#### Plots of marginal posterior parameter distributions
First, select SMC iteration. (before break)

```python
i_SMC = param_distributions.shape[0]-3
print(i_SMC)
```

Plot parameter distributions.

```python
parameter_names = ["$\\beta$","$\\gamma$","$\\omega$","$\\delta$" ]
plt.figure()
for i in range(4):
    plt.subplot(2,2,i+1)
    plt.title(parameter_names[i])
    plt.hist(param_distributions[0,:,i], weights = weight_distributions[0,:]/np.sum( weight_distributions[0,:]), alpha = 0.5)
    plt.hist(param_distributions[i_SMC,:,i], weights = weight_distributions[i_SMC,:]/np.sum( weight_distributions[i_SMC,:]),alpha = 0.75)
plt.tight_layout()
plt.savefig(os.path.join(results_path,f"param_dist_iSMC{i_SMC}.png"),bbox_inches = "tight")
```

#### plot simulations with posterior

```python
posterior
```

```python
posterior = param_distributions[i_SMC,:]
norm_weights = weight_distributions[i_SMC,:]/np.sum(weight_distributions[i_SMC,:])
g = sns.pairplot(pd.DataFrame(posterior, columns = parameter_names),
                 diag_kind="hist",
                 diag_kws = {"weights": norm_weights },
                 plot_kws= {"size": norm_weights, "alpha" : 0.05, "markers" : ".", "edgecolor" : "tab:blue"},
                 corner=True)
g.savefig(os.path.join(results_path,f"param_pairplot_iSMC{i_SMC}.png"))
```

```python
t_stop_sim = 25
y_sim = SEIRD.GM_dist(posterior,         # parameters
                      1,                 # n_draws_per_parameter
                      lambda y : y,      # return raw simulation outputs
                      (t_stop_sim,5),
                      np.arange(0., t_stop_sim, tInc), # t_vec
                      y_0)               # inital conditions

for subpop in ["exposed", "infected", "recovered", "dead"]:
     fig,ax = SEIRD.plot_full_posterior_sim(y_obs,y_sim, norm_weights/np.max(norm_weights), t_stop_sim, subpop, tStop, alpha_scale = 0.05)
     fig.savefig(os.path.join(results_path,f"postsim_iSMC{i_SMC}_{subpop}.png"))
```

```python

```


```python
import sympy as sym
import numpy as np
from sympy import lowergamma as lg
from IPython.display import display, Latex
import scipy.special as ss
import scipy.optimize as so
```

```python
#Parameters

#Constants
n = 2.7                                     #concentration parameter that describes the curvature of the profile in a radius-magnitude plot, n=4 is de Vaucoileurs profile
re = 2.6                                    #1kpc
L = 3.27e10                                 #luminosity
G = 4.300e-6                                #gravitational constant (kpc/solar mass*(km/s)^2)
ups = 2.8                                   #mass-to-light ratio (from Rotation Curves of Sersic Bulges paper)
q = 0.33                                    #intrinsic axis ratio
i = 45*(sym.pi/180)                          #inclination angle

#Gamma Function
def f(x):
    return sym.gamma(2*n)*(lg(2*n,x)-0.5)
root = so.brentq(f,0,500000,rtol=0.000001,maxiter=100) #come within 1% of exact root within 100 iterations

#Inner Function
innerf = lambda x,m,n,re: ((sym.exp(-sym.power(x/r0(n,re), (1/n))))*(sym.power(x/r0(n,re), ((1/n)-1))))/(sym.sqrt((x**2)-(m**2)))
#Integrate Inner Function
g = lambda m,n,re: quad(innerf, m, sym.inf,args=(m,n,re,))[0]
I0 = (L*(root**(2*n)))/(((re**2)*2*np.pi*n)*ss.gamma(2*n))
r0 = re/root**n

#equations
C = (4*G*q*ups*I0)/(r0*n)*(sym.sqrt((sym.sin(i)**2)+(1/(q**2))*(sym.cos(i)**2)))
e2 = 1-(q**2)

#Set up h
def h(m,r):
    return C*g(m)*(m**2)/(sym.sqrt((r**2)-((m**2)*(e2))))

r = sym.Symbol('r')
#sym.integrate(h,r) #Not working >:?
```

```python
sym.init_printing(use_latex='mathjax')
#int_x = sym.Integral(sym.cos(x)*sym.exp(x),x)
result = "{}".format(sym.latex(C))
display(Latex(result))
```

956.030435131715

Wolfram alpha says there is no symbolic solution :( it did a taylor expansion but that won't be valid everywhere, just at very small r~0.

```python

```