get_asymmetric_matrix#

get_asymmetric_matrix(symmetric_matrix, aggregate_ages)[source]#

Get the contact matrix for the average individual in each age bracket.

Parameters:
  • symmetric_matrix (np.ndarray) – A symmetric age contact matrix.

  • aggregate_ages (dict) – A dictionary mapping single year ages to age brackets.

Returns:

A contact matrix (np.ndarray) whose elements M_ij describe the contact frequency for the average individual in age bracket i with all possible contacts in age bracket j.

Example

age_brackets = sp.get_census_age_brackets(sp.datadir,state_location='Washington',country_location='usa')
age_by_brackets = sp.get_age_by_brackets(age_brackets)

aggregate_age_count = sp.get_aggregate_ages(age_count, age_by_brackets)
aggregate_matrix = symmetric_matrix.copy()
aggregate_matrix = sp.get_aggregate_matrix(aggregate_matrix, age_by_brackets)

asymmetric_matrix = sp.get_asymmetric_matrix(aggregate_matrix, aggregate_age_count)