starling_sim.basemodel.population.dict_population
Module Contents
Classes
Stores the agent populations of the simulation in Python dictionaries |
- class starling_sim.basemodel.population.dict_population.DictPopulation(population_names)
Bases:
starling_sim.basemodel.population.agent_population.AgentPopulation
Stores the agent populations of the simulation in Python dictionaries Theses dicts are stored in a global dict
- get_total_population()
Give access to the total population of the simulation
- Returns:
list of Agent objects
- get_agent(agent_id, agent_population=None)
Get the agent corresponding to the given id.
The agent population may be provided, or it can be left to None if it is unknown.
- Parameters:
agent_id – id of the agent
agent_population – population of the agent, None if unknown
- Returns:
agent
- new_population(population_name)
Return a population with the given name.
If the population does not exist, it is created.
- Parameters:
population_name – str
- Returns:
population associated to the given name
- new_agent_in(agent, population_names)
Add the agent to the given population(s)
- Parameters:
agent – Agent object
population_names – list or str corresponding to population names
- __getitem__(item)
Method called when using agentPopulation[item] :param item: name of the population accessed :return: self.population[item]
- __setitem__(key, value)
Method called when using agentPopulation[key] = value :param key: name of the population accessed :param value: population dict :return: