def do_stuff():
    SetupParser.default_block = 'HPC'
    vec_cb = DTKConfigBuilder.from_defaults('VECTOR_SIM')
    configure_site(vec_cb, 'Namawala')
    exp_tags = {}
    exp_tags['role'] = 'serialization_test'
    exp_tags['model'] = 'vector'
    s_ts = [5, 25, 150]
    T = skt.SerializationKsTest(config_builder=vec_cb,
                                experiment_name='Vector serialization test',
                                experiment_tags=exp_tags,
                                timesteps_to_serialize=s_ts,
                                inset_channels=['Adult Vectors',
                                                'New Infections',
                                                'Infected',
                                                'Statistical Population',
                                                'Daily EIR'])
    T.run_test()
    def setUp(self):
        current_dir = os.path.dirname(os.path.realpath(__file__))
        input_dir = os.path.join(current_dir, 'input')
        self.am_simtools = os.path.join(input_dir, 'am_simtools.ini')

        # Adjust path sensitive parameters in the ini file
        cp = ConfigParser()
        cp.read(self.am_simtools)
        cp.set('DEFAULT', 'path', input_dir)
        cp.set('DEFAULT', 'example_dir',
               os.path.join(current_dir, '..', '..', 'examples'))
        cp.write(open(self.am_simtools, 'w'))

        SetupParser.init(selected_block=self.SELECTED_BLOCK,
                         setup_file=self.am_simtools)
        self.config_builder = DTKConfigBuilder.from_defaults('VECTOR_SIM')
        configure_site(self.config_builder, 'Namawala')
        self.config_builder.add_reports(BaseReport(type="VectorHabitatReport"))
from dtk.utils.core.DTKConfigBuilder import DTKConfigBuilder
from dtk.vector.study_sites import configure_site
from simtools.ExperimentManager.ExperimentManagerFactory import ExperimentManagerFactory
from simtools.SetupParser import SetupParser
from dtk.interventions.incidence_counter import add_incidence_counter
from dtk.interventions.irs import add_node_IRS
from malaria.reports.MalariaReport import add_event_counter_report  # you need to isntall the malaria package

# This block will be used unless overridden on the command-line
# this means that simtools.ini local block will be used
SetupParser.default_block = 'LOCAL'

cb = DTKConfigBuilder.from_defaults('VECTOR_SIM')
configure_site(cb, 'Namawala')

# event counter can help you keep track of events that are happening
add_event_counter_report(
    cb,
    ["HappyBirthday", "Party", "PartyHarder", "IRS_Blackout_Event_Trigger"])
# adding an incidence counter, which starts on day 20, and counts "Happy Birthday" events for 30 days. the default
# thresholds are 10 and 100 event counts and default events being sent out when the threshold is reached are Action1 and Action2
add_incidence_counter(
    cb,
    start_day=20,
    count_duration=30,
    count_triggers=['HappyBirthday'],
    threshold_type=
    'COUNT',  #this is the default, we can also look at % per eligible population
    thresholds=[13, 254],
    triggered_events=['Party', 'PartyHarder'])
Beispiel #4
0
from dtk.utils.core.DTKConfigBuilder import DTKConfigBuilder
from dtk.vector.study_sites import configure_site
from simtools.ExperimentManager.ExperimentManagerFactory import ExperimentManagerFactory
from simtools.SetupParser import SetupParser
from dtk.interventions.outbreakindividualdengue import add_OutbreakIndividualDengue

# This block will be used unless overridden on the command-line
SetupParser.default_block = 'HPC'

cb = DTKConfigBuilder.from_defaults('DENGUE_SIM')
configure_site(cb, 'Puerto_Rico')
cb.campaign["Campaign_Name"] = "Campaign - Outbreak"
add_OutbreakIndividualDengue(cb, 100, {'max': 1.725, 'min': 0}, 'Strain_1', [])
add_OutbreakIndividualDengue(cb, 5000, {}, 'Strain_2', [])
add_OutbreakIndividualDengue(cb, 5000, {}, 'Strain_3', [])
add_OutbreakIndividualDengue(cb, 5000, {}, 'Strain_4', [])

# cb.set_param('Simulation_Duration', 30*365)

run_sim_args = {
    'exp_name': 'ExampleSim',
    'config_builder': cb
}


if __name__ == "__main__":
    SetupParser.init()
    exp_manager = ExperimentManagerFactory.from_cb(config_builder=cb)
    exp_manager.run_simulations(**run_sim_args)
Beispiel #5
0
 def test_study_site(self):
     configure_site(self.cb,'Sinazongwe')
     self.assertEqual(os.path.basename(self.cb.get_param('Demographics_Filenames')[0]),'Zambia_Sinamalima_single_node_demographics.compiled.json')
Beispiel #6
0
from malaria.interventions.adherent_drug import add_adherent_drug
from malaria.interventions.adherent_drug import configure_adherent_drug


# you will need to install malaria package for use with dtk-tools:
# use > dtk get_package malaria -v HEAD

# This block will be used unless overridden on the command-line
# this means that simtools.ini local block will be used
# change this to 'LOCAL' to run it on just your machine.
#SetupParser('HPC')

cb = DTKConfigBuilder.from_defaults('MALARIA_SIM')
cb.update_params({"Genome_Markers": []})
cb.update_params({"Base_Population_Scale_Factor": 0.001}),
configure_site(cb, "Matsari")

# event counter can help you keep track of events that are happening that you're interested in.
add_event_counter_report(cb, ["Took_Dose", "NewClinicalCase"])

# run_sim_args is what the `dtk run` command will look for
run_sim_args =  {
    'exp_name': 'Matsari_Malaria_Adherence_Drug_Example',
    'config_builder': cb
}


# There are defaults for all the variables except the config_builder that gets passed in
# you could, if you wanted to, create this interventions with
# add_adherent_drug(cb)
# You'll want to define the configuration for the usage/waning of the drug separately and pass the whole thing
Beispiel #7
0
from dtk.utils.core.DTKConfigBuilder import DTKConfigBuilder
from dtk.vector.study_sites import configure_site
from simtools.ExperimentManager.ExperimentManagerFactory import ExperimentManagerFactory
from simtools.SetupParser import SetupParser
from simtools.ModBuilder import SingleSimulationBuilder
from dtk.generic import serialization
from os import path

# This block will be used unless overridden on the command-line
SetupParser.default_block = 'EXAMPLE'

cb_serializing = DTKConfigBuilder.from_defaults('VECTOR_SIM')
configure_site(cb_serializing, 'Namawala')

cb_reloading = DTKConfigBuilder.from_defaults('VECTOR_SIM')
configure_site(cb_reloading, 'Namawala')

if __name__ == "__main__":
    SetupParser.init()
    exp_manager = ExperimentManagerFactory.from_setup()

    timesteps_to_serialize = [5, 10, 50]
    old_simulation_duration = cb_serializing.params["Simulation_Duration"]
    serialized_last_timestep = timesteps_to_serialize[-1]
    serialization.add_SerializationTimesteps(config_builder=cb_serializing,
                                             timesteps=timesteps_to_serialize,
                                             end_at_final=True)

    serialized_builder = SingleSimulationBuilder()
    exp_manager.run_simulations(config_builder=cb_serializing,
                                exp_builder=serialized_builder,
Beispiel #8
0
from dtk.interventions.malaria_drug_campaigns import add_drug_campaign
from dtk.utils.builders.sweep import GenericSweepBuilder

from dtk.vector.input_EIR_by_site import configure_site_EIR
# HS means Health Seeking "coverage" parameter and not "seek" parameter
expname = 'newsmcexp09_vectorseir-burnin_smcSPA_0R_Sweep-Seek1.-Rate.0-Cov.3'
#First sim: expname = 'newsmcexp01_5yr_SPA_CM1.SEEK1.Rate1.CampStartDay230_4R_sweep'
#expname = 'newsmcexp01_5yr_SPA_CM0.SEEK0.Rate0.CampStartDay230_4R_sweep1'
#expname = 'newsmcexp03_50yrburnin_SPA_5yrsim_StartDay230_0R_Sweep'
#expname = '50yr-serial_burkina_site_vectors_03'

cb = DTKConfigBuilder.from_defaults('MALARIA_SIM')

#configure_site_EIR(cb, 'Dapelogo', birth_cohort = False)

configure_site(cb, 'Dapelogo')

cb.update_params({
    "Geography":
    "Burkina",
    #"Demographics_Filename": "Burkina/Burkina/Burkina Faso_Dapelogo_2.5arcmin_demographics.json",
    #"Air_Temperature_Filename": "Burkina/Burkina/fiveyear/Burkina Faso_Burkina Faso_2.5arcmin_air_temperature_daily.bin",
    #"Land_Temperature_Filename": "Burkina/Burkina/fiveyear/Burkina Faso_Burkina Faso_2.5arcmin_air_temperature_daily.bin",
    #"Rainfall_Filename": "Burkina/Burkina/fiveyear/Burkina Faso_Burkina Faso_2.5arcmin_rainfall_daily.bin",
    #"Relative_Humidity_Filename": "Burkina/Burkina/fiveyear/Burkina Faso_Burkina Faso_2.5arcmin_relative_humidity_daily.bin",
    "Enable_Climate_Stochasticity":
    0,
    "Simulation_Duration":
    365 * 1,
    "Vector_Species_Names": ["gambiae", "funestus"],
    #"Serialization_Time_Steps" : [50*365],