The Person and Population classes.
- class Population(sim, initial_size: int, append_size: Optional[int] = None)[source]¶
A complete population of individuals.
Useful properties of a population:
The Simulation instance controlling this population.
A pandas DataFrame with the properties of all individuals as columns.
Create a new person within the population.
TODO: This will over-allocate capacity in the population dataframe for efficiency.
id of the new person
- make_test_property(name, type_)[source]¶
Create a new property for test purposes.
When testing a particular method in isolation, it’s helpful to be able to define the properties it reads that would normally be provided by other methods. That is what this is for. It adds an extra column into the property DataFrame for this population, set up with the appropriate type.
This should only be used in tests, not in your actual module code!
name – the name of the property to add
type – a member of the
Typesenumeration giving the type of the property