Пример #1
0
from lmfit import minimize, Parameters
import json
from tqdm import tqdm
from bfmplot import pl
from bfmplot import brewer_qualitative, simple_cycler, markers
from SIRX import SIRXConfirmedModel
import pickle

from matplotlib.dates import (DAILY, DateFormatter, rrulewrapper, RRuleLocator)

import bfmplot as bp

import matplotlib.pyplot as mpl
mpl.rcParams['font.size'] = 11

model = SIRXConfirmedModel()

colors = simple_cycler(brewer_qualitative)


class REPL(dict):
    def __init__(self, items):
        self.items = items

    def __getitem__(self, i):
        try:
            return self.items[i]
        except KeyError as e:
            return i

Пример #2
0
import pickle

import sys

sys.path.insert(0, '..')
from SIRX import SIRXConfirmedModel

model = SIRXConfirmedModel()

import numpy as np
import simplejson as json
from tabulate import tabulate
import numpy
from bfmplot import pl
from scipy.special import erf


def mu(alpha, beta, kappa, kappa0):
    R0 = alpha / (beta + kappa + kappa0)
    #    print(np.log(R0))
    #    return ( numpy.e )**( -1/2 * ( R0 )**( -1/2 ) * ( alpha )**( -1 ) * ( \
    #kappa0 )**( -1 ) * ( ( alpha + -1 * ( R0 )**( 1/2 ) * ( beta + ( \
    #kappa + kappa0 ) ) ) )**( 2 ) ) * ( 2 * numpy.pi )**( -1/2 ) * ( R0 \
    #)**( -1/4 ) * ( alpha )**( 1/2 ) * ( kappa0 )**( -1/2 ) * ( ( \
    #erf( ( 2 )**( -1/2 ) * ( R0 )**( -1/4 ) * ( alpha )**( -1/2 ) * \
    #( kappa0 )**( -1/2 ) * ( -1 * alpha + ( R0 )**( 1/2 ) * ( beta + ( \
    #kappa + kappa0 ) ) ) ) + -1 * erf( 1/2 * ( 2 )**( -1/2 ) * ( R0 \
    #)**( -1/4 ) * ( alpha )**( -1/2 ) * ( kappa0 )**( -1/2 ) * ( -2 * \
    #alpha + ( 2 * ( R0 )**( 1/2 ) * ( beta + ( kappa + kappa0 ) ) + -1 * \
    #alpha * numpy.log( R0 ) ) ) ) ) )**( -1 ) * numpy.log( R0 )