def catchment_ento(cb, catch): arab_times, arab_spline = catch_3_yr_spline(catch, "arabiensis") funest_times, funest_spline = catch_3_yr_spline(catch, "funestus") # Arabiensis set_species_param( cb, 'arabiensis', 'Larval_Habitat_Types', { "LINEAR_SPLINE": { "Capacity_Distribution_Number_Of_Years": 3, "Capacity_Distribution_Over_Time": { "Times": arab_times, "Values": arab_spline }, "Max_Larval_Capacity": pow(10, 8.5) } }) # Funestus set_species_param( cb, 'funestus', 'Larval_Habitat_Types', { "LINEAR_SPLINE": { "Capacity_Distribution_Number_Of_Years": 3, "Capacity_Distribution_Over_Time": { "Times": funest_times, "Values": funest_spline }, "Max_Larval_Capacity": pow(10, 7.5) } })
def test_species_params(self): self.assertEqual( vs.get_species_param(self.cb, 'arabiensis', 'Immature_Duration'), 2) vs.set_species_param(self.cb, 'arabiensis', 'Egg_Batch_Size', 123) self.assertEqual( vs.get_species_param(self.cb, 'arabiensis', 'Egg_Batch_Size'), 123) vs.set_larval_habitat( self.cb, {'arabiensis': { 'TEMPORARY_RAINFALL': 123, 'CONSTANT': 456 }}) self.assertDictEqual( vs.get_species_param(self.cb, 'arabiensis', 'Larval_Habitat_Types'), { 'TEMPORARY_RAINFALL': 123, 'CONSTANT': 456 }) vs.scale_all_habitats(self.cb, 2) self.assertDictEqual( vs.get_species_param(self.cb, 'arabiensis', 'Larval_Habitat_Types'), { 'TEMPORARY_RAINFALL': 246, 'CONSTANT': 912 }) funestus_habitat = vs.get_species_param( self.cb, 'funestus', 'Larval_Habitat_Types')['WATER_VEGETATION'] self.assertEqual(funestus_habitat, 4e7)
def set_ento(cb): cb.update_params({ "Climate_Model": "CLIMATE_CONSTANT", "Base_Air_Temperature": 27, "Base_Land_Temperature": 27, }) cb.update_params({'Vector_Species_Names': ['funestus']}) set_species_param( cb, 'funestus', 'Larval_Habitat_Types', { "LINEAR_SPLINE": { "Capacity_Distribution_Number_Of_Years": 1, "Capacity_Distribution_Over_Time": { "Times": [ 0.0, 30.417, 60.833, 91.25, 121.667, 152.083, 182.5, 212.917, 243.333, 273.75, 304.167, 334.583 ], "Values": [ 0.01, 0.01, 0.01, 0.01, 0.2, 0.5, 0.5, 0.5, 1.0, #oct 1.0, #sept 0.35, 0.01 ] # "Values": [ # 0.01, # 0.01, # 0.01, # 0.2, # 0.8, # 1.0, # 1.0, # 1.0, # 0.5, # 0.2, # 0.01, # 0.01 # ] }, "Max_Larval_Capacity": 10.**9 }, # "WATER_VEGETATION": 10.**9 })
def map_sample_to_model_input(cb, sample): set_species_param(cb, 'arabiensis', 'Larval_Habitat_Types', { # "CONSTANT": 10.**sample['arab_constant_scale'], "CONSTANT": 10.**6.5, "TEMPORARY_RAINFALL": 10.**sample['arab_rainfall_scale'] }) # Funestus set_species_param(cb, 'funestus', 'Larval_Habitat_Types', { "LINEAR_SPLINE": { "Capacity_Distribution_Number_Of_Years": 1, "Capacity_Distribution_Over_Time": { "Times": [ 0.0, 30.417, 60.833, 91.25, 121.667, 152.083, 182.5, 212.917, 243.333, 273.75, 304.167, 334.583 ], "Values": [ 0.0, 0.0, 0.0, 0.2, 0.8, 1.0, 1.0, 1.0, 0.5, 0.2, 0.0, 0.0 ] }, "Max_Larval_Capacity": 10.**(sample['arab_rainfall_scale']+sample['log_spline_rainfall_ratio']) # "Max_Larval_Capacity": 10.**sample['arab_rainfall_scale'] * sample['spline_rainfall_ratio'] # "Max_Larval_Capacity": 10.**sample['funest_spline_scale'] }, # "WATER_VEGETATION": 10.**sample['funest_veg_scale'] "WATER_VEGETATION": 10.**5.5 }) return sample
def simulation_setup(cb, species_details, site_vector_props, max_larval_capacity=4e8): site_dir = os.path.join('sites', 'all') # directories cb.update_params({ "Demographics_Filenames": [ os.path.join(site_dir, "demographics.json"), os.path.join(site_dir, "demographics_net_overlay.json") ], "Air_Temperature_Filename": os.path.join(site_dir, "air_temperature_daily.bin"), "Land_Temperature_Filename": os.path.join(site_dir, "air_temperature_daily.bin"), "Rainfall_Filename": os.path.join(site_dir, "rainfall_daily.bin"), "Relative_Humidity_Filename": os.path.join(site_dir, "relative_humidity_daily.bin") }) # Find vector proportions for each vector set_params_by_species(cb.params, [name for name in species_details.keys()]) larval_habs_per_site = {"NodeID": site_vector_props["node_id"]} for species_name, species_modifications in species_details.items(): set_species_param(cb, species_name, "Adult_Life_Expectancy", 20) set_species_param(cb, species_name, 'Vector_Sugar_Feeding_Frequency', 'VECTOR_SUGAR_FEEDING_EVERY_DAY') for param, val in species_modifications.items(): if param == "habitat_split": new_vals = { hab: hab_prop * max_larval_capacity for hab, hab_prop in val.items() } set_species_param(cb, species_name, "Larval_Habitat_Types", new_vals) larval_habs_per_site.update({ ".".join([species_name, hab]): site_vector_props[species_name] for hab in val.keys() }) else: set_species_param(cb, species_name, param, val) scale_larval_habitats(cb, pd.DataFrame(larval_habs_per_site))
def update_vector_params(cb): cb.update_params({'Vector_Species_Names': ['gambiae']}) set_species(cb, ['gambiae']) set_species_param(cb, "gambiae", "Anthropophily", 0.65) cb.update_params({ "Default_Geography_Initial_Node_Population": 1000, "Default_Geography_Torus_Size": 10, "Enable_Vector_Migration_Human": 0, "Enable_Vector_Migration_Wind": 0, "Egg_Hatch_Density_Dependence": "NO_DENSITY_DEPENDENCE", "Temperature_Dependent_Feeding_Cycle": "NO_TEMPERATURE_DEPENDENCE", "Enable_Drought_Egg_Hatch_Delay": 0, "Enable_Egg_Mortality": 0, "Enable_Temperature_Dependent_Egg_Hatching": 0, "Vector_Migration_Modifier_Equation": "LINEAR" }) set_species_param( cb, 'gambiae', 'Larval_Habitat_Types', { "LINEAR_SPLINE": { "Capacity_Distribution_Over_Time": { "Times": [ 0.0, 30.417, 60.833, 91.25, 121.667, 152.083, 182.5, 212.917, 243.333, 273.75, 304.167, 334.583 ], "Values": [3, 0.8, 1.25, 0.1, 2.7, 10, 6, 35, 2.8, 1.5, 1.6, 2.1] }, "Capacity_Distribution_Number_Of_Years": 1, "Max_Larval_Capacity": pow(10, 9) } }) set_species_param(cb, "gambiae", "Adult_Life_Expectancy", 20) set_species_param(cb, "gambiae", "Male_Life_Expectancy", 10) set_species_param(cb, "gambiae", "Indoor_Feeding_Fraction", 0.9)
def update_vector_params(cb): cb.update_params({"Vector_Species_Names": ['gambiae']}) set_species_param(cb, 'gambiae', 'Larval_Habitat_Types', {"LINEAR_SPLINE": { "Capacity_Distribution_Per_Year": { "Times": [0.0, 30.417, 60.833, 91.25, 121.667, 152.083, 182.5, 212.917, 243.333, 273.75, 304.167, 334.583], "Values": [3, 0.8, 1.25, 0.1, 2.7, 8, 4, 35, 6.8, 6.5, 2.6, 2.1] }, "Max_Larval_Capacity": 1e9 }}) set_species_param(cb, "gambiae", "Indoor_Feeding_Fraction", 0.9) set_species_param(cb, "gambiae", "Adult_Life_Expectancy", 20)
sim_duration = 365 * 70 num_seeds = 50 SetupParser('HPC') cb = DTKConfigBuilder.from_defaults('MALARIA_SIM') builder = GenericSweepBuilder.from_dict({'Run_Number': range(num_seeds)}) set_climate_constant(cb) set_species_param(cb, 'gambiae', 'Larval_Habitat_Types', {"LINEAR_SPLINE": { "Capacity_Distribution_Per_Year": { "Times": [0.0, 30.417, 60.833, 91.25, 121.667, 152.083, 182.5, 212.917, 243.333, 273.75, 304.167, 334.583], # "Values": [1, 0.25, 0.1, 1, 1, 0.5, 12, 5, 3, 2, 1.5, 1.5] "Values": [3, 0.8, 1.25, 0.1, 2.7, 8, 4, 35, 6.8, 6.5, 2.6, 2.1] }, "Max_Larval_Capacity": 1e9 }}) set_species_param(cb, "gambiae", "Indoor_Feeding_Fraction", 0.9) cb.update_params({"Demographics_Filenames": ['Calibration/single_node_demographics.json'], 'Antigen_Switch_Rate': pow(10, -9.116590124), 'Base_Gametocyte_Production_Rate': 0.06150582, 'Base_Gametocyte_Mosquito_Survival_Rate': 0.002011099, 'Base_Population_Scale_Factor': 1, # Change x_Temporary_Larval_Habitat by same factor if changing Base_Population_Scale_Factor 'Falciparum_MSP_Variants': 32, 'Falciparum_Nonspecific_Types': 76,
def change_adult_lifespan(cb, adult_life_expectacy): set_species_param(cb, 'gambiae', "Indoor_Feeding_Fraction", 0.5) set_species_param(cb, 'gambiae', 'Adult_Life_Expectancy', adult_life_expectacy) set_species_param(cb, 'gambiae', 'Anthropophily', 0.85) set_species_param(cb, 'gambiae', 'Vector_Sugar_Feeding_Frequency', "VECTOR_SUGAR_FEEDING_NONE") set_species_param(cb, 'funestus', "Indoor_Feeding_Fraction", 0.5) set_species_param(cb, 'funestus', 'Adult_Life_Expectancy', adult_life_expectacy) set_species_param(cb, 'funestus', 'Anthropophily', 0.65) set_species_param(cb, 'funestus', 'Vector_Sugar_Feeding_Frequency', "VECTOR_SUGAR_FEEDING_NONE") return {"adult_life_expectancy": adult_life_expectacy}
def set_ento(cb, archetype="Southern"): if archetype == "Southern": set_species(cb, ["arabiensis", "funestus"]) set_species_param(cb, 'arabiensis', 'Indoor_Feeding_Fraction', 0.5) set_species_param(cb, 'arabiensis', 'Adult_Life_Expectancy', 20) set_species_param(cb, 'arabiensis', 'Anthropophily', 0.65) set_species_param(cb, 'arabiensis', 'Vector_Sugar_Feeding_Frequency', "VECTOR_SUGAR_FEEDING_NONE") set_species_param(cb, 'funestus', "Indoor_Feeding_Fraction", 0.9) set_species_param(cb, 'funestus', 'Adult_Life_Expectancy', 20) set_species_param(cb, 'funestus', 'Anthropophily', 0.65) set_species_param(cb, 'funestus', 'Vector_Sugar_Feeding_Frequency', "VECTOR_SUGAR_FEEDING_NONE") elif archetype == "Sahel": set_species(cb, ["gambiae"]) set_species_param(cb, 'gambiae', "Indoor_Feeding_Fraction", 0.9) set_species_param(cb, 'gambiae', 'Adult_Life_Expectancy', 20) set_species_param(cb, 'gambiae', 'Anthropophily', 0.65) set_species_param(cb, 'gambiae', 'Vector_Sugar_Feeding_Frequency', "VECTOR_SUGAR_FEEDING_NONE") elif archetype == "Central": set_species(cb, ["gambiae", "funestus"]) set_species_param(cb, 'gambiae', "Indoor_Feeding_Fraction", 0.5) set_species_param(cb, 'gambiae', 'Adult_Life_Expectancy', 20) set_species_param(cb, 'gambiae', 'Anthropophily', 0.85) set_species_param(cb, 'gambiae', 'Vector_Sugar_Feeding_Frequency', "VECTOR_SUGAR_FEEDING_NONE") set_species_param(cb, 'funestus', "Indoor_Feeding_Fraction", 0.5) set_species_param(cb, 'funestus', 'Adult_Life_Expectancy', 20) set_species_param(cb, 'funestus', 'Anthropophily', 0.65) set_species_param(cb, 'funestus', 'Vector_Sugar_Feeding_Frequency', "VECTOR_SUGAR_FEEDING_NONE") elif archetype == "Eastern": set_species(cb, ["gambiae", "funestus", "arabiensis"]) set_species_param(cb, 'gambiae', "Indoor_Feeding_Fraction", 0.85) set_species_param(cb, 'gambiae', 'Adult_Life_Expectancy', 20) set_species_param(cb, 'gambiae', 'Anthropophily', 0.85) set_species_param(cb, 'gambiae', 'Vector_Sugar_Feeding_Frequency', "VECTOR_SUGAR_FEEDING_NONE") set_species_param(cb, 'arabiensis', "Indoor_Feeding_Fraction", 0.5) set_species_param(cb, 'arabiensis', 'Adult_Life_Expectancy', 20) set_species_param(cb, 'arabiensis', 'Anthropophily', 0.65) set_species_param(cb, 'arabiensis', 'Vector_Sugar_Feeding_Frequency', "VECTOR_SUGAR_FEEDING_NONE") set_species_param(cb, 'funestus', "Indoor_Feeding_Fraction", 0.7) # Motivated by Uganda Vectorlink 2019 set_species_param(cb, 'funestus', 'Adult_Life_Expectancy', 20) set_species_param(cb, 'funestus', 'Anthropophily', 0.65) set_species_param(cb, 'funestus', 'Vector_Sugar_Feeding_Frequency', "VECTOR_SUGAR_FEEDING_NONE") elif archetype == "Coastal Western": set_species(cb, ["gambiae", "funestus", "arabiensis"]) set_species_param(cb, 'gambiae', "Indoor_Feeding_Fraction", 0.85) set_species_param(cb, 'gambiae', 'Adult_Life_Expectancy', 20) set_species_param(cb, 'gambiae', 'Anthropophily', 0.8) # Slightly tuned down - Nigeria Vectorlink 2019 set_species_param(cb, 'gambiae', 'Vector_Sugar_Feeding_Frequency', "VECTOR_SUGAR_FEEDING_NONE") set_species_param(cb, 'arabiensis', "Indoor_Feeding_Fraction", 0.5) set_species_param(cb, 'arabiensis', 'Adult_Life_Expectancy', 20) set_species_param(cb, 'arabiensis', 'Anthropophily', 0.65) set_species_param(cb, 'arabiensis', 'Vector_Sugar_Feeding_Frequency', "VECTOR_SUGAR_FEEDING_NONE") set_species_param(cb, 'funestus', "Indoor_Feeding_Fraction", 0.85) set_species_param(cb, 'funestus', 'Adult_Life_Expectancy', 20) set_species_param(cb, 'funestus', 'Anthropophily', 0.65) set_species_param(cb, 'funestus', 'Vector_Sugar_Feeding_Frequency', "VECTOR_SUGAR_FEEDING_NONE") elif archetype == "Magude": set_species(cb, ["arabiensis", "funestus"]) set_species_param(cb, 'arabiensis', 'Indoor_Feeding_Fraction', 0.95) set_species_param(cb, 'arabiensis', 'Adult_Life_Expectancy', 20) set_species_param(cb, 'arabiensis', 'Anthropophily', 0.65) set_species_param(cb, 'arabiensis', 'Vector_Sugar_Feeding_Frequency', "VECTOR_SUGAR_FEEDING_NONE") set_species_param(cb, 'funestus', "Indoor_Feeding_Fraction", 0.6) set_species_param(cb, 'funestus', 'Adult_Life_Expectancy', 20) set_species_param(cb, 'funestus', 'Anthropophily', 0.65) set_species_param(cb, 'funestus', 'Vector_Sugar_Feeding_Frequency', "VECTOR_SUGAR_FEEDING_NONE") else: raise NotImplementedError set_ento_splines(cb, habitat_scale=1, archetype=archetype)
def set_ento_splines(cb, habitat_scale, archetype="Southern"): if archetype == "Southern": arab_scale = habitat_scale funest_scale = arab_scale - 0.8 set_species_param( cb, 'funestus', "Larval_Habitat_Types", { "LINEAR_SPLINE": { "Capacity_Distribution_Number_Of_Years": 1, "Capacity_Distribution_Over_Time": { "Times": month_times, "Values": [ 0.13, 0.33, 1., 0.67, 0.67, 0.67, 0.33, 0.33, 0.2, 0.13, 0.067, 0.067 ] }, "Max_Larval_Capacity": 10**funest_scale } }) set_species_param( cb, 'arabiensis', 'Larval_Habitat_Types', { "LINEAR_SPLINE": { "Capacity_Distribution_Number_Of_Years": 1, "Capacity_Distribution_Over_Time": { "Times": month_times, "Values": [ 0.6, 0.8, 1.0, 0.9, 0.1, 0.01, 0.01, 0.01, 0.01, 0.01, 0.02, 0.05 ] }, "Max_Larval_Capacity": 10**arab_scale }, "CONSTANT": 10**4.9 }) return_dict = {"hab_scale": habitat_scale} elif archetype == "Sahel": set_species_param( cb, 'gambiae', "Larval_Habitat_Types", { "LINEAR_SPLINE": { "Capacity_Distribution_Number_Of_Years": 1, "Capacity_Distribution_Over_Time": { "Times": month_times, "Values": [ 0.086, 0.023, 0.034, 0.0029, 0.077, 0.23, 0.11, 1., 0.19, 0.19, 0.074, 0.06 ] }, "Max_Larval_Capacity": 10**habitat_scale } }) return_dict = {"hab_scale": habitat_scale} elif archetype == "Central": # Amelia's spline setup # x_overall_amelia = 63.1 # # set_species_param(cb, # 'gambiae', # "Larval_Habitat_Types", # {"CONSTANT": 40000000*x_overall_amelia, # "TEMPORARY_RAINFALL": 360000000*x_overall_amelia, # "LINEAR_SPLINE": { # "Capacity_Distribution_Number_Of_Years": 1, # "Capacity_Distribution_Over_Time": { # "Times": month_times, # "Values": [0.086, 0.023, 0.034, 0.0029, 0.077, 0.23, 0.11, 1., 0.19, 0.19, 0.074, 0.06] # }, # "Max_Larval_Capacity": 10**habitat_scale # }} # ) # # set_species_param(cb, # 'funestus', # "Larval_Habitat_Types", # {"WATER_VEGETATION": 400000000*x_overall_amelia, # "LINEAR_SPLINE": { # "Capacity_Distribution_Number_Of_Years": 1, # "Capacity_Distribution_Over_Time": { # "Times": month_times, # "Values": [0.086, 0.023, 0.034, 0.0029, 0.077, 0.23, 0.11, 1., 0.19, 0.19, 0.074, 0.06] # }, # "Max_Larval_Capacity": 10**habitat_scale # }} # ) gamb_scale = habitat_scale funest_scale = gamb_scale - 1.03 # Calculated for funestus to be ~5% of all mosquitos set_species_param( cb, 'gambiae', "Larval_Habitat_Types", { "LINEAR_SPLINE": { "Capacity_Distribution_Number_Of_Years": 1, "Capacity_Distribution_Over_Time": { "Times": month_times, "Values": [ 0.51, 0.42, 0.52, 0.66, 0.86, 0.92, 0.82, 0.75, 0.84, 0.99, 1.0, 0.77 ] }, "Max_Larval_Capacity": 10**gamb_scale } }) set_species_param( cb, 'funestus', "Larval_Habitat_Types", { "LINEAR_SPLINE": { "Capacity_Distribution_Number_Of_Years": 1, "Capacity_Distribution_Over_Time": { "Times": month_times, "Values": [ 0.87, 0.82, 0.85, 0.9, 0.95, 0.93, 0.89, 0.87, 0.87, 0.94, 1.0, 0.97 ] }, "Max_Larval_Capacity": 10**funest_scale } }) return_dict = {"hab_scale": habitat_scale} elif archetype == "Eastern": # Amelia's spline setup x_overall_amelia = 63.1 set_species_param( cb, 'arabiensis', "Larval_Habitat_Types", { "CONSTANT": 40000000 * x_overall_amelia, "TEMPORARY_RAINFALL": 360000000 * x_overall_amelia, "LINEAR_SPLINE": { "Capacity_Distribution_Number_Of_Years": 1, "Capacity_Distribution_Over_Time": { "Times": month_times, "Values": [ 0.086, 0.023, 0.034, 0.0029, 0.077, 0.23, 0.11, 1., 0.19, 0.19, 0.074, 0.06 ] }, "Max_Larval_Capacity": 10**habitat_scale } }) set_species_param( cb, 'gambiae', "Larval_Habitat_Types", { "CONSTANT": 40000000 * x_overall_amelia, "TEMPORARY_RAINFALL": 360000000 * x_overall_amelia, "LINEAR_SPLINE": { "Capacity_Distribution_Number_Of_Years": 1, "Capacity_Distribution_Over_Time": { "Times": month_times, "Values": [ 0.086, 0.023, 0.034, 0.0029, 0.077, 0.23, 0.11, 1., 0.19, 0.19, 0.074, 0.06 ] }, "Max_Larval_Capacity": 10**habitat_scale } }) set_species_param( cb, 'funestus', "Larval_Habitat_Types", { "WATER_VEGETATION": 400000000 * x_overall_amelia, "LINEAR_SPLINE": { "Capacity_Distribution_Number_Of_Years": 1, "Capacity_Distribution_Over_Time": { "Times": month_times, "Values": [ 0.086, 0.023, 0.034, 0.0029, 0.077, 0.23, 0.11, 1., 0.19, 0.19, 0.074, 0.06 ] }, "Max_Larval_Capacity": 10**habitat_scale } }) return_dict = {"hab_scale": habitat_scale} elif archetype == "Coastal Western": # Amelia's spline setup x_overall_amelia = 63.1 set_species_param( cb, 'arabiensis', "Larval_Habitat_Types", { "CONSTANT": 40000000 * x_overall_amelia, "TEMPORARY_RAINFALL": 360000000 * x_overall_amelia, "LINEAR_SPLINE": { "Capacity_Distribution_Number_Of_Years": 1, "Capacity_Distribution_Over_Time": { "Times": month_times, "Values": [ 0.086, 0.023, 0.034, 0.0029, 0.077, 0.23, 0.11, 1., 0.19, 0.19, 0.074, 0.06 ] }, "Max_Larval_Capacity": 10**habitat_scale } }) set_species_param( cb, 'gambiae', "Larval_Habitat_Types", { "CONSTANT": 40000000 * x_overall_amelia, "TEMPORARY_RAINFALL": 360000000 * x_overall_amelia, "LINEAR_SPLINE": { "Capacity_Distribution_Number_Of_Years": 1, "Capacity_Distribution_Over_Time": { "Times": month_times, "Values": [ 0.086, 0.023, 0.034, 0.0029, 0.077, 0.23, 0.11, 1., 0.19, 0.19, 0.074, 0.06 ] }, "Max_Larval_Capacity": 10**habitat_scale } }) set_species_param( cb, 'funestus', "Larval_Habitat_Types", { "WATER_VEGETATION": 400000000 * x_overall_amelia, "LINEAR_SPLINE": { "Capacity_Distribution_Number_Of_Years": 1, "Capacity_Distribution_Over_Time": { "Times": month_times, "Values": [ 0.086, 0.023, 0.034, 0.0029, 0.077, 0.23, 0.11, 1., 0.19, 0.19, 0.074, 0.06 ] }, "Max_Larval_Capacity": 10**habitat_scale } }) return_dict = {"hab_scale": habitat_scale} elif archetype == "Magude": arab_scale = habitat_scale funest_scale = arab_scale - 0.56 set_species_param( cb, 'funestus', "Larval_Habitat_Types", { "LINEAR_SPLINE": { "Capacity_Distribution_Number_Of_Years": 1, "Capacity_Distribution_Over_Time": { "Times": month_times, "Values": [ 0.009, 0.438, 0.005, 0.088, 0.049, 1.000, 0.023, 0.170, 0.015, 0.008, 0.376, 0.193 ] }, "Max_Larval_Capacity": 10**funest_scale } }) set_species_param( cb, 'arabiensis', 'Larval_Habitat_Types', { "LINEAR_SPLINE": { "Capacity_Distribution_Number_Of_Years": 1, "Capacity_Distribution_Over_Time": { "Times": month_times, "Values": [ 0.005, 0.119, 1.000, 0.069, 0.184, 0.203, 0.486, 0.157, 0.149, 0.185, 0.119, 0.011 ] }, "Max_Larval_Capacity": 10**arab_scale }, "CONSTANT": 10**4.9 }) return_dict = {"hab_scale": habitat_scale} else: raise NotImplementedError return return_dict
def add_zambia_ento_to_cb(self): # Vector properties: self.cb.update_params( {'Vector_Species_Names': ['arabiensis', 'funestus']}) # Arabiensis set_species_param(self.cb, 'arabiensis', 'Larval_Habitat_Types', { "CONSTANT": 2000000.0, "TEMPORARY_RAINFALL": 100000000.0 }) set_species_param(self.cb, 'arabiensis', 'Indoor_Feeding_Fraction', 0.5) set_species_param(self.cb, 'arabiensis', 'Adult_Life_Expectancy', 20) set_species_param(self.cb, 'arabiensis', 'Anthropophily', 0.65) set_species_param(self.cb, 'arabiensis', 'Vector_Sugar_Feeding_Frequency', "VECTOR_SUGAR_FEEDING_NONE") # Funestus set_species_param( self.cb, 'funestus', 'Larval_Habitat_Types', { "LINEAR_SPLINE": { "Capacity_Distribution_Number_Of_Years": 1, "Capacity_Distribution_Over_Time": { "Times": [ 0.0, 30.417, 60.833, 91.25, 121.667, 152.083, 182.5, 212.917, 243.333, 273.75, 304.167, 334.583 ], "Values": [ 0.0, 0.0, 0.0, 0.2, 0.8, 1.0, 1.0, 1.0, 0.5, 0.2, 0.0, 0.0 ] }, "Max_Larval_Capacity": 100000000.0 }, "WATER_VEGETATION": 2000000.0 }) set_species_param(self.cb, 'funestus', "Indoor_Feeding_Fraction", 0.9) set_species_param(self.cb, 'funestus', 'Adult_Life_Expectancy', 20) set_species_param(self.cb, 'funestus', 'Anthropophily', 0.65) set_species_param(self.cb, 'funestus', 'Vector_Sugar_Feeding_Frequency', "VECTOR_SUGAR_FEEDING_NONE") self.cb.params['Enable_Vector_Species_Report'] = 1
cb = DTKConfigBuilder.from_defaults('MALARIA_SIM') builder = GenericSweepBuilder.from_dict({'Run_Number': range(num_seeds)}) set_climate_constant(cb) set_species_param( cb, 'gambiae', 'Larval_Habitat_Types', { "LINEAR_SPLINE": { "Capacity_Distribution_Number_Of_Years": 1, "Capacity_Distribution_Over_Time": { "Times": [ 0.0, 30.417, 60.833, 91.25, 121.667, 152.083, 182.5, 212.917, 243.333, 273.75, 304.167, 334.583 ], "Values": [ 3, 0.8, 1.25, 0.1, 2.7, 10, 6, 35, 2.8, 1.5, 1.6, 2.1 ] # with 'x_Temporary_Larval_Habitat': 0.2 for EIR~10 }, "Max_Larval_Capacity": pow(10, 9) } }) set_species_param(cb, "gambiae", "Adult_Life_Expectancy", 20) set_species_param(cb, "gambiae", "Indoor_Feeding_Fraction", 0.9) cb.update_params({ 'Age_Initialization_Distribution_Type': 'DISTRIBUTION_SIMPLE',
def setup_chiyabi_single_node_cbever(cb, demo_file=None, immun_file=None, migrate=False): # Spatial simulation + migration settings cb.update_params({ 'Birth_Rate_Dependence': 'FIXED_BIRTH_RATE', # Match demographics file for constant population size (with exponential age distribution) 'Enable_Nondisease_Mortality': 1, 'New_Diagnostic_Sensitivity': 0.025, # 40/uL "Enable_Immunity_Initialization_Distribution": 1, "Immunity_Initialization_Distribution_Type": "DISTRIBUTION_COMPLEX", # [Not sure what this does] 'Air_Temperature_Filename': "Climate/test/Zambia_30arcsec_air_temperature_daily.bin", 'Land_Temperature_Filename': "Climate/test/Zambia_30arcsec_air_temperature_daily.bin", 'Rainfall_Filename': "Climate/test/Zambia_30arcsec_rainfall_daily.bin", 'Relative_Humidity_Filename': "Climate/test/Zambia_30arcsec_relative_humidity_daily.bin", 'Vector_Species_Names': ['arabiensis', 'funestus'] }) set_species_param(cb, 'arabiensis', 'Larval_Habitat_Types', { "CONSTANT": 2000000.0, "TEMPORARY_RAINFALL": 100000000.0 }) set_species_param( cb, 'funestus', 'Larval_Habitat_Types', { "LINEAR_SPLINE": { "Capacity_Distribution_Per_Year": { "Times": [ 0.0, 30.417, 60.833, 91.25, 121.667, 152.083, 182.5, 212.917, 243.333, 273.75, 304.167, 334.583 ], "Values": [ 0.0, 0.0, 0.0, 0.2, 0.8, 1.0, 1.0, 1.0, 0.5, 0.2, 0.0, 0.0 ] }, "Max_Larval_Capacity": 100000000.0 }, "WATER_VEGETATION": 2000000.0 }) if immun_file: cb.update_params({'Demographics_Filenames': [demo_file, immun_file]}) else: cb.update_params({'Demographics_Filenames': [demo_file]}) if migrate: print "migration on!" cb.update_params({ # 'Vector_Sampling_Type': 'SAMPLE_IND_VECTORS', # individual vector model (required for vector migration) # 'Mosquito_Weight': 10, # 'Enable_Vector_Migration': 1, # mosquito migration # 'Enable_Vector_Migration_Local': 1, # migration rate hard-coded in NodeVector::processEmigratingVectors() such that 50% total leave a 1km x 1km square per day (evenly distributed among the eight adjacent grid cells). 'Migration_Model': 'FIXED_RATE_MIGRATION', 'Local_Migration_Filename': os.path.join( 'Migration/', exp_name + '_migration.bin' ), # note that underscore prior 'migration.bin' is required for legacy reasons that need to be refactored... 'Enable_Local_Migration': 1, 'Migration_Pattern': 'SINGLE_ROUND_TRIPS', # human migration 'Local_Migration_Roundtrip_Duration': 2, # mean of exponential days-at-destination distribution 'Local_Migration_Roundtrip_Probability': 0.95, # fraction that return }) else: print "migration off!!!" cb.update_params( {'Migration_Model': 'NO_MIGRATION'} ) #'NO_MIGRATION' is actually default for MALARIA_SIM, but might as well make sure it's off
def __call__(self, cb): return set_species_param(cb, self.species, self.param, self.value)
def basic_gridded_config_builder(immunity_params="prashanth"): cb = DTKConfigBuilder.from_defaults('MALARIA_SIM') # Reduce StdOut size and prevent DTK from spitting out too many messages cb.update_params({ "logLevel_default": "WARNING", "Enable_Log_Throttling": 1, "Memory_Usage_Warning_Threshold_Working_Set_MB": 50000, "Memory_Usage_Halting_Threshold_Working_Set_MB": 60000, "logLevel_JsonConfigurable": "WARNING", "Disable_IP_Whitelist": 1 }) cb.update_params(immunity.params) cb.update_params(infection.params) cb.update_params(symptoms.params) if immunity_params == 'prashanth': cb.update_params({ 'Antigen_Switch_Rate': pow(10, -9.116590124), 'Base_Gametocyte_Production_Rate': 0.06150582, 'Base_Gametocyte_Mosquito_Survival_Rate': 0.002011099, 'Falciparum_MSP_Variants': 32, 'Falciparum_Nonspecific_Types': 76, 'Falciparum_PfEMP1_Variants': 1070, 'Gametocyte_Stage_Survival_Rate': 0.588569307, 'MSP1_Merozoite_Kill_Fraction': 0.511735322, 'Max_Individual_Infections': 3, 'Nonspecific_Antigenicity_Factor': 0.415111634 }) elif immunity_params == "jaline": cb.update_params({ 'Base_Gametocyte_Production_Rate': 0.044, "Gametocyte_Stage_Survival_Rate": 0.82, 'Antigen_Switch_Rate': 2.96e-9, 'Falciparum_PfEMP1_Variants': 1112, 'Falciparum_MSP_Variants': 7, 'MSP1_Merozoite_Kill_Fraction': 0.43, 'Falciparum_Nonspecific_Types': 90, 'Nonspecific_Antigenicity_Factor': 0.42, 'Base_Gametocyte_Mosquito_Survival_Rate': 0.00088, "Max_Individual_Infections": 5 }) cb.update_params({ "Climate_Model": "CLIMATE_CONSTANT", "Base_Air_Temperature": 27, "Base_Land_Temperature": 27, "Migration_Model": "NO_MIGRATION", "Enable_Immunity_Distribution": 0, "Enable_Immunity_Initialization_Distribution": 0, "Immunity_Initialization_Distribution_Type": "DISTRIBUTION_OFF" }) cb.update_params({ "Enable_Demographics_Other": 1, "Enable_Demographics_Builtin": 0, "Valid_Intervention_States": [], "Report_Detection_Threshold_PfHRP2": 40.0, "Report_Detection_Threshold_Blood_Smear_Parasites": 0, "Parasite_Smear_Sensitivity": 0.025, "Birth_Rate_Dependence": "FIXED_BIRTH_RATE", # Match demographics file for constant population size (with exponential age distribution) "Enable_Nondisease_Mortality": 1, }) # Intervention events intervene_events_list = [ "Bednet_Got_New_One", "Bednet_Using", "Bednet_Discarded" ] cb.update_params({ "Report_Event_Recorder": 0, "Report_Event_Recorder_Ignore_Events_In_List": 0, "Listed_Events": intervene_events_list, "Report_Event_Recorder_Events": intervene_events_list }) # Basic entomology set_species_param(cb, 'arabiensis', 'Indoor_Feeding_Fraction', 0.5) set_species_param(cb, 'arabiensis', 'Adult_Life_Expectancy', 20) set_species_param(cb, 'arabiensis', 'Anthropophily', 0.65) set_species_param(cb, 'funestus', "Indoor_Feeding_Fraction", 0.9) set_species_param(cb, 'funestus', 'Adult_Life_Expectancy', 20) set_species_param(cb, 'funestus', 'Anthropophily', 0.65) return cb
def add_interventions_and_reports(cb,sim_time_dict): sim_start_year = sim_time_dict["sim_start_year"] sim_length_years = sim_time_dict["sim_length_years"] sim_filter_start_time = sim_time_dict["sim_filter_start_time"] sim_filter_duration = sim_time_dict["sim_filter_duration"] mozamb_exp.start_year = sim_start_year mozamb_exp.sim_length_years = sim_length_years mozamb_exp.implement_baseline_healthseeking(cb) mozamb_exp.implement_interventions(cb,True,True,False,True,True) all_nodes = list(mozamb_exp.desired_cells) cb.update_params({ 'x_Regional_Migration': 0.03, }) add_migration_event(cb, nodeto=100000, coverage=0.5, repetitions=500, tsteps_btwn=30, duration_of_stay=3, duration_before_leaving_distr_type='UNIFORM_DURATION', duration_before_leaving=0, duration_before_leaving_2=30, nodesfrom={'class': 'NodeSetNodeList', 'Node_List': all_nodes}, ind_property_restrictions=[{'TravelerStatus': 'IsTraveler'}]) #new entomology: # Arabiensis set_species_param(cb, 'arabiensis', 'Indoor_Feeding_Fraction', 0.5) set_species_param(cb, 'arabiensis', 'Adult_Life_Expectancy', 20) set_species_param(cb, 'arabiensis', 'Anthropophily', 0.65) # Funestus set_species_param(cb, 'funestus', "Indoor_Feeding_Fraction", 0.9) set_species_param(cb, 'funestus', 'Adult_Life_Expectancy', 20) set_species_param(cb, 'funestus', 'Anthropophily', 0.65) # Add specific reports that we want (have to do it here because we need to know what times to filter for): # Add filter report that has same length for both burn-in and non-burn-in runs (2010-2020). # This version is for grid-level prevalence comparison add_filtered_spatial_report(cb, start=sim_filter_start_time, end=(sim_filter_start_time+sim_filter_duration), # channels=['Population', 'New_Diagnostic_Prevalence']) channels=['Population', 'True_Prevalence']) # 'New_Clinical_Cases','New_Infections' # Add filter that has same length for both burn-in and non-burn-in runs (2010-2020) # This version is for HF-level incidence comparison. Add a similar report for the migration node add_filtered_report(cb, start=sim_filter_start_time, end=(sim_filter_start_time + sim_filter_duration), nodes=all_nodes) add_filtered_report(cb, start=sim_filter_start_time, end=(sim_filter_start_time + sim_filter_duration), nodes=[EIR_node_label], description='Work') # # Add filter report for prevalence in each bairro foo = bairro_df.groupby('bairro') for (bairro_num,df) in foo: add_filtered_report(cb, start=sim_filter_start_time, end=(sim_filter_start_time + sim_filter_duration), nodes=[int(x) for x in df['grid_cell'].values], description=str(int(bairro_num))) # Add counter report for clinical incidence add_event_counter_report(cb, event_trigger_list=['Received_Treatment', 'Received_IRS', 'Received_Campaign_Drugs', 'Received_RCD_Drugs', 'Bednet_Got_New_One', 'Received_Test'], start=sim_filter_start_time, duration=sim_filter_duration)
def set_magude_ento_params(cb, old_or_new): if old_or_new == "old": # set_species(cb, ["arabiensis", "funestus"]) set_species_param(cb, 'arabiensis', 'Indoor_Feeding_Fraction', 0.5) set_species_param(cb, 'arabiensis', 'Adult_Life_Expectancy', 20) set_species_param(cb, 'arabiensis', 'Anthropophily', 0.65) set_species_param(cb, 'arabiensis', 'Vector_Sugar_Feeding_Frequency', "VECTOR_SUGAR_FEEDING_NONE") set_species_param(cb, 'funestus', "Indoor_Feeding_Fraction", 0.9) set_species_param(cb, 'funestus', 'Adult_Life_Expectancy', 20) set_species_param(cb, 'funestus', 'Anthropophily', 0.65) set_species_param(cb, 'funestus', 'Vector_Sugar_Feeding_Frequency', "VECTOR_SUGAR_FEEDING_NONE") elif old_or_new == "new": # set_species(cb, ["arabiensis", "funestus"]) set_species_param(cb, 'arabiensis', 'Indoor_Feeding_Fraction', 0.95) set_species_param(cb, 'arabiensis', 'Adult_Life_Expectancy', 20) set_species_param(cb, 'arabiensis', 'Anthropophily', 0.65) set_species_param(cb, 'arabiensis', 'Vector_Sugar_Feeding_Frequency', "VECTOR_SUGAR_FEEDING_NONE") set_species_param(cb, 'funestus', "Indoor_Feeding_Fraction", 0.6) set_species_param(cb, 'funestus', 'Adult_Life_Expectancy', 20) set_species_param(cb, 'funestus', 'Anthropophily', 0.65) set_species_param(cb, 'funestus', 'Vector_Sugar_Feeding_Frequency', "VECTOR_SUGAR_FEEDING_NONE") else: return NotImplementedError return {"old_or_new_ento_params": old_or_new}
def add_magude_ento(cb): cb.update_params({'Vector_Species_Names': ['arabiensis', 'funestus']}) # Arabiensis set_species_param(cb, 'arabiensis', 'Larval_Habitat_Types', { "LINEAR_SPLINE": { "Capacity_Distribution_Number_Of_Years": 1, "Capacity_Distribution_Over_Time": { "Times": [0.0, 30.417, 60.833, 91.25, 121.667, 152.083, 182.5, 212.917, 243.333, 273.75, 304.167, 334.583], "Values": [1] * 12 }, "Max_Larval_Capacity": pow(10, 8.5) } }) # Funestus set_species_param(cb, 'funestus', 'Larval_Habitat_Types', { "WATER_VEGETATION": 2e3, "LINEAR_SPLINE": { "Capacity_Distribution_Number_Of_Years": 1, "Capacity_Distribution_Over_Time": { "Times": [0.0, 30.417, 60.833, 91.25, 121.667, 152.083, 182.5, 212.917, 243.333, 273.75, 304.167, 334.583], "Values": [1] * 12 }, "Max_Larval_Capacity": pow(10, 7.5) } }) # # def find_cells_for_this_catchment(catch, base='../../'): # # Find which grid cells correspond to a given HFCA # df = pd.read_csv(base + "data/mozambique/grid_lookup_with_neighborhood.csv") # # if catch == 'all': # return np.array(df['grid_cell']) # else: # df_catch = df[df['catchment'] == catch] # return np.array(df_catch['grid_cell']) # # # def find_pops_for_catch(catch, base='../../'): # cells = find_cells_for_this_catchment(catch, base=base) # # pop_df = pd.read_csv(base + "data/mozambique/grid_population") # # return np.array(pop_df[np.in1d(pop_df['node_label'] ,cells)]['pop']) # # # # def find_bairros_for_this_catchment(catch, base='../../'): # bairro_csv = base + "data/mozambique/grid_lookup_with_neighborhood.csv" # bairro_data = pd.read_csv(bairro_csv) # # return_data = bairro_data[bairro_data["catchment" ]== catch] # return return_data # # # # def catch_3_yr_spline(catch, species, dropbox_base="C:/Users/jsuresh/Dropbox (IDM)/Malaria Team Folder/projects/Mozambique/entomology_calibration/"): # # Read spline directly from mini-CSV files generated by Jaline/Caitlin # # def load_raw_spline(csv_df): # spline = np.zeros(36) # raw_spline = np.array(csv_df["Values"]) # spline[4:35] = raw_spline[1:-1] # Throw out first and last entry # return spline # # def fill_out_spline(spline): # spline[0:4] = 0.5 * (spline[12:16] + spline[24:28]) # spline[35] = 0.5 * (spline[11]+spline[23]) # return spline # # def fill_out_spline(spline): # # # Account for the fact that we only really trust the data from indices 4-35 (May 15 - Nov 17) # # # Reconstruct shape and amplitude of missing data by inferring from other # # year1_factor = spline[4:11].sum() # # year2_factor = spline[16:23].sum() # # year3_factor = spline[28:35].sum() # # # # spline_inferred = spline.copy() # # # # spline_inferred[0:4] = year1_factor * 0.5 * (spline[12:16] / year2_factor + spline[24:28] / year3_factor) # # spline_inferred[35] = year3_factor * 0.5 * (spline[11] / year1_factor + spline[23] / year2_factor) # # # # return spline_inferred # # # ento_base = dropbox_base + "Multi_year_calibration_by_HFCA_180404/best_180410/" # # ento_base = dropbox_base + "Multi_year_calibration_by_HFCA_180404/best_180409/" # # # # if species == "arabiensis": # species = "gambiae" # # # if species == "funestus": # df = pd.read_csv(ento_base + "funestus.csv") # spline = fill_out_spline(load_raw_spline(df)) # elif species == "gambiae": # if catch == "Panjane-Caputine": # df = pd.read_csv(ento_base + "{}_{}.csv".format("Panjane", species)) # spline = fill_out_spline(load_raw_spline(df)) # elif catch == "Magude-Sede-Facazissa": # df = pd.read_csv(ento_base + "{}_{}.csv".format("Magude-Sede", species)) # spline = fill_out_spline(load_raw_spline(df)) # elif catch != "Moine" and catch != "Mahel": # df = pd.read_csv(ento_base + "{}_{}.csv".format(catch, species)) # spline = fill_out_spline(load_raw_spline(df)) # elif catch == "Moine" or catch == "Mahel": # panjane_df = pd.read_csv(ento_base + "{}_{}.csv".format("Panjane", species)) # chichuco_df = pd.read_csv(ento_base + "{}_{}.csv".format("Chichuco", species)) # panjane_spline = fill_out_spline(load_raw_spline(panjane_df)) # chichuco_spline = fill_out_spline(load_raw_spline(chichuco_df)) # # spline = (panjane_spline + chichuco_spline)/2. # # # Return associated times: # times_1yr = np.array([0.0, 30.417, 60.833, 91.25, 121.667, 152.083, 182.5, 212.917, 243.333, 273.75, 304.167, 334.583]) # times = np.append(times_1yr, times_1yr + 365) # times = np.append(times, times_1yr + 365 * 2) # times = list(times) # # return [times, list(spline)] # # # # # # def catch_3_yr_spline_GatesReview(catch, species, dropbox_base="C:/Users/jsuresh/Dropbox (IDM)/Malaria Team Folder/projects/Mozambique/entomology_calibration/"): # # Read spline directly from mini-CSV files generated by Jaline/Caitlin # # def load_raw_spline(csv_df): # spline = np.zeros(36) # raw_spline = np.array(csv_df["Values"]) # spline[4:35] = raw_spline[1:-1] # Throw out first and last entry # return spline # # def fill_out_spline(spline): # spline[0:4] = 0.5 * (spline[12:16] + spline[24:28]) # spline[35] = 0.5 * (spline[11]+spline[23]) # return spline # # def fill_out_spline(spline): # # # Account for the fact that we only really trust the data from indices 4-35 (May 15 - Nov 17) # # # Reconstruct shape and amplitude of missing data by inferring from other # # year1_factor = spline[4:11].sum() # # year2_factor = spline[16:23].sum() # # year3_factor = spline[28:35].sum() # # # # spline_inferred = spline.copy() # # # # spline_inferred[0:4] = year1_factor * 0.5 * (spline[12:16] / year2_factor + spline[24:28] / year3_factor) # # spline_inferred[35] = year3_factor * 0.5 * (spline[11] / year1_factor + spline[23] / year2_factor) # # # # return spline_inferred # # # ento_base = dropbox_base + "Multi_year_calibration_by_HFCA_180404/best_180410/" # # ento_base = dropbox_base + "Multi_year_calibration_by_HFCA_180404/best_180409/" # # # # if species == "arabiensis": # species = "gambiae" # # # if species == "funestus": # df = pd.read_csv(ento_base + "funestus.csv") # spline = fill_out_spline(load_raw_spline(df)) # elif species == "gambiae": # if catch == "Panjane-Caputine": # df = pd.read_csv(ento_base + "{}_{}.csv".format("Panjane", species)) # spline = fill_out_spline(load_raw_spline(df)) # elif catch == "Magude-Sede-Facazissa": # df = pd.read_csv(ento_base + "{}_{}.csv".format("Magude-Sede", species)) # spline = fill_out_spline(load_raw_spline(df)) # elif catch != "Moine" and catch != "Mahel": # df = pd.read_csv(ento_base + "{}_{}.csv".format(catch, species)) # spline = fill_out_spline(load_raw_spline(df)) # elif catch == "Moine" or catch == "Mahel": # panjane_df = pd.read_csv(ento_base + "{}_{}.csv".format("Panjane", species)) # chichuco_df = pd.read_csv(ento_base + "{}_{}.csv".format("Chichuco", species)) # panjane_spline = fill_out_spline(load_raw_spline(panjane_df)) # chichuco_spline = fill_out_spline(load_raw_spline(chichuco_df)) # # spline = (panjane_spline + chichuco_spline)/2. # # # Return associated times: # times_1yr = np.array([0.0, 30.417, 60.833, 91.25, 121.667, 152.083, 182.5, 212.917, 243.333, 273.75, 304.167, 334.583]) # times = np.append(times_1yr, times_1yr + 365) # times = np.append(times, times_1yr + 365 * 2) # times = list(times) # # return [times, list(spline)]
def add_ento_to_cb(self): # Vector properties: self.cb.update_params( {'Vector_Species_Names': ['arabiensis', 'funestus']}) # Arabiensis set_species_param(self.cb, 'arabiensis', 'Indoor_Feeding_Fraction', 0.5) set_species_param(self.cb, 'arabiensis', 'Adult_Life_Expectancy', 20) set_species_param(self.cb, 'arabiensis', 'Anthropophily', 0.65) set_species_param( self.cb, 'arabiensis', 'Larval_Habitat_Types', { "LINEAR_SPLINE": { "Capacity_Distribution_Number_Of_Years": 1, "Capacity_Distribution_Over_Time": { # "Capacity_Distribution_Per_Year": { "Times": [ 0.0, 30.417, 60.833, 91.25, 121.667, 152.083, 182.5, 212.917, 243.333, 273.75, 304.167, 334.583 ], "Values": [1] * 12 # "Values": [0.0429944166751962, # 0.145106159922212, # 0.220520011001099, # 0.318489404300663, # 0.0617610600835594, # 0.0462380862878181, # 0.0367590381502996, # 0.02474944109524821, # 0.0300445801767523, # 0.021859890543704, # 0.0261404367939001, # 0.0253992634551118 # ] }, "Max_Larval_Capacity": pow(10, 8.42 ) # Uncertain-- this exponent is what we calibrate for } }) # Funestus set_species_param(self.cb, 'funestus', "Indoor_Feeding_Fraction", 0.9) set_species_param(self.cb, 'funestus', 'Adult_Life_Expectancy', 20) set_species_param(self.cb, 'funestus', 'Anthropophily', 0.65) set_species_param( self.cb, 'funestus', 'Larval_Habitat_Types', { "WATER_VEGETATION": 2e3, "LINEAR_SPLINE": { "Capacity_Distribution_Number_Of_Years": 1, "Capacity_Distribution_Over_Time": { # "Capacity_Distribution_Per_Year": { "Times": [ 0.0, 30.417, 60.833, 91.25, 121.667, 152.083, 182.5, 212.917, 243.333, 273.75, 304.167, 334.583 ], # Prashanth's new spline: stand-alone "Values": [1] * 12 # "Values": [0.00100058388478598, # 0.0555791772797765, # 0.0136439353956828, # 0.0819954534745384, # 0.0987507679669904, # 0.08541870494461, # 0.126723162372031, # 0.0847818298332663, # 0.249125024283648, # 0.105551476581602, # 0.0564097715821499, # 0.0423232369866486 # ] }, "Max_Larval_Capacity": pow( 10, 7.44 ) # Uncertain-- this exponent was what we calibrate for } })
return None if __name__ == "__main__": expname = 'vector_genetics_single_node_no_introgression' sim_duration = 365 * 10 num_seeds = 50 SetupParser('HPC') cb = DTKConfigBuilder.from_defaults('VECTOR_SIM') set_climate_constant(cb) set_species_param(cb, 'arabiensis', 'Larval_Habitat_Types', {"CONSTANT": 11250000000}) set_species_param(cb, 'arabiensis', 'Male_Life_Expectancy', 5) set_species_param(cb, 'arabiensis', 'Adult_Life_Expectancy', 10) set_species_param(cb, 'arabiensis', 'Transmission_Rate', 0.5) set_species_param(cb, 'arabiensis', 'Indoor_Feeding_Fraction', 1.0) set_species_param(cb, 'funestus', 'Larval_Habitat_Types', {"CONSTANT": 11250000000}) set_species_param(cb, 'funestus', 'Male_Life_Expectancy', 5) set_species_param(cb, 'funestus', 'Adult_Life_Expectancy', 10) set_species_param(cb, 'funestus', 'Transmission_Rate', 0.5) set_species_param(cb, 'funestus', 'Indoor_Feeding_Fraction', 1.0) ########################## VECTOR GENETICS #################################################### add_genes(cb)
from simtools.SetupParser import SetupParser if __name__ == "__main__": expname = 'vector_genetics_single_node' sim_duration = 365 * 6 num_seeds = 50 cb = DTKConfigBuilder.from_defaults('VECTOR_SIM') builder = GenericSweepBuilder.from_dict({'Run_Number': range(num_seeds)}) set_climate_constant(cb) set_species(cb, ['arabiensis']) set_species_param(cb, 'arabiensis', 'Larval_Habitat_Types', {"TEMPORARY_RAINFALL": 11250000000}) set_species_param(cb, 'arabiensis', 'Male_Life_Expectancy', 5) set_species_param(cb, 'arabiensis', 'Adult_Life_Expectancy', 10) set_species_param(cb, 'arabiensis', 'Transmission_Rate', 0.5) set_species_param(cb, 'arabiensis', 'Indoor_Feeding_Fraction', 1.0) ########################## VECTOR GENETICS #################################################### # Add genes genes = { 'arabiensis': [{ "Alleles": { "a0": 1.0, "a1": 0.0 }, "Mutations": { "a0:a1": 0.01,
def add_ento_to_cb(self): # Vector properties: self.cb.update_params({'Vector_Species_Names': ['arabiensis', 'funestus']}) # Arabiensis set_species_param(self.cb, 'arabiensis', 'Indoor_Feeding_Fraction', 0.5) set_species_param(self.cb, 'arabiensis', 'Adult_Life_Expectancy', 20) set_species_param(self.cb, 'arabiensis', 'Anthropophily', 0.65) set_species_param(self.cb, 'arabiensis', 'Larval_Habitat_Types', { "LINEAR_SPLINE": { "Capacity_Distribution_Number_Of_Years": 1, "Capacity_Distribution_Over_Time": { "Times": [0.0, 30.417, 60.833, 91.25, 121.667, 152.083, 182.5, 212.917, 243.333, 273.75, 304.167, 334.583], "Values": [1] * 12 }, "Max_Larval_Capacity": pow(10, 9.88) } }) # Funestus set_species_param(self.cb, 'funestus', "Indoor_Feeding_Fraction", 0.9) set_species_param(self.cb, 'funestus', 'Adult_Life_Expectancy', 20) set_species_param(self.cb, 'funestus', 'Anthropophily', 0.65) set_species_param(self.cb, 'funestus', 'Larval_Habitat_Types', { "WATER_VEGETATION": 2e3, "LINEAR_SPLINE": { "Capacity_Distribution_Number_Of_Years": 1, "Capacity_Distribution_Over_Time": { "Times": [0.0, 30.417, 60.833, 91.25, 121.667, 152.083, 182.5, 212.917, 243.333, 273.75, 304.167, 334.583], "Values": [1] * 12 }, "Max_Larval_Capacity": pow(10, 10.60) } })
def burnin_draw(old_or_new): cb.set_param("Serialized_Population_Filenames", ["state-18250.dtk"]) if old_or_new == "old": cb.set_param( "Serialized_Population_Path", "\\\\internal.idm.ctr\\IDM\\Home\\jsuresh\\output\\magude_burnins_ento_comparison_no__20210511_023616\\c44\\69a\\820\\c4469a82-01b2-eb11-a2e3-c4346bcb7275\\output" ) elif old_or_new == "new": cb.set_param( "Serialized_Population_Path", "\\\\internal.idm.ctr\\IDM\\Home\\jsuresh\\output\\magude_burnins_ento_comparison_no__20210511_023616\\c64\\69a\\820\\c6469a82-01b2-eb11-a2e3-c4346bcb7275\\output" ) # set ento if old_or_new == "old": set_species_param(cb, 'arabiensis', 'Indoor_Feeding_Fraction', 0.5) set_species_param(cb, 'arabiensis', 'Adult_Life_Expectancy', 20) set_species_param(cb, 'arabiensis', 'Anthropophily', 0.65) set_species_param(cb, 'arabiensis', 'Vector_Sugar_Feeding_Frequency', "VECTOR_SUGAR_FEEDING_NONE") set_species_param(cb, 'funestus', "Indoor_Feeding_Fraction", 0.9) set_species_param(cb, 'funestus', 'Adult_Life_Expectancy', 20) set_species_param(cb, 'funestus', 'Anthropophily', 0.65) set_species_param(cb, 'funestus', 'Vector_Sugar_Feeding_Frequency', "VECTOR_SUGAR_FEEDING_NONE") elif old_or_new == "new": set_species_param(cb, 'arabiensis', 'Indoor_Feeding_Fraction', 0.95) set_species_param(cb, 'arabiensis', 'Adult_Life_Expectancy', 20) set_species_param(cb, 'arabiensis', 'Anthropophily', 0.65) set_species_param(cb, 'arabiensis', 'Vector_Sugar_Feeding_Frequency', "VECTOR_SUGAR_FEEDING_NONE") set_species_param(cb, 'funestus', "Indoor_Feeding_Fraction", 0.6) set_species_param(cb, 'funestus', 'Adult_Life_Expectancy', 20) set_species_param(cb, 'funestus', 'Anthropophily', 0.65) set_species_param(cb, 'funestus', 'Vector_Sugar_Feeding_Frequency', "VECTOR_SUGAR_FEEDING_NONE")