def application(output_folder="output", stdout_filename="test.txt", config_filename="config.json", property_report_name="PropertyReportEnvironmental.json", report_name=sft.sft_output_filename, debug=False): if debug: print("output_folder: " + output_folder) print("stdout_filename: " + stdout_filename + "\n") print("property_report_name: " + property_report_name + "\n") print("config_filename: " + config_filename + "\n") print("report_name: " + report_name + "\n") print("debug: " + str(debug) + "\n") sft.wait_for_done(stdout_filename) config_obj = General_Support.load_config_parameters( config_filename, config_keys, debug) stdout_df = parse_stdout_file(stdout_filename, config_obj[ConfigKeys.Simulation_Timestep], debug) demo_path = "Assets" if stdout_filename == "StdOut.txt" else "" property_list = HINT_Support.load_demo_mr_overlay_file( config_obj[ConfigKeys.Demographics_Filenames][-1], demo_path, debug) property_keys = HINT_Support.build_channel_string_for_property( property_list, channels, debug) property_df = HINT_Support.parse_property_report_json( property_report_name, output_folder, property_keys, debug) property_obj = property_list[0] # this test only has one property object create_report_file(config_obj, stdout_df, property_obj, property_df, report_name, debug)
def application( output_folder="output", stdout_filename="test.txt", property_report_name="PropertyReportEnvironmental.json", report_event_recorder="ReportNodeEventRecorder.csv", config_filename="config.json", campaign_filename="campaign.json", report_name=sft.sft_output_filename, debug=False): if debug: print("output_folder: " + output_folder) print("stdout_filename: " + stdout_filename+ "\n") print("property_report_name: " + property_report_name+ "\n") print("report_event_recorder: " + report_event_recorder+ "\n") print("config_filename: " + config_filename + "\n") print("campaign_filename: " + campaign_filename + "\n") print("report_name: " + report_name + "\n") print("debug: " + str(debug) + "\n") sft.wait_for_done(stdout_filename) config_obj = General_Support.load_config_parameters(config_filename, Diagnostic_Support.config_keys, debug) demo_overlay_file = config_obj[ConfigKeys.Demographics_Filenames][-1] campaign_obj = Diagnostic_Support.load_campaign_file(campaign_filename, debug) demo_path = "Assets" if stdout_filename == "StdOut.txt" else "" property_obj = HINT_Support.load_demo_mr_overlay_file(demo_overlay_file, demo_path, debug)[0] ip_key_value = campaign_obj[CampaignKeys.EnvironmentalDiagnosticKeys.Environment_IP_Key_Value] property_keys = [] for channel in Diagnostic_Support.channels: property_keys.append("{0}:{1}".format(channel, ip_key_value)) property_df = HINT_Support.parse_property_report_json(property_report_name, output_folder, property_keys, debug) stdout_df = Diagnostic_Support.parse_stdout_file(stdout_filename, config_obj[ConfigKeys.Simulation_Timestep], debug) recorder_obj = Diagnostic_Support.parse_report_event_recorder(output_folder, report_event_recorder, debug) create_report_file(config_obj, campaign_obj, property_obj, property_df, stdout_df, recorder_obj, report_name, report_event_recorder, stdout_filename, debug)
def application( output_folder="output", stdout_filename="test.txt", config_filename="config.json", property_report_name="PropertyReportEnvironmental.json", report_name=sft.sft_output_filename, debug=False): if debug: print("output_folder: " + output_folder) print("stdout_filename: " + stdout_filename+ "\n") print("property_report_name: " + property_report_name+ "\n") print("config_filename: " + config_filename + "\n") print("report_name: " + report_name + "\n") print("debug: " + str(debug) + "\n") sft.wait_for_done(stdout_filename) config_obj = General_Support.load_config_parameters(config_filename, config_keys, debug) stdout_df = parse_stdout_file(stdout_filename, config_obj[ConfigKeys.Simulation_Timestep], debug) demo_path = "Assets" if stdout_filename == "StdOut.txt" else "" property_list = HINT_Support.load_demo_mr_overlay_file( config_obj[ConfigKeys.Demographics_Filenames][-1], demo_path, debug) property_keys = HINT_Support.build_channel_string_for_property(property_list, channels, debug) property_df = HINT_Support.parse_property_report_json(property_report_name, output_folder, property_keys, debug) property_obj = property_list[0] # this test only has one property object create_report_file(config_obj, stdout_df, property_obj, property_df, report_name, debug)
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(stdout_filename) config_obj = General_Support.load_config_parameters(config_filename, config_keys, debug) stdout_df = parse_stdout_file(stdout_filename, config_obj[ConfigKeys.Simulation_Timestep], debug) create_report_file(config_obj, stdout_df, report_name, debug)
def application(output_folder="output", stdout_filename="test.txt", property_report_name="PropertyReportEnvironmental.json", report_event_recorder="ReportNodeEventRecorder.csv", config_filename="config.json", campaign_filename="campaign.json", report_name=sft.sft_output_filename, debug=False): if debug: print("output_folder: " + output_folder) print("stdout_filename: " + stdout_filename + "\n") print("property_report_name: " + property_report_name + "\n") print("report_event_recorder: " + report_event_recorder + "\n") print("config_filename: " + config_filename + "\n") print("campaign_filename: " + campaign_filename + "\n") print("report_name: " + report_name + "\n") print("debug: " + str(debug) + "\n") sft.wait_for_done(stdout_filename) config_obj = General_Support.load_config_parameters( config_filename, Diagnostic_Support.config_keys, debug) demo_overlay_file = config_obj[ConfigKeys.Demographics_Filenames][-1] campaign_obj = Diagnostic_Support.load_campaign_file( campaign_filename, debug) demo_path = "Assets" if stdout_filename == "StdOut.txt" else "" property_obj = HINT_Support.load_demo_mr_overlay_file( demo_overlay_file, demo_path, debug)[0] ip_key_value = campaign_obj[ CampaignKeys.EnvironmentalDiagnosticKeys.Environment_IP_Key_Value] property_keys = [] for channel in Diagnostic_Support.channels: property_keys.append("{0}:{1}".format(channel, ip_key_value)) property_df = HINT_Support.parse_property_report_json( property_report_name, output_folder, property_keys, debug) stdout_df = Diagnostic_Support.parse_stdout_file( stdout_filename, config_obj[ConfigKeys.Simulation_Timestep], debug) recorder_obj = Diagnostic_Support.parse_report_event_recorder( output_folder, report_event_recorder, debug) create_report_file(config_obj, campaign_obj, property_obj, property_df, stdout_df, recorder_obj, report_name, report_event_recorder, stdout_filename, debug)
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(stdout_filename) config_obj = General_Support.load_config_parameters( config_filename, config_keys, debug) stdout_df = parse_stdout_file(stdout_filename, config_obj[ConfigKeys.Simulation_Timestep], debug) create_report_file(config_obj, stdout_df, report_name, debug)
def application( output_folder="output", stdout_filename="test.txt", report_event_recorder="ReportNodeEventRecorder.csv", config_filename="config.json", campaign_filename="campaign.json", report_name=sft.sft_output_filename, debug=False): if debug: print("output_folder: " + output_folder) print("stdout_filename: " + stdout_filename+ "\n") print("report_event_recorder: " + report_event_recorder+ "\n") print("config_filename: " + config_filename + "\n") print("campaign_filename: " + campaign_filename + "\n") print("report_name: " + report_name + "\n") print("debug: " + str(debug) + "\n") sft.wait_for_done(stdout_filename) config_obj = General_Support.load_config_parameters(config_filename, Diagnostic_Support.config_keys, debug) campaign_obj = Diagnostic_Support.load_campaign_file(campaign_filename, debug) stdout_df = Diagnostic_Support.parse_stdout_file(stdout_filename, config_obj[ConfigKeys.Simulation_Timestep], debug) recorder_obj = Diagnostic_Support.parse_report_event_recorder(output_folder, report_event_recorder, debug) create_report_file(config_obj, campaign_obj, stdout_df, recorder_obj, report_name, report_event_recorder, debug)
def create_report_file(self, attenuation, inset_chart_obj, report_name, debug): # contagion trails attenuation by one day. Attenuation changes to 0, next day contagion should be 0 success = True config_name = General_Support.load_config_parameters( keys=[General_Support.ConfigKeys.Config_Name])[ General_Support.ConfigKeys.Config_Name] with open(report_name, "w") as report_file: report_file.write("Results for {}:\n".format(config_name)) if not inset_chart_obj: success = False report_file.write( "BAD: Not finding any data from inset chart.\n") elif not attenuation: # make sure we have found the correct debug data success = False report_file.write( "BAD: Couldn't find current_exposures_attenuation_{} ." "\n".format(self.route)) else: new_infections = inset_chart_obj[self.chart_channels[0]] if len(attenuation) + 1 != len(new_infections): success = False err_template = "BAD: Length difference between {2} attenuation: {0} new infections {2}: {1}\n" report_file.write( err_template.format(len(attenuation), len(new_infections), self.route)) else: for i in range(len(attenuation)): # when the exposures attenuation is set to 0, there should be no new infections (the next day) if attenuation[i] == 0 and new_infections[i + 1] != 0: success = False report_file.write( "BAD: At time {0}: the {1} is {2} from Stdout, " "while the contagion is {3} from InsetChart.json.\n" .format(i + 1, self.attenuation_text, attenuation[i], new_infections[i + 1])) # mapping all the large contagion #s to 1s for better viewing of attenuation data for i in range(0, len(new_infections)): if new_infections[i] > 1: new_infections[i] = 1 # showing relevant subset sft.plot_data( attenuation, new_infections[1:], label1="Attenuation", label2="New Infections {}".format(self.route), title="Vaccine Linear Exposures {}\n" "(when attenuation is 0, New Infections should be " "0)".format(self.route), xlabel="Time", ylabel="", category='vaccine_linear_exposures_{}'.format( self.route), overlap=False, alpha=0.5) if success: report_file.write( "GOOD: When Attenuation of {} exposures is set to 0, there are no new infections." "\n".format(self.route)) report_file.write(sft.format_success_msg(success))