age_results#
- class age_results(result_args=None, die=False, **kwargs)[source]#
Bases:
Analyzer
Constructs results by age at specified points within the sim. Can be used with data
- Parameters:
result_args (dict) – dict of results to generate and associated years/age-bins to generate each result as well as whether to compute_fit
die (bool) – whether or not to raise an exception if errors are found
kwargs (dict) – passed to
Analyzer
Example:
result_args=sc.objdict( hpv_prevalence=sc.objdict( timepoints=[1990], edges=np.array([0.,20.,25.,30.,40.,45.,50.,55.,65.,100.]), ), hpv_incidence=sc.objdict( timepoints=[1990, 2000], edges=np.array([0.,20.,30.,40.,50.,60.,70.,80.,100.]) ) sim = hpv.Sim(analyzers=hpv.age_results(result_args=result_args)) sim.run() age_results = sim['analyzers'][0]
Methods
- validate_variables(sim)[source]#
Check that the variables in result_args are valid, and initialize the result structure
- convert_rname_stocks(rname)[source]#
Helper function for converting stock result names to people attributes
- convert_rname_flows(rname)[source]#
Helper function for converting flow result names to people attributes
- static reduce(analyzers, use_mean=False, bounds=None, quantiles=None)[source]#
Create an averaged age result from a list of age result analyzers
- plot_single(ax, rkey, date, by_genotype, plot_args=None, scatter_args=None)[source]#
Function to plot a single age result for a single date. Requires an axis as input and will generally be called by a helper function rather than directly.
- plot(fig_args=None, axis_args=None, plot_args=None, scatter_args=None, do_save=None, fig_path=None, do_show=True, fig=None, ax=None, **kwargs)[source]#
Plot the age results
- Parameters:
fig_args (dict) – passed to pl.figure()
axis_args (dict) – passed to pl.subplots_adjust()
plot_args (dict) – passed to plot_single
scatter_args (dict) – passed to plot_single
do_save (bool) – whether to save
fig_path (str or filepath) – filepath to save to
do_show (bool) – whether to show the figure
kwargs (dict) – passed to
hpv.options.with_style()
; see that function for choices