How to use the pysd.py_backend.functions.cache function in pysd

To help you get started, we’ve selected a few pysd examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github SDXorg / test-models / samples / SIR / SIR.py View on Github external
@cache('run')
def initial_time():
    """
    INITIAL TIME

    0

    Day

    (None, None)

    constant

    The initial time for the simulation.
    """
    return 0
github SDXorg / test-models / samples / SIR / SIR.py View on Github external
@cache('run')
def total_population():
    """
    Total Population

    1000

    Persons

    (None, None)

    constant

    This is just a simplification to make it easer to track how many folks 
        there are without having to sum up all the stocks.
    """
    return 1000
github SDXorg / test-models / samples / SIR / SIR.py View on Github external
@cache('step')
def succumbing():
    """
    Succumbing

    Susceptible*Infectious/Total Population * Contact Infectivity

    Persons/Day

    (None, None)

    component


    """
    return susceptible() * infectious() / total_population() * contact_infectivity()
github SDXorg / test-models / samples / SIR / SIR.py View on Github external
@cache('run')
def time_step():
    """
    TIME STEP

    0.03125

    Day

    (0.0, None)

    constant

    The time step for the simulation.
    """
    return 0.03125
github SDXorg / test-models / samples / SIR / SIR.py View on Github external
@cache('step')
def recovered():
    """
    Recovered

    INTEG ( Recovering, 0)

    Persons

    (None, None)

    component

    These people have recovered from the disease. Yay! Nobody dies in this 
        model.
    """
    return integ_recovered()
github SDXorg / test-models / samples / SIR / SIR.py View on Github external
@cache('run')
def duration():
    """
    Duration

    5

    Days

    (None, None)

    constant

    How long are you infectious for?
    """
    return 5
github SDXorg / test-models / samples / SIR / SIR.py View on Github external
@cache('step')
def susceptible():
    """
    Susceptible

    INTEG ( -Succumbing, Total Population)

    Persons

    (None, None)

    component

    The population that has not yet been infected.
    """
    return integ_susceptible()
github SDXorg / test-models / samples / SIR / SIR.py View on Github external
@cache('run')
def contact_infectivity():
    """
    Contact Infectivity

    0.3

    Persons/Persons/Day

    (None, None)

    constant

    A joint parameter listing both how many people you contact, and how likely 
        you are to give them the disease.
    """
    return 0.3
github SDXorg / test-models / samples / SIR / SIR.py View on Github external
@cache('step')
def recovering():
    """
    Recovering

    Infectious/Duration

    Persons/Day

    (None, None)

    component


    """
    return infectious() / duration()
github SDXorg / test-models / samples / SIR / SIR.py View on Github external
@cache('step')
def infectious():
    """
    Infectious

    INTEG ( Succumbing-Recovering, 5)

    Persons

    (None, None)

    component

    The population with the disease, manifesting symptoms, and able to 
        transmit it to other people.
    """
    return integ_infectious()