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.

Attributes

auto_state_list

List of "automatic" states with boolean type (ss.BoolState) that were added via define_states()

dt

Get the current module timestep

now

Shortcut to self.t.now()

state_dict

Return a flat dictionary (objdict) of all states

state_list

Return a flat list of all states (ss.Arr objects)

ti

Get the current module timestep

timevec

Shortcut to self.t.timevec

Methods

init_pre(sim, force=False)[source]#

Initializes bins and data with proper shapes.

step()[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