Skip to content

All Parameters

An exhaustive list with all parameters that can be set using the dictionary for the community initialization.

age_assignment_order

Order to assign ages to population, if a population graph is loaded this will be ignored.

allow_apartment_buildings

A boolean value for alowing or not particles to have a nonzero third dimension for the floor of a building. Default: False.

city_name

A string for the name of the city. This value is used for output purposes only. Default: "default".

decision

Decision process used to close/reopen services and start/stop lockdowns. Default: decisions.BY_DIAGNOSTICS.

Sealso

See Decision Process

deterministic_placement

A boolean value that places all services near each other in the center of the community's urban area. Default: False.

diagnostics

List with the ordered dictionaries of parameters for diagnostics policies to be used during the simulation. Default: [diagnostics.SEROLOGICAL]

Predefined diagnostics
diagnostics.SEROLOGICAL

All symptomatic particles be tested with sensitivity of 86%.

SEROLOGICAL = {
    "name": "Serological",
    "sensitivity": 0.86,
    "specificity": 0.90,
}
diagnostics.PCR

All symptomatic particles be tested with sensitivity of 90% and a 2 days delay for results.

PCR = {
    "name": "PCR",
    "result_delay": 2.0,
    "sensitivity": 0.90,
    "specificity": 1.0,
}
Custom diagnostic parameters

Parameters:

Name Type Description Default
name string

Name of the diagnostic.

required
filter_particles tuple

A sequence of nested tuples of strings and values to be evaluated to select particles to apply diagnostic, strings can be population attributes (see particles states attributes), comparative operators, binary operators or makers (see markers bellow). Examples:

  • ("symptoms", "==", SYMPT_YES) equivalent as population.symptoms == SYMPT_YES
  • ((("symptoms", "==", SYMPT_YES), "|", ("symptoms", "==", SYMPT_SEVERE)), "&", ("states", "==", STATE_I)) is equivalent as ((population.symptoms == SYMPT_YES) | (population.symptoms == SYMPT_SEVERE)) & (population.states == STATE_I)

Available markers for filter_particles:

  • ("tracing", trace_filters, number_of_days) will select all particles that had tracable contact with particles selected by trace_filters in the last number_of_days days.
  • ("service", service_name) will be replaced with the id of the service with service_name.
  • ("workers", service_name, workers_name) will be replaced with the id of the workers with workers_name type on service with service_name.

ATTENTION: Do NOT use python's normal boolean operators (and, or, not, etc), all operations are applied on numpy boolean arrays and the apropriate operators to use are binary operators (&, |, ~, etc).

'`("symptoms", "==", SYMPT_YES), "|", ("symptoms", "==", SYMPT_SEVERE)`'
number_per_day int

Number of tests to be applied in the selected population, particles selected with filter_particles will be selected ramdomly to test if there isn't enough tests. If set to -1 will test all particles selected with filter_particles.

'-1'
sensitifity float

Sensitivity value for the test in the [0., 1.] interval.

'0.85'
specificity float

Specificity value for the test in the [0., 1.] interval.

'0.96'
test_delay float

Time in days between a particle is selected to be tested and the test is made.

'0.0'
result_delay float

Time in days between a particle is tested and the result is available.

'0.0'
allow_retest str

Allow particles to retest the test, available settings:

  • "yes": All particles can retest.
  • "no": retests are not allowed.
  • "negative": Particles with negative results can retest.
'"no"'
retest_delay float

Time since last result for a particle to be alloed retest.

'2.0'
start_day int

Days from the start of the simulation to start using this diagnostic.

'0'
end_day int

Days from the start of the simulation to stop using this diagnostic. If set to -1 this diagnostic will be used up to the end of the simulation.

'-1'

environment_network

Parameters:

Name Type Description Default
inf_prob_weight float

A float value that multiplies the infection probability for particles at the environment layer, calculated by taking into account the available urban area city_area and the infection radius inf_radii. This value is useful for controlling the definition of contacts in the environment layer.

'1.'
city_area flost

A float for the real urban area of the city. It must be given a value in km^2.

'79.971.'
inf_radii float

A float for the infection radius, in meters. When a susceptible and an infectious particle distance lesser than this measure from each other, then an infection may occur.

'2.'

free_hours

A two-sized list with two integers delimiting the start and end of a productive day. For example, if [7, 22] is provided, then all particles not working at a service remain home from 22:00 to 24:00 and from 00:00 to 07:00, everyday. For any other time in the range of the limits of the list provided, particles are free to act as in their daily routine. Default value: [7., 22.].

home_network

Parameters:

Name Type Description Default
inf_prob_weight float

A float value that multiplies the infection probability for particles at home. This value is useful for controlling the definition of contacts in homes.

'1.'
mean_contacts float

A float for the mean number of contacts that a particle has inside home. This parameter is only used when use_networks is True.

'2.'

homes_inf0_frac

If this is set will intilialize infections giving prioriry to infect particles in the same house, this parameter sets the mean fraction of particles that are initialized infected (this is not exclusive to the state infected, if inf0_perc is set with the percentages in each state the proportion of Exposed, Infectious and Recovered will be used to initialize particles) in the same house.

inf0_perc

A float for the fraction of the population that is exposed to the disease at the start of the simulation. Alternatively, this value can receive a list of fraction values for the population in each of the infection states, in the following order: fraction of susceptible, fraction of exposed, fraction of infectious and fraction of recovered particles. The sum of fractions must sum up to 1, otherwise they are normalized to do so by respecting the proportions in the list's entries. Default: [0.99, 0.01, 0.0, 0.0].

inf0_perc_symp

A list with fractions for the infectious particles in the following three symptomatic states: asymptomatic, soft symptomatic and severe symptomatic, respectively. The value in this keyword is used to initiate the symptomatic states of the infectious particles determined by the inf0_perc keyword's value. The sum of fractions must sum up to 1, otherwise they are normalized to do so by respecting the proportions in the list's entries. Default value for this parameter will follow the probabilities of developing symptoms (see inf_prob_sympt and inf_severe_sympt_prob keywords). [DERIVED PARAMETER]

inf_duration

A float for the mean time, in days, that an infectious particle takes to recover. Default: 5.0.

inf_incubation

A float for the mean time, in days, that an exposed particle takes to become infectious. Default: 3.2.

inf_prob_dist

FILL UP

inf_prob_dist_param

FILL UP

inf_prob_sympt

A float for the probability of an infectious particle ever becoming symptomatic. Default: 0.4.

inf_probability

A float for the probability of an infectious particle infect a susceptible one if they have had a contact of one hour. This probability is internally corrected according to the value provided by resolution_t. Default: 0.016.

inf_severe_death_prob

A float for the probability of an infected particle to die instead of recover, only severe symptomatic particles. Shoud be less than inf_severe_sympt_prob. A list can be passed instead of a value, in which case the entries of the list are applied to each individual age group. Default: 0.

inf_severe_duration

A float for the mean time, in days, that an severe symptomatic particle takes to recover. Default: 0.0 (inf_duration will be used).

inf_severe_sympt_prob

A float for the probability of an infectious particle develop severe symptoms. Shoud be less than inf_prob_sympt. Default: 0.08.

inf_sympt_timeto

A float for the mean time, in days, that an infectious particle take to become symptomatic. Default: 2.0.

infection_probability_correction

A boolean value that activates an experimental mechanic during the night. This mechanic alters inf_prob keyword's value at night, for particles in the same home, so that only one "infectious" encounter is simulated in this period. This means that the probability of an infectious encounter happen during the night, for particles in the same home, is the same probability of an infectious encounter happen during one hour in the day. Default: False.

isol_pct_time_series

An array of floats for the day-dependent fraction of population that follows social isolation. Default: np.full(number_of_days, 0.3).

isol_stay_prob

A float for the probability p that particles already in social isolation in a day remain in social isolation in the next day. The probability that particles not in social isolation follow social isolation is therefore 1-p. Notice that even if p=0, the particles in the first age group are still isolated at home. In fact, it may happen that the actual fraction of the population being isolated is larger than the one provided because of this fact. However, if p<0, then no social isolation measure is applied. Quarantined particles are still isolated at the respective quarantine places. Default: 0.6.

limit_encounters

A boolean value that turns on or off the maximum number of encounters inside a service. Default: False.

lockdown

A boolean value that turns on or off if a lockdown measure in the community. Similar to the services close, a decision must be selected, as well as the parameters that specify this decision. The lockdown works by altering social isolation's proportion of particles staying at home when it is running. Default value False.

lockdown_adhere_percent

A float value for the fraction of the population adhering to the lockdown measure. During lockdown, the fraction of the population effectively being isolated home is given by the maximum value between lockdown_adhere_percent and isol_pct_time_series keyword's value for that day. Default: 0.7.

lockdown_day_series

An array of values for whether must start or end at a given day. The array must have as many rows as the number of days in the simulation, and only one column. An entry equals to 0 means that the lockdown is not happening, while it is active for another entry value. Default: [-1, .., -1]

lockdown_decision_offset

A float for a time period in days. This number is used to delay the decision on whether to start or end the lockdown measure. Default: 3.

log_progress

FILL UP

max_encounters

An integer value that limits the number of contacts in a single time step inside services. Default: 10.

neighborhoods_percentages

A list with the percentage of the population in each neighborhood. Default: [0].

number_of_days

An integer for the number of days simulated in the real city. With -1 will use stop_filter to stop simulation. Default: 60.

number_of_generic_services

An integer for the total number of generic work places in the real city. Default: 3700.

number_of_hospitals

See number_of_markets. Default: 16.

number_of_markets

An integer for the total number of markets in the real city. This number is eventually normalized in terms of the demographic data. Default: 256.

number_of_particles

An integer for the number of particles that are simulated in the city. This number does not have to be equal to the number of persons in the city, but it has to be large enough for the randomness stabilize the results. Default value: 1000.

number_of_restaurants

See number_of_markets. Default: 596.

number_of_schools

See number_of_markets. Default: 171.

number_of_street_markets

An integer for the total number of street markets in the real city. Default: 3700.

persons_per_home

A float for the average number of persons that live in a single home. Default: 3.

population_ages

A list of integers for the number of particles in each age group. The age groups are currently separated in intervals of five years from 0 to 100 years, and another age group for 100 years or more. The total number of persons in the city is given from the sum of all of these values. The indices for these age groups are given in ALL_AGES, and their labels are in AGE_DEF. Defaults to demographic data from São Carlos. Default: [13005, 13828, 16170, 17023, 19253, 20522, 19068, 17048, 15903, 15765, 14347, 11152, 8672, 6480, 5465, 3917, 2426, 1328, 480, 88, 12].

population_graph

In testing.

population_graph_age_attribute

In testing.

print_events

A boolean value that selects whether or not to print events during the simulation. Default: True.

quarantines

List with the ordered dictionaries of parameters for quarantine policies to be used during the simulation. Default: [quarantines.HOSPITALIATION]

Quarantine priority

If a particle meet the requirements for more than one quarantine comorbuss will give priority to the quarantine that is first in the quarantines list.

Predefined quarantines
quarantines.HOSPITALIZATION

All symptomatic severe particles will imediatly be quarantined on Hospitals and stay quarantined until the particle recovers.

HOSPITALIZATION = {
    "name": "Hospitalization",
    "filter_in": (
        ("symptoms", "==", SYMPT_SEVERE), "&",
        ("states", "==", STATE_I)
        ),
    "filter_out": (
        ("states", "==", STATE_R), "|",
        ("states", "==", STATE_D)
        ),
    "placement": "Hospitals",
}
quarantines.SYMPTOMS

Symptomatic particles will stay home until they recover.

SYMPTOMS = {
    "name": "Symptoms",
    "filter_in": (
        (
            ("symptoms", "==", SYMPT_YES), "|",
            ("symptoms", "==", SYMPT_SEVERE),
        ), "&",
        ("states", "==", STATE_I)
        ),
    "filter_out": (
            ("states", "==", STATE_R), "|",
            ("states", "==", STATE_D)
            ),
    "placement": PLC_HOME,
}
quarantines.DIAGNOSTICS

Diagnosed particles will quarantine at home 1 day after the diagnostic and stay quarantined for 14 days.

DIAGNOSTICS = {
    "name": "Diagnostics",
    "delay": 1.0,
    "filter_in": (
        ("diag_states", "==", DIAG_YES), "&",
        ("states", "==", STATE_I)
        ),
    "filter_out": ("days", 14),
    "placement": PLC_HOME,
}

See also

Diagnostics

quarantines.TRACING

Particles with tracing capabilities (see tracing_percent) that had contact with diagnosed particles also with tracing capabilities in the last 5 days will be quarantined at home 1 day after they are identified and stay quarantined for 14 days.

TRACING_DIAGNOSED_FILTER = (
        ("last_diag_states", "!=", "diag_states"), "&",
        ("diag_states", "==", DIAG_YES)
        )

TRACING = {
    "name": "Tracing",
    "delay": 1.0,
    "filter_in": ("tracing", TRACING_DIAGNOSED_FILTER, 5),
    "filter_out": ("days", 14),
    "placement": PLC_HOME,
}

See also

Tracing

Custom quarantine parameters

Parameters:

Name Type Description Default
name string

Name of the quarantine policy.

required
delay float

Delay bettwen the particle is selected to quarantine and the start of the quarantine in days.

'0.'
filter_in tuple

A sequence of nested tuples of strings and values to be evaluated to select particles to enter quarantine, strings can be population attributes (see particles states attributes), comparative operators, binary operators or makers (see markers bellow). Examples:

  • ("symptoms", "==", SYMPT_YES) equivalent as population.symptoms == SYMPT_YES
  • ((("symptoms", "==", SYMPT_YES), "|", ("symptoms", "==", SYMPT_SEVERE)), "&", ("states", "==", STATE_I)) is equivalent as ((population.symptoms == SYMPT_YES) | (population.symptoms == SYMPT_SEVERE)) & (population.states == STATE_I)

Available markers for filter_in:

  • ("tracing", trace_filters, number_of_days) will select all particles that had tracable contact with particles selected by trace_filters in the last number_of_days days.
  • ("service", service_name) will be replaced with the id of the service with service_name.
  • ("workers", service_name, workers_name) will be replaced with the id of the workers with workers_name type on service with service_name.
  • ("diagnostic", diagnostics_name) will be replaced with the id of the diagnostic with diagnostics_name.

ATTENTION: Do NOT use python's normal boolean operators (and, or, not, etc), all operations are applied on numpy boolean arrays and the apropriate operators to use are binary operators (&, |, ~, etc).

'`((("symptoms", "==", SYMPT_YES), "|", ("symptoms", "==", SYMPT_SEVERE),), "&",\n ("states", "==", STATE_I))`'
filter_out tuple

Filters to select particles to end quarantine. See filter_in.

Available markers for filter_out:

  • ("days", number_of_days) Quarantine will end after number_of_days.
'`(("states", "==", STATE_R), "|", ("states", "==", STATE_D))`'
placement string or int

Placement marker or name of the servive for the place where the particle shoud quarantine.

'PLC_HOME'
confine_particles bool

If true particle will not work or visit services.

'True'
allow_requarantine bool

If true allow partices to be quarantined more than one time in this quarantine.

'False'

random_seed

An integer that sets the randomization of the simulation. Repeating the same number and the same dictionary gives same results. Default: 1.

random_walk

A float value for the modulus of the random component of the velocity of particles random walking during free hours. [Experimental value]. Default value: [0.025].

reduce_visitors

Reduce the number of visitors during a simulation.

reduce_visitors_series

Day series to reduce the number of visitors

reduce_workers

Reduce the number of workers during a simulation.

reduce_workers_series

Day series to reduce the number of workers

resolution_t

A float for the time step used in the simulation. Default: 1.0

resolution_x

A float used in the discretization of a square, made in the x-direction. size_x/resolution_x gives the number of cells in the geography grid in the x-direction. Default: 0.01

resolution_y

A float used in the discretization of a square, made in the y-direction. size_y/resolution_y gives the number of cells in the geography grid in the y-direction. Default: 0.01

service_close_day_series_config

A list which is either empty or has three values, being the first a file path and the remaining two positive integers. The path is used to open a csv file filled with columns for services and rows with day series values (see use_day_series). The rows to be used in the simulation must be provided by using the two integers mentioned. A day series value equals to 0 closes the service, while a day series value equals to 1 opens the service. If the day series value is negative, the default service close decision takes place (see service_close and decision). The first row must have the service name for that column. Default: []

services

List with the ordered dictionaries of parameters for the creation of each service. See below avaliable parameters to set in each dictionary.

General services parameters

Parameters:

Name Type Description Default
name string

A human readble name for the service.

required
number int

An integer for the total number of instances for the service in the real city. This number is internally normalized in terms of the demographic data.

'1'
hours list

An array of two float values for the opening and closing time of the service. For example to open a service at 7 a.m. and close 7 p.m., one shoud set [7, 19].

'[7, 16]'
days list

An array of 7 booleans representing if the service works on that day of the week.

'[0, 1, 1, 1, 1, 1, 1]'
age_groups list

An array of integers corresponding to the age group indices for the age of visitors in for the service. The possible indices for these age groups are given in ALL_AGES, and their labels in AGE_DEF.

'ALL_AGES'
visitation_period float

The mean time t_{srvc} that a particle that visits a service takes to do it again, in days. The value is 7, for example, corresponds to particles visiting the service once every week. This value is used to generate a probability that a particle will visit the service in a given time step. Because the service are opened, say in t_{opened} hours of the day (set by hours, such probability is p=1/(t_{srvc}*24*t_{opened}/\Delta t), where \Delta t is the time step provided by the resolution_t parameter.

'7.0'
isolation_visit_frac float

Fraction that detrermines by how much visitation for particles in isolation shoud be reduced.

'0.5'
workers list

List of dictionaries of parameters to select workers (see Workers paramerers).

'[WORKERS_DEFAULTS]'
rooms list

List of dictionaries of parameters to create rooms (see Rooms paramerers).

'[]'
close bool

This service closes with social interventions (see Services Closing).

'True'
decision int

The decision process used to close this service, if not informed will use the global decision parameter.

'-1'
decision_par int

A dict with the parameters for the decision process for this service, if not informed will use the global decision_par_services_closing.

'{}'
inf_prob_weight float

A float value that multiplies the infection probability for contacts that happened at the service.

required
Workers parameters

Inside the workers parameters the user can set one or more dictionaries with parameters used to select workers of different types for the service.

Parameters:

Name Type Description Default
number int

Number of this type of worker per instance of this service.

'-1'
population_fraction float

Total fraction of the population in age_group to be assigned to work in this service, to be distribuited through all instances (if this parameter is greater than zero the value set in number will be overritten).

'-1'
age_groups list

An array of integers corresponding to the age group indices for the age of workers of this type for this service. The possible indices for these age groups are given in ALL_AGES, and their labels in AGE_DEF.

'np.arange(4, 12)'
shifts list

A list of lists of two values. Those two values refer to the start and end time of working shifts of the service. For example, for two shifts of 6 hours the first starting at 8, one would set [[8, 14], [14, 20]].

'[[7, 16]]'
family_visitaion_period float

Visitation period for the family of workers to fisit the workers.

'30'
family_age_groups list

An array of integers corresponding to the age group indices for the mamily members that are allowed to visit the service.

'[]'
Rooms parameters

Inside the rooms parameters user shoud pass a list with templates for comorbuss to cretate rooms in each dictionaty the user can set name with a human readble name for the room, number with an opitional integer number of this room to be created in each instance of this room (if not set comorbuss will create rooms of this type until there is no more workers to create this room), and the names of the workers types to be assined to this room with and integer number of each type of workers. Example:

classroom = {
    'name': 'Classroom',
    'Students': 20,
    'Teachers': 1,
}
teachers_room = {
    'name': 'Teachers room',
    'number': 1,
    'Teachers': 10
}
service['rooms'] = [classroom, teachers_room]
Network encounters parameters

Parameters:

Name Type Description Default
net_type int

Type of network generato to be utilized in this service, see available generators below.

'NET_DEFAULT'
net_par dict

Parameters for the generator.

'{"m": 3}'
NET_DEFAULT

Default network genereator is NetworkX's barabasi_albert_graph genrerator.

NET_MARKETS

Parameters:

Name Type Description Default
mean_contacts float

The mean number of contacts that people have in a market. This value is used in the construction of networks for markets.

'5'
cashier_prob float

A float for the percentage of workers in a market that are considered cashiers. This value is used in the construction of networks for markets.

'1.0'
NET_SCHOOLS

Parameters:

Name Type Description Default
break_classrooms int

An integer for the number of classrooms in a school that take breaks at same time. This value is used in the contruction of networks for schools.

'3'
break_period float

A float for the mean time, in hours, that breaks take in schools. It is important to choose resolution_t at least as small as this value. This value is used in the contruction of networks for schools.

'0.5'
break_mean_contacts float

A float for the mean number of contacts that students have during breaks at schools. This value is used in the contruction of networks for schools.

'5'
NET_RESTAURANTS_1 and NET_RESTAURANTS_2

Parameters:

Name Type Description Default
waiter_prob float

The percentage of workers in restaurants that are waiters. This value is used in the construction of networks for restaurants.

'1.0'
workers_mean_contacts float

The mean number of contacts that workers have on restaurants. This value is used in the construction of networks for restaurants.

'3'
persons_per_table int

The average number of persons that occupy a table in a restaurant. This value can be negative, in which case tables will be constructed according to the number of available waiters. This value is used in the construction of networks for restaurants.

'4'
NET_STREET_MARKETS

Parameters:

Name Type Description Default
seller_mean_contacts float

The mean number of contacts between people selling in street markets. It is important to notice that this value is applied to every hour the street market is opened.

'1.8'
visitor_mean_contacts float

The mean number of contacts between people buying in street markets.

'15.0'
seller_visitor_mean_contacts float

The mean number of contacts between people selling and people buying in street markets. In other words, the mean number of different places people buy when they go to street markets.

'3.0'
Distance encounters parameters

Parameters:

Name Type Description Default
grid_width int

Width of the internal grid, in number of points, used to place particles inside the service.

'5'
area float

Area of each instance of service in the real city.

'0'
move_inside bool

Allow particles to walk inside services.

'False'
controlled_access bool

If False will allow particles to ramdomly walk in to service's limit.

'True'
reserved_urban_area float

Reserves a fraction of the urban area for this service.

'0.0'

services_close

A boolean value that turns on or off the conditional closure of services during the simulation. The type of decision that closes the services, as well as its parameters, must be specified. Default: False.

services_enabled

A boolean value that turns on or off essential services in the simulation. Default: True.

services_move_inside

A boolean value that turns on particle's movement during their visit to services. This switch is particularly useful when the user has information on the mean area of the services. Default: False.

simulate_meanfield

A boolean value that turns on a mean field simulation or not. Mean field here is understood as a community with simple random walking of the particles and no other social restriction. If turned on, this switch turns off the other social interventions. Default: False.

size_x

A float for the upper limit of x values in the square where the geography of the city is represented. The lower limit is 0. Default: 1.

size_y

A float for the upper limit of y values in the square where the geography of the city is represented. The lower limit is 0. Default: 1.

social_distancing

A boolean value that specifies if particles follow social distancing during the simulation. Default: False.

social_distancing_fraction

A fraction of the population that follows social distancing. Default value: 0.0.

social_distancing_min_distance

A float for the minimum distance, in meters, for which the social distancing measure may take effect. Default: 2.0.

social_distancing_mode

An integer that selects one of three possible social distancing measures. The integer 1 selects a version of social distancing that overrides the entries of the distance matrix whenever they are smaller than social_distancing_min_distance. The value overridden to is social_distancing_min_distance value itself. When 2 is provided, the value overridden is some random one between the actual value and social_distancing_min_distance. Finally, if 3 is provided, the distance matrix obtained with value 2 is made symmetric through the operation M = { 'default': (M+M^T)/2. Default: 1.

social_isolation

A boolean value that specifies if a certain portion of the population tends to stay at home during work day. Social isolation must be configured through other parameters. Default: False.

start_date

A start date for the simulation, can be passed as an string on the format: "YYYY-mm-dd" or as an unix timestamp. Default: "2020-02-01"

stop_filter

An tuple filter to stop simulation. Default: ("False")

store_time_series

Store time series of main particles attributes. Disable this to reduce memory usage, some outputs will not be available. Default: True.

susceptibility

Suscetibility of particles.

tracing_percent

A float for the fraction of the population in the community that has tacing capability. Default: 0.0.

use_day_series

A boolean value that turns on whether services must be closed (or lockdown started) according to a day series array provided by the user. In this case the services_closing_value and services_reopening_value are overriden and the user must configure the service_close_day_series array. Default value: False.

use_networks

A boolean value that turns on the use of networks to model contacts inside services. When this switch is turned off, the contacts in services are modelled by the average area they occupy in the city. Default: True.

use_virulence

This switch, when turned on, replaces all state change masks to a simple biological model instead of a purely probabilistic one. At the moment of infection all particles are assigned with a viral load curve and all the changes in states and symptoms are determined by the viral load value for each particle. In this model at the moment of infection the viral load curve for each particle is determined and it's state is changed to exposed, when the viral load goes above vir_threshold_asymptomatic the particle became infectious and when it drops below vir_threshold_recovered the particle becomes recovered. Symptoms are also determined by the viral load value, if the viral load goes above vir_threshold_symptomatic the particle traditions from asymptomatic to symptomatic and if it goes above vir_threshold_severe the particle develops severe symptoms (used for hospitalization). At the moment the viral load curve is just a step function generated with the same probabilities as the normal disease mechanics, at the time of infections the time in each state is generated following the same distributions and a fixed viral load value is chosen for each particle so that the same fraction of particles develops each intensity of symptoms, this value is used in the viral load curve for each particle in the window of time that the particle is meant to be in the infectious state and the rest of the time the viral load is zero. Infection probability is divided by 2 for asymptomatic particles, and multiplied by 2 for severe symptomatic ones. Default: False.

vaccinations

List with the ordered dictionaries of parameters for vaccination policies to be used during the simulation. Default: []

Predefined vaccinations

Seealso

Predefined vaccinations uses predefined filters.

vaccination.SENIORS

Apply the deafult number of doses on senior citzens (age groups 12 to 21, 60+ years old).

SENIORS = {
    "name": "Senior citizens",
    "filter": (FILTER_SENIORS, "&", FILTER_DIAG_NO),
}
vaccination.ADULTS

Apply the deafult number of doses on adults citzens (age groups 5 to 21, 20+ years old).

ADULTS = {
    "name": "Adult citizens",
    "filter": (FILTER_ADULTS, "&", FILTER_DIAG_NO),
}
vaccination.CHILDRENS

Apply the deafult number of doses on child citzens (age groups 0 to 4, 0-19 years old).

CHILDRENS = {
    "name": "Child citizens",
    "filter": (FILTER_CHILDRENS, "&", FILTER_DIAG_NO),
}
vaccination.DIAG_NO

Apply the deafult number of doses on citzens that where not diagnosed.

DIAG_NO = {
    "name": "Not dignosed",
    "filter": FILTER_DIAG_NO,
}
vaccination.MAKETS_WORKERS

Apply the deafult number of doses on markets workers.

MAKETS_WORKERS = {
    "name": "Markets workers",
    "filter": (FILTER_MARKET_WORKERS, "&", FILTER_DIAG_NO),
}
vaccination.HOSPITALS_WORKERS

Apply the deafult number of doses on hospitals workers.

HOSPITALS_WORKERS = {
    "name": "Hospitals workers",
    "filter": (FILTER_HOSPITALS_WORKERS, "&", FILTER_DIAG_NO),
}
Custom vaccinations parameters

Parameters:

Name Type Description Default
name string

Name of the vaccination policy.

required
start_day int

Day from the start of the simulation to start the vaccination policy.

'0.'
days_to_immunity float

Number of days for vaccinated particles to became immune.

'30.0.'
effectiveness float

Fraction of vaccianted particles to became immune.

'1.0.'
filter tuple

A sequence of nested tuples of strings and values to be evaluated to select particles to vaccinate, strings can be population attributes (see particles states attributes), comparative operators, binary operators or makers (see markers bellow). Examples:

  • ("diag_states", "!=", DIAG_YES) equivalent as population.diag_states != DIAG_YES, and will select all particles with a dianostins states diferent than DIAG_YES that is a positive disgnostic.
  • ((("symptoms", "==", SYMPT_YES), "|", ("symptoms", "==", SYMPT_SEVERE)), "&", ("diag_states", "!=", DIAG_YES)) is equivalent as ((population.symptoms == SYMPT_YES) | (population.symptoms == SYMPT_SEVERE)) & (population.diag_states != DIAG_YES), and will select all sympomatic particles (severe or mild) that has a a dianostins states diferent than DIAG_YES.
  • (("diag_states", "!=", DIAG_YES), "&", ("ages", "isin", list(range(12, 22)))) is equivalent as ((population.diag_states != DIAG_YES) & (np.isin(population.ages, list(range(12, 22))))), and will select all particles with a dianostins states diferent than DIAG_YES in age groups from 12 to 21 (60+ years old).
  • ("workplace_id", "==", ("service", "Markets")) is equivalent as (population.workplace_id == services["Markets"].id), and will select all Markets workers.
  • (("workplace_id", "==", ("service", "SCHOOLS")), "&", ("worker_type", "==", ("workers", "Schools", "Teachers"))) is equivalent as (population.workplace_id == services["Schools"].id) & (population.worker_type == services["Schools"].workers_parameters["Teachers"].id), and will select all school's teachers.

Available markers for filter_in:

  • ("service", service_name) will load the id of the service with the name service_name.
  • ("workers", service_name, workers_name) will load the id of the worker type with the name workers_name of the service with the name service_name.
  • ("tracing", trace_filters, number_of_days) will select all particles that had tracable contact with particles selected by trace_filters in the last number_of_days days.
"`FILTER_DIAG_NO`\n\n**ATTENTION:** Do NOT use python's normal boolean operators (`and`, `or`, `not`, etc), all operations\n are applied on numpy boolean arrays and the apropriate operators to use are binary operators\n (`&`, `|`, `~`, etc)."
doses_per_day int

Number of available doses per day for this policy (this number will be normalized with the number of particles).

'1000.'
Predefined filters
vaccination.FILTER_DIAG_NO

Selects citzens that where not diagnosed.

FILTER_DIAG_NO = ("diag_states", "!=", DIAG_YES)
vaccination.FILTER_SENIORS

Selects senior citzens (age groups 12 to 21, 60+ years old).

``` python FILTER_SENIORS = ("ages", "isin", list(range(12, 22)))

#### vaccination.FILTER_ADULTS

Selects adults citzens (age groups 5 to 21, 20+ years old).

``` python
FILTER_ADULTS = ("ages", "isin", list(range(5, 22)))

vaccination.FILTER_CHILDRENS

Selects child citzens (age groups 0 to 4, 0-19 years old).

FILTER_CHILDRENS = ("ages", "isin", list(range(0, 5)))
vaccination.FILTER_MARKET_WORKERS

Selects markets workers.

FILTER_MARKET_WORKERS = ("workplace_id", "==", ("service", "Markets"))
vaccination.FILTER_HOSPITALS_WORKERS

Selects hospitals workers.

FILTER_HOSPITALS_WORKERS = ("workplace_id", "==", ("service", "Hospitals"))

vir_map_infection_probability

FILL UP --

vir_max_infection_probability

A float for the value of the infection probability when the particle is most infectious. Default: 0.8.

vir_max_infectiousness

A float for the value of virulence on which the particle becomes most infectious. Default: 1e8.

vir_threshold_asymptomatic

A float for the minimum virulence value on which a particle becomes infectious and asymptomatic. Default: 0.0.

vir_threshold_max

A float for the maximum virulence value to be used in the simulation. Default value: 1e9.

vir_threshold_recovered

A float for the minimum virulence value on which a particle becomes recovered. Default: 0.0.

vir_threshold_severe

A float for the minimum virulence value on which a particle develops severe symptoms. Default: 1e6.

vir_threshold_symptomatic

A float for the minimum virulence value on which a particle becomes symptomatic. Default: 1e3.