Example #1
0
def prepare_malariatherapy_configbuilder(config_path,
                                         immunity_forcing=True,
                                         years=1):
    # Setup -------------------------------------------------------------------------------------------
    cb = DTKConfigBuilder.from_files(config_path)
    cb.update_params({
        'Vector_Species_Names': [],
        'Simulation_Duration':
        365 * years,
        'Demographics_Filenames': ['Malariatherapy_demographics.json']
    })
    set_climate_constant(cb)

    # Add source of infection (challenge bite or forced EIR) ------------------------------------------
    add_challenge_trial(cb, start_day=0)

    # ---- CUSTOM REPORTS ----
    add_patient_report(cb)
    return cb
 def __call__(self, cb):
     from malaria.reports.MalariaReport import add_patient_report
     return add_patient_report(cb)

# Setup -------------------------------------------------------------------------------------------
cb = DTKConfigBuilder.from_files(config_filename)
cb.update_params({
    'Vector_Species_Names': [],
    'Simulation_Duration': 365,
    'Demographics_Filenames': ['Malariatherapy_demographics.json']
})
set_climate_constant(cb)

# Add source of infection (challenge bite or forced EIR) ------------------------------------------
add_challenge_trial(cb, start_day=0)

# ---- CUSTOM REPORTS ----
add_patient_report(cb)
if debug:
    print(f"DEBUG: config builder created")

# Define analyzers, in this case, just the durations analyzer
# show=False will save plots show=True will save and display plots
analyzers = [DurationsAnalyzer(show=True)]

exp_builder = ''
if force_immunity:
    transition_matrix = cb.config['parameters'][
        'Parasite_Peak_Density_Probabilities']
    scale_factor_array = [2, 5, 10, 100]
    exp_builder = set_immune_forcing_builder(transition_matrix,
                                             scale_factor_array)
if debug: