waning_config
AbstractWaningConfig
Bases: ABC
Abstract class for all waning effects. This class is not meant to be used directly, but to be inherited by other waning effect classes.
Source code in emodpy/campaign/waning_config.py
to_schema_dict(campaign)
abstractmethod
This method is used to convert the waning effect object to a schema dictionary. Needs to be implemented in the child classes.
BaseWaningConfig
Bases: AbstractWaningConfig, ABC
Base class for all waning effects except Combo. This class is not meant to be used directly, but to be inherited by other waning effect classes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
effect
|
float
|
|
1
|
Source code in emodpy/campaign/waning_config.py
to_schema_dict(campaign)
abstractmethod
This method is used to convert the waning effect object to a schema dictionary. Needs to be implemented in the child classes.
Box
Bases: BaseWaningConfig
This class is used to configure the Box waning effect in the campaign object. The efficacy is held at a constant rate until it drops to zero after the user-defined duration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
constant_effect
|
(float, required)
|
|
required |
box_duration
|
(float, required)
|
|
required |
Source code in emodpy/campaign/waning_config.py
to_schema_dict(campaign)
This method is used to convert the Box waning effect object to a schema dictionary.
Source code in emodpy/campaign/waning_config.py
BoxExponential
Bases: BaseWaningConfig
This class is used to configure the BoxExponential waning effect in the campaign object. The initial efficacy is held for a specified duration, then the efficacy decays at an exponential rate where the current effect is equal to initial_effect - dt/decay_time_constant. Here, 'dt' is the duration of the timestep (config.Simulation_Timestep).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
box_duration
|
(float, required)
|
|
required |
decay_time_constant
|
(float, required)
|
|
required |
initial_effect
|
float
|
|
1
|
Source code in emodpy/campaign/waning_config.py
to_schema_dict(campaign)
This method is used to convert the BoxExponential waning effect object to a schema dictionary.
Source code in emodpy/campaign/waning_config.py
Combo
Bases: AbstractWaningConfig
The Combo class is used within individual-level interventions and allows for specifying a list of effects when the intervention only has one WaningEffect defined. These effects can be added or multiplied.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
effect_list
|
(list[BaseWaningConfig], required)
|
|
required |
add_effects
|
bool
|
|
False
|
expires_when_all_expire
|
bool
|
|
False
|
Source code in emodpy/campaign/waning_config.py
to_schema_dict(campaign)
This method is used to convert the Combo waning effect object to a schema dictionary.
Source code in emodpy/campaign/waning_config.py
Constant
Bases: BaseWaningConfig
This class is used to configure the Constant waning effect in the campaign object. The efficacy is held at a constant rate.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
constant_effect
|
(float, required)
|
|
required |
Source code in emodpy/campaign/waning_config.py
to_schema_dict(campaign)
This method is used to convert the Constant waning effect object to a schema dictionary.
Source code in emodpy/campaign/waning_config.py
Exponential
Bases: BaseWaningConfig
This class is used to configure the Exponential waning effect in the campaign object. The efficacy decays at an exponential rate where the current effect is equal to initial_effect - dt/decay_time_constant. Here, 'dt' is the duration of the timestep (config.Simulation_Timestep).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
decay_time_constant
|
(float, required)
|
|
required |
initial_effect
|
float
|
|
1
|
Source code in emodpy/campaign/waning_config.py
to_schema_dict(campaign)
This method is used to convert the Exponential waning effect object to a schema dictionary.
Source code in emodpy/campaign/waning_config.py
MapLinear
Bases: BaseWaningConfig
This class is used to configure the MapLinear waning effect in the campaign object. The efficacy decays based on the time since the start of the intervention. This change is defined by a map of time to efficacy values in which the time between time/effect points is linearly interpolated. When the time since start reaches the end of the times in the map, the last effect will be used unless the intervention expires. If the time since start is less than the first effect in the map, the efficacy will be zero. This can be used to define the shape of a curve whose magnitude is defined by the effect_multiplier.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
times
|
(list[float], required)
|
|
required |
effects
|
(list[float], required)
|
|
required |
effect_multiplier
|
float
|
|
1
|
expire_at_durability_map_end
|
bool
|
|
False
|
Examples:
In this example, we create a MapLinear object with the following times and effects: [365, 730, 1460, 3650] and [10, 20, 33, 40] respectively. The MapLinear object is then create an InterpolatedValueMap object in the campaign object to represent these times and effects. The value at time 365 is 10, at time 730 is 20, at time 1460 is 33, and at time 3650 is 40. The values between these times are interpolated linearly. For example, the value at time 1095 is 26.5, which is the average of the values at times 730 and 1460. The value at time 395 is 10.821918, which is calculated by linear interpolation between the values at times 365 and 730, (20-10)*(395-365)/(730-365) + 10 , and so on.
times = [365, 730, 1460, 3650] effects = [10, 20, 33, 40] wc = MapLinear(times=times, effects=effects)
Source code in emodpy/campaign/waning_config.py
to_schema_dict(campaign)
This method is used to convert the MapLinear waning effect object to a schema dictionary.
Source code in emodpy/campaign/waning_config.py
MapLinearAge
Bases: BaseWaningConfig
This class is used to configure the MapLinearAge waning effect in the campaign object. The efficacy decays based the age of the individual who owns the intervention instead of the time since the start of the intervention. This change is defined by a map of age to efficacy values in which the age between age/effect points is linearly interpolated. When the age of the individual reaches the end of the ages in the map, the last value will be used. If the age of the individual is less than the first value in the map, the efficacy will be zero. This can be used to define the shape of a curve whose magnitude is defined by the effect_multiplier.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ages
|
(list[float], required)
|
|
required |
effects
|
(list[float], required)
|
|
required |
effect_multiplier
|
float
|
|
1
|
Source code in emodpy/campaign/waning_config.py
to_schema_dict(campaign)
This method is used to convert the MapLinearAge waning effect object to a schema dictionary.
Source code in emodpy/campaign/waning_config.py
MapLinearSeasonal
Bases: BaseWaningConfig
This class is used to configure the MapLinearSeasonal waning effect in the campaign object. The efficacy decays based on the season of the year. The efficacy will repeat itself every 365 days. That is, the time since start will reset to zero once it reaches 365. This allows you to simulate seasonal effects.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
times
|
(list[float], required)
|
|
required |
effects
|
(list[float], required)
|
|
required |
effect_multiplier
|
float
|
|
required |
Source code in emodpy/campaign/waning_config.py
to_schema_dict(campaign)
This method is used to convert the MapLinearSeasonal waning effect object to a schema dictionary.
Source code in emodpy/campaign/waning_config.py
MapPiecewise
Bases: BaseWaningConfig
This class is used to configure the MapPiecewise waning effect in the campaign object. The efficacy decays based on the time since the start of the intervention. Similar to WaningEffectMapLinear, except that the data is assumed to be constant between time/value points (no interpolation). If the time since start falls between two points, the efficacy of the earlier time point is used.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
days
|
(list[float], required)
|
|
required |
effects
|
(list[float], required)
|
|
required |
effect_multiplier
|
float
|
|
1
|
expire_at_durability_map_end
|
bool
|
|
False
|
Source code in emodpy/campaign/waning_config.py
to_schema_dict(campaign)
This method is used to convert the MapPiecewise waning effect object to a schema dictionary.
Source code in emodpy/campaign/waning_config.py
RandomBox
Bases: BaseWaningConfig
This class is used to configure the RandomBox waning effect in the campaign object. The efficacy is held at a constant rate until it drops to zero after a user-defined duration. This duration is randomly selected from an exponential distribution where exponential_discard_time is the mean.
The intervention will expire when the randomly selected duration is complete.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
constant_effect
|
(float, required)
|
|
required |
exponential_discard_time
|
(float, required)
|
|
required |
Source code in emodpy/campaign/waning_config.py
to_schema_dict(campaign)
This method is used to convert the RandomBox waning effect object to a schema dictionary.