First we import all necessary files.
In [ ]:
import sys
from random import randint
from models.bacteria import set_up
We then initialize global variables.
In [ ]:
from indra.agent import Agent
from indra.composite import Composite
from indra.display_methods import BLUE, GREEN, RED
from indra.env import Env
from indra.registry import get_env, get_group, get_prop
from indra.space import DEF_HEIGHT, DEF_WIDTH, distance
from indra.utils import init_props
MODEL_NAME = "bacteria"
DEBUG = False # turns debugging code on or off
DEBUG2 = False # turns deeper debugging code on or off
TOXINS = "Toxins"
NUTRIENTS = "Nutrients"
DEF_NUM_BACT = 1
NUM_TOXINS = 1
DEF_NUM_NUTRIENTS = 1
DEF_THRESHOLD = -0.2
DEF_TOXIN_MOVE = 1
DEF_BACTERIUM_MOVE = 3
DEF_NUTRIENT_MOVE = 2
Next we call the set_up
function to set up the environment, groups, and agents of the model.
In [ ]:
set_up()
You can run the model N periods by typing the number you want in the following function and then running it.
In [ ]:
Env("Petrie dish",
.runN()
You can view the position of all of the agents in space with the following command:
In [ ]:
Env("Petrie dish",
.scatter_graph()
You can view the line graph through the following command:
In [ ]:
Env("Petrie dish",
.line_graph()