Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support for MosquitoRelease Fraction to Ratio change #4

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/csv/campaign-mosquitorelease.csv
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@
""New_Property_Value"": ""HasHealthCare:YES""
}
"
"Released_Fraction","float","0","1","0","The fraction of the current population of mosquitoes to relEase (the population from the previous time step) The population depends on the gender of the mosquitoes being released. This depends on Released_Type being set to FRACTION.",".. code-block:: json
"Released_Ratio","float","0","3.40E+038","0","The number of released mosquitoes is proportional to the mosquito population from the previous timestep, specifically considering mosquitoes of the same gender as those being released. This approach is used when on Released_Type is set to RATIO.",".. code-block:: json

{
""Released_type"": ""FRACTION"",
""Released_Fraction"": 0.4
""Released_type"": ""RATIO"",
""Released_Ratio"": 0.4
}
"
"Released_Genome","array of strings","NA","NA","[]","This defines the alleles of the genome of the vectors to be released. It must define all of the alleles including the gender gene. '*' is not allowed. See **Vector_Species_Params** for more information.",".. code-block:: json
Expand Down
4 changes: 2 additions & 2 deletions docs/json/campaign-mosquitorelease.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"Intervention_Config": {
"class": "MosquitoRelease",
"Cost_To_Consumer": 200,
"Released_Type": "FRACTION",
"Released_Fraction": 0.5,
"Released_Type": "Ratio",
"Released_Ratio": 1.5,
"Released_Infectious": 0.5,
"Released_Species": "SillySkeeter",
"Released_Wolbachia": "VECTOR_WOLBACHIA_FREE",
Expand Down
36 changes: 18 additions & 18 deletions emodpy_malaria/interventions/mosquitorelease.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
def _mosquito_release(campaign,
intervention_name: str = iv_name,
released_number: int = None,
released_fraction: float = None,
released_ratio: float = None,
released_infectious: float = None,
released_species: str = "arabiensis",
released_genome: list[list[str]] = None,
Expand All @@ -25,11 +25,11 @@ def _mosquito_release(campaign,
intervention_name: The optional name used to refer to this intervention as a means to differentiate it from
others that use the same class. It’s possible to have multiple MosquitoRelease interventions
if they have different Intervention_Name values.
released_number: The number of vectors to release, sets Released_Type = "FIXED_NUMBER"
released_fraction: The fraction of the current population of mosquitoes to release.
The 'population' will depend on the sex and species of the mosquitoes being released, and it will be the
population count from the previous time step.
Sets Released_Type = "FRACTION"
released_number: The number of mosquitoes to release, this parameter sets Released_Type = "FIXED_NUMBER"
automatically.
released_ratio: The number of released mosquitoes is proportional to the mosquito population from the previous
timestep, specifically considering mosquitoes of the same gender as those being released. This approach is
used when on Released_Type is set to RATIO. This parameter sets Released_Type = "RATIO" automatically.
released_infectious: The fraction of vectors released that are to be infectious.
One can only use this feature when 'Malaria_Model'!='MALARIA_MECHANISTIC_MODEL_WITH_PARASITE_GENETICS'
released_species: The case-sensitive name of the species of vectors to be released.
Expand All @@ -48,10 +48,10 @@ def _mosquito_release(campaign,
"""
if not released_genome:
released_genome = [["X", "X"]]
# setting released_fraction or released_number to 0 is valid
if ((released_number is not None and released_fraction is not None) or
(released_number is None and released_fraction is None)):
raise ValueError("Please define either released_number or released_fraction to determine how to release "
# setting released_ratio or released_number to 0 is valid
if ((released_number is not None and released_ratio is not None) or
(released_number is None and released_ratio is None)):
raise ValueError("Please define either released_number or released_ratio to determine how to release "
"mosquitoes, \n not both.\n")

if isinstance(released_microsporidia, bool):
Expand All @@ -65,7 +65,7 @@ def _mosquito_release(campaign,
if released_number is not None:
intervention.Released_Number = released_number
else:
intervention.Released_Fraction = released_fraction
intervention.Released_Ratio = released_ratio

intervention.Released_Infectious = released_infectious if released_infectious else 0
intervention.Released_Species = released_species
Expand All @@ -85,7 +85,7 @@ def add_scheduled_mosquito_release(
timesteps_between_repetitions: int = 365,
intervention_name: str = iv_name,
released_number: int = None,
released_fraction: float = None,
released_ratio: float = None,
released_infectious: float = None,
released_species: str = "arabiensis",
released_genome: list[list[str]] = None,
Expand All @@ -109,11 +109,11 @@ def add_scheduled_mosquito_release(
intervention_name: The optional name used to refer to this intervention as a means to differentiate it from
others that use the same class. It’s possible to have multiple MosquitoRelease interventions
if they have different Intervention_Name values.
released_number: The number of vectors to release, sets Released_Type = "FIXED_NUMBER"
released_fraction: The fraction of the current population of mosquitoes to release.
The 'population' will depend on the sex and species of the mosquitoes being released, and it will be the
population count from the previous time step.
Sets Released_Type = "FRACTION"
released_number: The number of mosquitoes to release, this parameter sets Released_Type = "FIXED_NUMBER"
automatically.
released_ratio: The number of released mosquitoes is proportional to the mosquito population from the previous
timestep, specifically considering mosquitoes of the same gender as those being released. This approach is
used when on Released_Type is set to RATIO. This parameter sets Released_Type = "RATIO" automatically.
released_infectious: The fraction of vectors released that are to be infectious.
One can only use this feature when 'Malaria_Model'!='MALARIA_MECHANISTIC_MODEL_WITH_PARASITE_GENETICS'
released_species: The case-sensitive name of the species of vectors to be released.
Expand All @@ -135,7 +135,7 @@ def add_scheduled_mosquito_release(
node_intervention = _mosquito_release(campaign=campaign,
intervention_name=intervention_name,
released_number=released_number,
released_fraction=released_fraction,
released_ratio=released_ratio,
released_infectious=released_infectious,
released_species=released_species,
released_genome=released_genome,
Expand Down
Loading
Loading