age_pyramids#

class age_pyramids(bins=None)[source]#

Bases: Analyzer

Records age pyramids for each timestep.

self.bins#

A list of ages, default is a sequence from 0 to max_age + 1.

self.data#

A matrix of shape (number of timesteps, number of bins - 1) containing age pyramid data.

Methods

initialize(sim)[source]#

Initializes bins and data with proper shapes

apply(sim)[source]#

Records histogram of ages of all alive individuals at a timestep such that self.data[timestep] = list of proportions where index signifies age

plot()[source]#

Plots self.data as 2D pyramid plot

plot3d()[source]#

Plots self.data as 3D pyramid plot