Пример #1
0
import tacoma as tc
import numpy as np
import matplotlib.pyplot as pl
import GillEpi
import networkx as nx
import time

N = 20
compl = tc.complete_graph(N)
G = nx.complete_graph(N)

R0s = np.logspace(1.0, 2.0, 5)

k = N - 1.0
rho = 1.0
I0 = N // 2

N_meas = 100
Rs = np.zeros((len(R0s), N_meas))
R_gillepi_s = np.zeros((len(R0s), N_meas))
R_s = np.zeros((len(R0s), N_meas))

fig, ax = pl.subplots(4, 3, figsize=(18, 14))
ax = ax.flatten()

for iR0, R0 in enumerate(R0s):

    for meas in range(N_meas):
        eta = R0 * rho / k

        start1 = time.time()
Пример #2
0
import tacoma as tc
import pdb
from tacoma.epidemics import simulate_quasi_stationary_SIS_on_static_network

N = 100
R0 = 1.1
rho = 1.0
eta = rho * R0 / (N - 1.0)

tmax = 100000

M = 100

G = tc.complete_graph(N, tmax=tmax)

QS = tc.QS_SIS(
    N,
    tmax,
    eta,
    rho,
    M,
    sampling_rate=2 * rho,
    number_of_initially_infected=N,
    sample_network_state=False,
)

I, I2 = simulate_quasi_stationary_SIS_on_static_network(G, QS, verbose=False)

#pdb.set_trace()

print(I, I2)