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 entryi
ofinf_source
has the id j, then it means that the particle whose id is j infected particle whose id isi
. When the particlei
never gets infected, then the i-th entry ofinf_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 particlei
got infected by particle id j, and particle j had soft symptoms, then entryi
ofinf_vector_sympt
has the valueSYMPT_YES
. When the particlei
never gets infected, then the i-th entry ofinf_vector_sympt
has the valueNO_INFEC
.inf_placement
: an array with the placement of a particle at the moment of its infection. For example, if the particlei
got infected at some market, then entryi
ofinf_placement
has the valuePLC_MRKT
. When the particlei
never gets infected, then the i-th entry ofinf_placement
has the valueNO_INFEC
.time_exposed
: an array with the time of infection of the particles. For example, if the particlei
got infected by particle id j at timek
, then entryi
ofinf_time
has the valuek
. The numberk
will always be an integer multiple ofresolution_t
. When the particlei
never gets infected, then the i-th entry oftime_exposed
has the valueNO_INFEC
.time_infectious
: an array with the time that an infected particle becomes infectious. For example, if the particlei
got infectious at timek
, then entryi
oftime_infectious
has the valuek
. The numberk
will always be an integer multiple ofresolution_t
. When the particlei
never gets infected, then the entryi
oftime_infectious
has the valueNO_INFEC
.time_recovered
: an array with the time that an infected particle got recovered. For example, if the particlei
got recovered at timek
, then entryi
oftime_recovered
has the valuek
. The numberk
will always be an integer multiple ofresolution_t
. When the particlei
never gets infected, then the entryi
oftime_recovered
has the valueNO_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 inencounters
. However, now the encounters are considered only if one of the particles is infectious.possible_infections
: similar to the data inencounters
. 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) andSTATE_R
(recovered). ADD STATE_D for next release The values for these and several other key values are stored insettings.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) andSYMPT_SEVERE
(severely symptomatic). The values for these and several other key values are stored insettings.py
file.spreads
: a time series of how many other particles each particle infected.placement_time_series
: this time series is assembled by copyinginf_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 particlei
encountered particlesj
,k
andl
at stept
, thentracing[t][i]
will have as data the array[j, k, l]
. A particle encounters another particle whenever their relative euclidean distance is lesser thaninf_radii
.tracing_infectious
: similar totracing
. 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 functionplacement_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) andACT_VISIT
(particle is visiting a service). For more details about workers, visitors and guests in a service, see the section bout theService
object.