Exemplo n.º 1
0
# load code / config
import os,sys;
sys.path.append(os.path.join((lambda r,f:f[0:f.index(r)+len(r)])('code',os.path.abspath(__file__)),'config'));
import config
config.epimodel()
config.numpy()
config.plot()
# external module
import re
import numpy as np
import matplotlib.pyplot as plt
from copy import deepcopy
# epi-model modules
import utils
import modelutils
from space import Space,Array
from elements import Color
# relative imports
import system
import sensitivity

names = ['S','I','T']
# names = ['S','infected']
lights = [0.6,0.0,0.3]
out = 'X'
n = 1

def make_pie(sim,select,phi):
  plt.figure(figsize=(2,2))
  selectors = [
    sim.model.select[name].union(sim.model.select[select])
Exemplo n.º 2
0
import os, sys
sys.path.append(
    os.path.join(
        (lambda r, f: f[0:f.index(r) + len(r)])('code',
                                                os.path.abspath(__file__)),
        'config'))
import config
import numpy as np
config.epimodel()
config.plot(tex=True)
import matplotlib.pyplot as plt
from collections import OrderedDict as odict
import modelutils
import elements
import system


def iterdur(min, max, N):
    for i in np.logspace(np.log10(min), np.log10(max), N)[::-1]:
        yield i


def get_sim(type, output, dh=None):
    model = system.get_model()
    if type == 'h**o':
        model.collapse(['ii', 'ip'])
        name = '$G = 1$ (Homogeneous)'
        dt = 0.2
    if type == 'zeta':
        dhmax = 1.0 / model.params['mu']
        model.params['dur'].update(