synthpops.api module

This module provides the layer for communicating with the agent-based model Covasim.

synthpops.api.make_population(n=None, max_contacts=None, generate=None, with_industry_code=False, with_facilities=False, use_two_group_reduction=True, average_LTCF_degree=20, ltcf_staff_age_min=20, ltcf_staff_age_max=60, with_school_types=False, school_mixing_type='random', average_class_size=20, inter_grade_mixing=0.1, average_student_teacher_ratio=20, average_teacher_teacher_degree=3, teacher_age_min=25, teacher_age_max=75, with_non_teaching_staff=False, average_student_all_staff_ratio=15, average_additional_staff_degree=20, staff_age_min=20, staff_age_max=75, rand_seed=None)

Make a full population network including both people (ages, sexes) and contacts using Seattle, Washington cached data. :param n: The number of people to create. :type n: int :param max_contacts: A dictionary for maximum number of contacts per layer: keys must be “W” (work). :type max_contacts: dict :param generate: If True, generate a new population. Else, look for cached population and if those are not available, generate a new population. :type generate: bool :param with_industry_code: If True, assign industry codes for workplaces, currently only possible for cached files of populations in the US. :type with_industry_code: bool :param with_facilities: If True, create long term care facilities, currently only available for locations in the US. :type with_facilities: bool :param use_two_group_reduction: If True, create long term care facilities with reduced contacts across both groups. :type use_two_group_reduction: bool :param average_LTCF_degree: default average degree in long term care facilities. :type average_LTCF_degree: float :param ltcf_staff_age_min: Long term care facility staff minimum age. :type ltcf_staff_age_min: int :param ltcf_staff_age_max: Long term care facility staff maximum age. :type ltcf_staff_age_max: int :param with_school_types: If True, creates explicit school types. :type with_school_types: bool :param school_mixing_type: The mixing type for schools, ‘random’, ‘age_clustered’, or ‘age_and_class_clustered’ if string, and a dictionary of these by school type otherwise. :type school_mixing_type: str or dict :param average_class_size: The average classroom size. :type average_class_size: float :param inter_grade_mixing: The average fraction of mixing between grades in the same school for clustered school mixing types. :type inter_grade_mixing: float :param average_student_teacher_ratio: The average number of students per teacher. :type average_student_teacher_ratio: float :param average_teacher_teacher_degree: The average number of contacts per teacher with other teachers. :type average_teacher_teacher_degree: float :param teacher_age_min: The minimum age for teachers. :type teacher_age_min: int :param teacher_age_max: The maximum age for teachers. :type teacher_age_max: int :param with_non_teaching_staff: If True, includes non teaching staff. :type with_non_teaching_staff: bool :param average_student_all_staff_ratio: The average number of students per staff members at school (including both teachers and non teachers). :type average_student_all_staff_ratio: float :param average_additional_staff_degree: The average number of contacts per additional non teaching staff in schools. :type average_additional_staff_degree: float :param staff_age_min: The minimum age for non teaching staff. :type staff_age_min: int :param staff_age_max: The maximum age for non teaching staff. :type staff_age_max: int :param rand_seed: Start point random sequence is generated from. :type rand_seed: int

Returns

A dictionary of the full population with ages and connections.

Return type

network (dict)