Esempio n. 1
0
def application( output_folder="output", stdout_filename="test.txt",
                 config_filename="config.json",
                 report_name=sft.sft_output_filename,
                 debug=False):
    if debug:
        print "output_folder: " + output_folder
        print "stdout_filename: " + stdout_filename+ "\n"
        print "config_filename: " + config_filename + "\n"
        print "report_name: " + report_name + "\n"
        print "debug: " + str(debug) + "\n"

    sft.wait_for_done()
    param_obj = load_emod_parameters(config_filename,debug)
    output_obj = parse_output_file(stdout_filename, debug)
    multipliers = output_obj[matches[0]]
    infectiousness = output_obj[matches[1]]

    create_report_file(param_obj, multipliers, infectiousness, report_name, debug)
Esempio n. 2
0
def application( output_folder="output", stdout_filename="test.txt",
                 config_filename="config.json",
                 insetchart_name="InsetChart.json",
                 report_name=dtk_sft.sft_output_filename,
                 debug=False):
    if debug:
        print "output_folder: " + output_folder
        print "stdout_filename: " + stdout_filename+ "\n"
        print "config_filename: " + config_filename + "\n"
        print "insetchart_name: " + insetchart_name + "\n"
        print "report_name: " + report_name + "\n"
        print "debug: " + str(debug) + "\n"
    dtk_sft.wait_for_done()
    param_obj = isb_support.load_emod_parameters(config_filename)
    simulation_timestep = param_obj[KEY_SIMULATION_TIMESTEP]
    output_df = isb_support.parse_output_file(stdout_filename, simulation_timestep, debug)
    report_df = isb_support.parse_json_report(output_folder, insetchart_name, debug)
    isb_support.create_report_file(param_obj, output_df, report_df, report_name, debug)
Esempio n. 3
0
def application( output_folder="output", stdout_filename="test.txt",
                 config_filename="config.json",campaign_filename="campaign.json",
                 demographics_filename = "../../demographics.json",
                 propertyreport_name="PropertyReport.json",
                 report_name=sft.sft_output_filename,
                 debug=False):
    if debug:
        print "output_folder: " + output_folder
        print "stdout_filename: " + stdout_filename+ "\n"
        print "config_filename: " + config_filename + "\n"
        print "campaign_filename: " + campaign_filename + "\n"
        print "demographics_filename: " + demographics_filename + "\n"
        print "propertyreport_name: " + propertyreport_name + "\n"
        print "report_name: " + report_name + "\n"
        print "debug: " + str(debug) + "\n"

    sft.wait_for_done()
    report_data_obj = parse_json_report(output_folder, propertyreport_name, debug)
    create_report_file(report_data_obj, report_name, debug)
Esempio n. 4
0
def application( output_folder="output", stdout_filename="test.txt",
                 config_filename="config.json",campaign_filename="campaign.json",
                 demographics_filename = "demographics_100_overlay.json",
                 insetchart_name="InsetChart.json",
                 report_name=sft.sft_output_filename,
                 debug=False):
    if debug:
        print "output_folder: " + output_folder
        print "stdout_filename: " + stdout_filename+ "\n"
        print "config_filename: " + config_filename + "\n"
        print "campaign_filename: " + campaign_filename + "\n"
        print "demographics_filename: " + demographics_filename + "\n"
        print "insetchart_name: " + insetchart_name + "\n"
        print "report_name: " + report_name + "\n"
        print "debug: " + str(debug) + "\n"

    sft.wait_for_done()

    param_obj = ips.load_emod_parameters(config_filename, debug)
    campaign_obj =  ips.load_campaign_file(campaign_filename, debug)
    demographics_obj =  ips.load_demographics_file(demographics_filename, debug)
    report_data_obj =  ips.parse_json_report(output_folder, insetchart_name, debug)

    sft.plot_data_unsorted(report_data_obj[KEY_NEW_INFECTIONS],
                           title="new infections",
                           label1= "New Infections",
                           label2 = "NA",
                           xlabel="time steps", ylabel="new infection",
                           category = 'New_infections',
                           show = True )
    sft.plot_data_unsorted(report_data_obj[KEY_STATISTICAL_POPULATION],
                           title="Statistical Population",
                           label1= "Statistical Population",
                           label2 = "NA",
                           xlabel = "time steps", ylabel="Statistical Population",
                           category = 'Statistical_popupation',
                           show = True, line = True)

    ips.create_report_file(param_obj, campaign_obj, demographics_obj, report_data_obj, report_name, debug)
Esempio n. 5
0
def application(output_folder="output",
                stdout_filename="test.txt",
                config_filename="config.json",
                insetchart_name="InsetChart.json",
                report_name=dtk_sft.sft_output_filename,
                debug=False):
    if debug:
        print "output_folder: " + output_folder
        print "stdout_filename: " + stdout_filename + "\n"
        print "config_filename: " + config_filename + "\n"
        print "insetchart_name: " + insetchart_name + "\n"
        print "report_name: " + report_name + "\n"
        print "debug: " + str(debug) + "\n"
    dtk_sft.wait_for_done()
    param_obj = ISE_Support.load_emod_parameters(config_filename)
    simulation_timestep = param_obj[KEY_SIMULATION_TIMESTEP]
    if debug:
        print "simulation time step is : {0} days".format(simulation_timestep)
    output_df = ISE_Support.parse_output_file(stdout_filename,
                                              simulation_timestep, debug)
    report_df = ISE_Support.parse_json_report(output_folder, insetchart_name,
                                              debug)
    ISE_Support.create_report_file(param_obj, output_df, report_df,
                                   report_name, debug)
Esempio n. 6
0
def application(output_folder="output",
                stdout_filename="test.txt",
                config_filename="config.json",
                campaign_filename="campaign.json",
                demographics_filename="../../demographics.json",
                propertyreport_name="InsetChart.json",
                report_name=sft.sft_output_filename,
                debug=True):
    if debug:
        print "output_folder: " + output_folder
        print "stdout_filename: " + stdout_filename + "\n"
        print "config_filename: " + config_filename + "\n"
        print "campaign_filename: " + campaign_filename + "\n"
        print "demographics_filename: " + demographics_filename + "\n"
        print "propertyreport_name: " + propertyreport_name + "\n"
        print "report_name: " + report_name + "\n"
        print "debug: " + str(debug) + "\n"

    sft.wait_for_done()

    report_data_obj = parse_json_report(output_folder, propertyreport_name,
                                        debug)
    campaign_obj = load_campaign_file(campaign_filename, debug)
    create_report_file(campaign_obj, report_data_obj, report_name, debug)
Esempio n. 7
0
def application(output_folder="output",
                config_filename="config.json",
                jsonreport_name="InsetChart.json",
                stdout_filename="test.txt",
                report_name=sft.sft_output_filename,
                debug=False):
    if debug:
        print("output_folder: " + output_folder)
        print("config_filename: " + config_filename)
        print("insetchart_name: " + jsonreport_name)
        print("report_name: " + report_name)
        print("debug: " + str(debug))

    sft.wait_for_done()
    config_object = dtk_iis.load_config_file(config_filename=config_filename,
                                             debug=debug)
    demographics_overlay_name = config_object[
        dtk_iis.ConfigKeys.DEMOGRAPHIC_FILENAMES][-1]
    campaign_name = config_object[dtk_iis.ConfigKeys.CAMPAIGN_FILENAME]
    test_config_name = config_object[dtk_iis.ConfigKeys.CONFIG_NAME]

    campaign_object = dtk_iis.load_campaign_file(campaign_name, debug)
    outbreak_day = campaign_object[dtk_iis.CampaignKeys.START_DAY]

    demographics_object = dtk_iis.load_demographics_file(
        demographics_filename=demographics_overlay_name,
        immunity_initialization_type=config_object[
            dtk_iis.ConfigKeys.IMM_DIST_TYPE],
        debug=debug)
    average_immunity = demographics_object[
        dtk_iis.DemographicFileKeys.KEY_AVERAGE_IMMUNITY]

    sft.start_report_file(report_name, test_config_name)

    individual_df = dtk_iis.parse_stdout_file(stdout_filename, debug=debug)
    dtk_iis.test_immunity_within_age_range(individual_df,
                                           max_age=365,
                                           expected_immunity=0.0)
    dtk_iis.test_immunity_within_age_range(individual_df,
                                           max_age=730,
                                           expected_immunity=0.4)

    report_data_object = dtk_iis.parse_json_report(output_folder=output_folder,
                                                   report_name=jsonreport_name,
                                                   debug=debug)

    statistical_population_channel = report_data_object[
        dtk_iis.InsetChannels.STATISTICAL_POPULATION]
    new_infections_channel = report_data_object[
        dtk_iis.InsetChannels.NEW_INFECTIONS]

    expected_infections_obj = dtk_iis.get_expected_infections(
        statistical_population_channel,
        average_immunity,
        campaign_object,
        debug=debug)

    actual_infections = dtk_iis.get_actual_infections(new_infections_channel,
                                                      outbreak_day)

    dtk_iis.create_report_file(expected_infections_obj,
                               actual_infections,
                               outbreak_day,
                               report_name,
                               debug=debug)