Base classes for loading parameters and for running simulations with FP model
- class fpsim.base.ParsObj(pars, **kwargs)¶
A class based around performing operations on a self.pars dict.
- class fpsim.base.BasePeople¶
Class for all the people in the simulation.
Returns keys for all properties of the people object
- property is_female¶
Boolean array of everyone female
- property is_male¶
Boolean array of everyone male
- property int_age¶
Return ages as an integer
- property ceil_age¶
Rounds age up to the next highest integer
- property int_age_clip¶
Return ages as integers, clipped to maximum allowable age for pregnancy
- property n¶
Number of people alive
- property inds¶
Alias to self._inds to prevent accidental overwrite & increase speed
- property len_inds¶
Alias to len(self)
- property len_people¶
Full length of People array, ignoring filtering
- plot(fig_args=None, hist_args=None)¶
Plot histograms of each quantity
- filter(criteria=None, inds=None)¶
Store indices to allow for easy filtering of the People object.
criteria (array) – a boolean array for the filtering critria
inds (array) – alternatively, explicitly filter by these indices
A filtered People object, which works just like a normal People object except only operates on a subset of indices.
An easy way of unfiltering the People object, returning the original.
- binomial(prob, as_inds=False, as_filter=False)¶
Return indices either by a single probability or by an array of probabilities. By default just return the boolean array, but can also return the indices, or the filtered People object.
- class fpsim.base.BaseSim(pars, **kwargs)¶
The BaseSim class handles the dynamics of the simulation.
- property npts¶
Count the number of points in timesteps between the starting year and the ending year.
- property tvec¶
Create a time vector array at intervals of the timestep in years
- property n¶