bucky.model.graph

Class to read and store all the data from the bucky input graph.

Module Contents

Classes

buckyGraphData

Contains and preprocesses all the data imported from an input graph file.

Functions

_read_node_attr(G, name, diff=False, dtype=xp.float32, a_min=None, a_max=None)

Read an attribute from every node into a cupy/numpy array and optionally clip and/or diff it.

cached_scatter_add(a, slices, value)

scatter_add() thats cached by joblib.

Attributes

memory

bucky.model.graph.memory[source]
class bucky.model.graph.buckyGraphData(G, spline_smooth=True, force_diag_Aij=False)[source]

Contains and preprocesses all the data imported from an input graph file.

N(self)[source]

Total population.

Nj(self)[source]

Total population per adm2.

Notes

\[N_j = \sum_i N_{ij}\]
Return type

numpy.ndarray or cupy.ndarray if using CuPy

adm0_Ni(self)[source]

Age stratified adm0 population.

adm0_cum_case_hist(self)[source]

Cumulative cases at adm0.

adm0_cum_death_hist(self)[source]

Cumulative deaths at adm0.

adm0_inc_case_hist(self)[source]

Incident cases at adm0.

adm0_inc_death_hist(self)[source]

Incident deaths at adm0.

adm1_Nij(self)[source]

Age stratified adm1 populations.

adm1_Nj(self)[source]

Total adm1 populations.

adm1_cum_case_hist(self)[source]

Cumulative cases by adm1.

adm1_cum_death_hist(self)[source]

Cumulative deaths by adm1.

adm1_inc_case_hist(self)[source]

Incident cases by adm1.

adm1_inc_death_hist(self)[source]

Incident deaths by adm1.

static clean_historical_data(cum_case_hist, cum_death_hist, inc_hosp, start_date, g_data, force_save_plots=False)[source]

Preprocess the historical data to smooth it and remove outliers.

rolling_adm1_curr_hosp(self)[source]

Return the rolling mean of cumulative deaths.

rolling_adm1_inc_hosp(self)[source]

Return the rolling mean of cumulative deaths.

rolling_cum_cases(self)[source]

Return the rolling mean of cumulative cases.

rolling_cum_deaths(self)[source]

Return the rolling mean of cumulative deaths.

rolling_inc_cases(self)[source]

Return the rolling mean of incident cases.

rolling_inc_deaths(self)[source]

Return the rolling mean of incident deaths.

sum_adm1(self, adm2_arr, mask=None, cache=False)[source]

Return the adm1 sum of a variable defined at the adm2 level using the mapping on the graph.

bucky.model.graph._read_node_attr(G, name, diff=False, dtype=xp.float32, a_min=None, a_max=None)[source]

Read an attribute from every node into a cupy/numpy array and optionally clip and/or diff it.

bucky.model.graph.cached_scatter_add(a, slices, value)[source]

scatter_add() thats cached by joblib.