How to use the indra.prop_args2.PropArgs.create_props function in indra

To help you get started, we’ve selected a few indra 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 gcallah / indras_net / models / forestfire_run.py View on Github external
#!/usr/bin/env python3
"""
This file runs the forestfire_model.
"""
MODEL_NM = "forestfire"

import indra.prop_args2 as props
pa = props.PropArgs.create_props(MODEL_NM)

import indra.utils as utils
import models.forestfire as fm
import os

# set up some file names:


def run(prop_dict=None):
    (prog_file, log_file, prop_file, results_file) = utils.gen_file_names(MODEL_NM)
    
    global pa

    if pa["user_type"] == props.WEB:
        pa["base_dir"] = os.environ["base_dir"]
github gcallah / indras_net / models / hiv_run.py View on Github external
def run(prop_dict=None):
    pa = props.PropArgs.create_props(MODEL_NM, prop_dict)
    import indra.utils as utils
    import models.hiv as hiv
    (prog_file, log_file, prop_file,
     results_file) = utils.gen_file_names(MODEL_NM)

    grid_x = pa["grid_width"]
    grid_y = pa["grid_height"]
    ini_ppl = pa["ini_ppl"]
    avg_coup_tend = pa["avg_coup_tend"]
    avg_test_freq = pa["avg_test_freq"]
    avg_commitment = pa["avg_commitment"]
    avg_condom_use = pa["avg_condom_use"]

    max_ppl = grid_x * grid_y

    if ini_ppl > max_ppl:
github gcallah / indras_net / models / fmarket_run.py View on Github external
def run(prop_dict=None):
    pa = props.PropArgs.create_props(MODEL_NM, prop_dict)
    import indra.utils as utils
    import models.fmarket as fm

    (prog_file, log_file, prop_file, results_file) = utils.gen_file_names(MODEL_NM)
    
    # Now we create a asset environment for our agents to act within:
    env = fm.FinMarket("Financial Market",
                       pa["grid_height"],
                       pa["grid_width"],
                       torus=False,
                       model_nm=MODEL_NM,
                       props=pa)
    
    # Now we loop creating multiple agents with numbered names
    # based on the loop variable:
    for i in range(pa["num_followers"]):
github gcallah / indras_net / models / grid_run.py View on Github external
def run(prop_dict=None):
    pa = props.PropArgs.create_props(MODEL_NM, prop_dict)

    import indra.utils as utils
    import indra.grid_env as ge
    import models.grid as gm
    (prog_file, log_file, prop_file, results_file) = utils.gen_file_names(MODEL_NM)

    if pa["user_type"] == props.WEB:
        pa["base_dir"] = os.environ["base_dir"]

    # Now we create a minimal environment for our agents to act within:
    env = ge.GridEnv("Test grid env",
                     pa["grid_width"],
                     pa["grid_height"],
                     torus=False,
                     model_nm=MODEL_NM,
                     preact=True,
github gcallah / indras_net / bigbox / bigbox_run.py View on Github external
#!/usr/bin/env python3
"""
A script that runs big_box_model. It simulates the market economy
of consumers, mom and pops, and big boxes.
"""
MODEL_NM = "bigbox"

import indra.prop_args2 as props

# we will create props here to set user_type:
pa = props.PropArgs.create_props(MODEL_NM)

import indra.utils as utils
import bigbox as bb

# set up some file names:


def run(prop_dict=None):
    (prog_file, log_file, prop_file, results_file) = utils.gen_file_names(MODEL_NM)
    # We store basic parameters in a "property" file; this allows us to save
    #  multiple parameter sets, which is important in simulation work.
    #  We can read these in from file or set them here.
    global pa

    # We create a town for our agents to act in:
    env = bb.EverytownUSA(pa["grid_width"],
github gcallah / indras_net / models / basic_run.py View on Github external
def run(prop_dict=None):
    # We need to create props before we import the basic model,
    # as our choice of display_method is dependent on the user_type.

    pa = props.PropArgs.create_props(MODEL_NM, prop_dict)

    import models.basic as bm
    import indra.utils as utils
    (prog_file, log_file, prop_file,
     results_file) = utils.gen_file_names(MODEL_NM)

    # test prop_args as an iterable:
    for prop, val in pa.items():
        print(prop + ": " + str(val))

    # test that props work as a dictionary:
    if "num_agents" in pa:
        print("In is working!")

    # test what pa["num_agents"] is:
    num_agents = pa["num_agents"]
github gcallah / indras_net / models / zombie_run.py View on Github external
#!/usr/bin/env python3
"""
A basic zombie model
"""
import indra.prop_args2 as props
import indra.utils as utils
import models.zombie as zom

MODEL_NM = "zombie"
pa = props.PropArgs.create_props(MODEL_NM)

def run(prop_dict=None):
    (prog_file, log_file, prop_file, results_file) = utils.gen_file_names(MODEL_NM)

    global pa

    # we create an Infected Zone for our agents to act within:
    env = zom.Zone("Infected Zone",
                   pa["grid_width"],
                   pa["grid_height"],
                   model_nm=MODEL_NM,
                   preact=True,
                   postact=True,
                   props=pa)
    # Now we loop creating multiple agents with numbered names
    # based on the number of agents of that type to create:
github gcallah / indras_net / schelling / auditorium_run.py View on Github external
#!/usr/bin/env python3
"""
Set up and run the auditorium model.
"""
MODEL_NM = "auditorium"

import indra.prop_args2 as props
pa = props.PropArgs.create_props(MODEL_NM)

import indra.utils as utils
import schelling.auditorium as am

# set up some file names:


def run(prop_dict=None):
    (prog_file, log_file, 
     prop_file, results_file) = utils.gen_file_names(MODEL_NM)
    
    global pa

    # Now we create an environment for our agents to act within:
    env = am.Auditorium("Auditorium",
                        height=pa["grid_height"],
github gcallah / indras_net / models / politicalSine_run.py View on Github external
def run(prop_dict=None):
    # We need to create props before we import the model,
    # as our choice of display_method is dependent on the user_type.
    pa = props.PropArgs.create_props(MODEL_NM, prop_dict)
    import models.politicalSine as ps
    import indra.utils as utils

    (prog_file, log_file, prop_file, results_file) = utils.gen_file_names(MODEL_NM)
    '''
    # test prop_args as an iterable:
    for prop, val in pa.items():
        print(prop + ": " + str(val))

    # test that props work as a dictionary:
    if "num_agents" in pa:
        print("In is working!")

    # test what pa["num_agents"] is:
    num_agents = pa["num_agents"]
    print("num_agents = " + str(num_agents))