<jupyter_start><jupyter_text>susceptible = xinfectious = suceptible.exposed()removed = infectious.recover()dying = removed.dies()def susceptible(population):    def dies(removed):<jupyter_code>def F(x, t, R0=3):
    """
    Time derivative of the state vector.

        * x is the state vector (array_like)
        * t is time (scalar)
        * R0 is the effective transmission rate, defaulting to a constant

    """
    susceptible, exposed, infectious = x
    print(x)

    # New exposure of susceptibles
    b = R0(t) * y if callable(R0) else R0 * y
    ne = b * susceptible * infectious

    # Time derivatives
    ds = - ne
    de = ne - sigma * e
    di = sigma * e - y * i

    return ds, de, di
# initial conditions of s, e, i
i_0 = 1e-7
e_0 = 4 * i_0
s_0 = 1 - i_0 - e_0
x_0 = s_0, e_0, i_0
def solve_path(R0, t_vec, x_init=x_0):
    """
    Solve for i(t) and c(t) via numerical integration,
    given the time path for R0.

    """
    G = lambda x, t: F(x, t, R0)
    s_path, e_path, i_path = odeint(G, x_init, t_vec).transpose()

    c_path = 1 - s_path - e_path       # cumulative cases
    return i_path, c_path
t_length = 550
grid_size = 1000
t_vec = np.linspace(0, t_length, grid_size)
R0_vals = np.linspace(1.6, 3.0, 6)
labels = [f'$R0 = {r:.2f}$' for r in R0_vals]
i_paths, c_paths = [], []

for r in R0_vals:
    i_path, c_path = solve_path(r, t_vec)
    i_paths.append(i_path)
    c_paths.append(c_path)
def plot_paths(paths, labels, times=t_vec):

    fig, ax = plt.subplots()

    for path, label in zip(paths, labels):
        ax.plot(times, path, label=label)

    ax.legend(loc='upper left')

    plt.show()
plot_paths(i_paths, labels)
plot_paths(c_paths, labels)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12492736780941313, 'fraction_numerical': 0.024985473561882625, 'mean_word_length': 2.986111111111111, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '619773', 'license': 'MIT', 'n_tokens_mistral': 703, 'n_tokens_neox': 662, 'n_words': 188, 'path': '.ipynb_checkpoints/Epidemic_Test_Code-checkpoint.ipynb', 'repo_name': 'felzek/covid-project', 'size': '1721'}