Skip to content

Population Object

Info

Population object is implemented on population.py.

The population object handles any information/process related exclusively to particles. In particular, it has a function, called update_states, that handles the infection state transition of particles. Furthermore, it stores several particle exclusive information related to the disease, which we highlight the following:

  • inf_source: an array with particle ids for every particle. The particle ids stored are those of the source of infection, when the particle gets infected. For example, if the entry i of inf_source has the id j, then it means that the particle whose id is j infected particle whose id is i. When the particle i never gets infected, then the i-th entry of inf_source has the value -1.
  • inf_vector_sympt: an array with the symptomatic state of the infection source at the moment of infection. For example, if the particle i got infected by particle id j, and particle j had soft symptoms, then entry i of inf_vector_sympt has the value SYMPT_YES. When the particle i never gets infected, then the i-th entry of inf_vector_sympt has the value NO_INFEC.
  • inf_placement: an array with the placement of a particle at the moment of its infection. For example, if the particle i got infected at some market, then entry i of inf_placement has the value PLC_MRKT. When the particle i never gets infected, then the i-th entry of inf_placement has the value NO_INFEC.
  • time_exposed: an array with the time of infection of the particles. For example, if the particle i got infected by particle id j at time k, then entry i of inf_time has the value k. The number k will always be an integer multiple of resolution_t. When the particle i never gets infected, then the i-th entry of time_exposed has the value NO_INFEC.
  • time_infectious: an array with the time that an infected particle becomes infectious. For example, if the particle i got infectious at time k, then entry i of time_infectious has the value k. The number k will always be an integer multiple of resolution_t. When the particle i never gets infected, then the entry i of time_infectious has the value NO_INFEC.
  • time_recovered: an array with the time that an infected particle got recovered. For example, if the particle i got recovered at time k, then entry i of time_recovered has the value k. The number k will always be an integer multiple of resolution_t. When the particle i never gets infected, then the entry i of time_recovered has the value NO_INFEC.

These arrays have entries which are particle dependent. There are also some useful arrays being stored, which are population-dependent:

  • susceptible: an array of floats for the total number of susceptible particles in each time step of the simulation.
  • exposed: an array of floats for the total number of exposed (infected but not infectious) particles in each time step of the simulation.
  • infectious: an array of floats for the total number of infectious particles in each time step of the simulation.
  • recovered: an array of floats for the total number of recovered particles in each time step of the simulation.
  • encounters: and array of integers for the total encounters in the population, per time step.
  • encounters_infectious: similar to the data in encounters. However, now the encounters are considered only if one of the particles is infectious.
  • possible_infections: similar to the data in encounters. However, now the encounters are considered only if one particle is susceptible and the other is infectious.

Another information useful for post-processing of the population is the set of time series data. This data stores dynamic information, which may change every time step. Below is a description of the arrays in that form:

  • states: an array of keys for the infection state of every particle in each time step of the simulation. In the first dimension we have indices for the time steps, and in the second dimension we have indices for the particles. The data in each time step-particle index is given by one of the following infection states: STATE_S (susceptible), STATE_E (exposed), STATE_I (infected) and STATE_R (recovered). ADD STATE_D for next release The values for these and several other key values are stored in settings.py file.
  • symptoms: an array of keys for the symptomatic state of every particle in each time step of the simulation. In the first dimension we have indices for the time steps, and in the second dimension we have indices for the particles. The data in each time step-particle index is given by one of the following symptomatic states: SYMPT_NO (asymptomatic), SYMPT_NYET (not yet symptomatic, though it may become at some point), SYMPT_YES (soft symptomatic) and SYMPT_SEVERE (severely symptomatic). The values for these and several other key values are stored in settings.py file.
  • spreads: a time series of how many other particles each particle infected.
  • placement_time_series: this time series is assembled by copying inf_placement every time step.

The are also two data types that are close to time series, but that are not stored as arrays, but as lists of dictionaries. These lists are explained below:

  • tracing: a list of dictionaries for each time step. These dictionaries have as keys the particle ids that had encounters and as values the particle ids that had encountered that specific particle. For example, if the particle i encountered particles j, k and l at step t, then tracing[t][i] will have as data the array [j, k, l]. A particle encounters another particle whenever their relative euclidean distance is lesser than inf_radii.
  • tracing_infectious: similar to tracing. However, now the contacts are considered only if one of the particles is infectious.

Finally, regarding data, we have the dynamic arrays that are overwritten every time step. These arrays are constantly used to maintain the status of positioning and activity of the community along time. We now discuss these arrays:

  • placement: an array of keys used to specify at what kind of place a particle should be at a time step. Placement is a key value that informs a geographic location, and it can be one of the following: PLC_HOME (particle's home), PLC_STRT (not a service or home), PLC_MRKT (market), PLC_HOSP (hospital), PLC_SCHL (school), PLC_REST (restaurant), PLC_NEWORK (non-essential work place). This key value is used to move particles to specific locations in the city. The function placement_move is used for that purpose.
  • activity: an array of keys used to specify what kind of activity a particle develops in a certain place, at a time step. Activity is a key value used mostly to differentiate between a particle working at a service and a particle visiting a certain service, and it can be one of the following: ACT_FREE (particle does not have a role), ACT_WORK (particle is working at the service) and ACT_VISIT (particle is visiting a service). For more details about workers, visitors and guests in a service, see the section bout the Service object.