def test_wind_forecasts_ARMA_with_dates(self): """ This test will fail because the simulation date range is too small :return: """ print("Running ", str(self.id()).split('.')[2]) # here is the command : # python -m mape_maker "mape_maker/samples/wind_total_forecast_actual_070113_063015.csv" -st "forecasts" -n 2 -bp "ARMA" -o "wind_forecasts_ARMA" -is "2014-6-1 00:00:00" -ie "2014-6-30 00:00:00" -sd "2014-6-2 01:00:00" -ed "2014-6-29 00:00:00" -t 30 -s 1234 parm_dict = self._basic_dict() parm_dict["input_file"] = self.wind_data parm_dict["simulated_timeseries"] = "forecasts" parm_dict["number_simulations"] = 2 parm_dict["base-process"] = "ARMA" parm_dict["output_dir"] = "wind_forecasts_ARMA" parm_dict["simulation_start_dt"] = datetime(year=2014, month=6, day=2, hour=1, minute=0, second=0) parm_dict["simulation_end_dt"] = datetime(year=2014, month=6, day=29, hour=0, minute=0, second=0) parm_dict["input_start_dt"] = datetime(year=2014, month=6, day=1, hour=0, minute=0, second=0) parm_dict["input_end_dt"] = datetime(year=2014, month=6, day=30, hour=0, minute=0, second=0) parm_dict["target_mape"] = 30 parm_dict["seed"] = 1234 parm_list = list(parm_dict.values()) mapemain.main_func(*parm_list) # save the output dir to the sub temporary directory output_plot_path = self.temp_dir + dir_sep + "mmFinalFig.png" output_dir_path = self.temp_dir + dir_sep + parm_dict["output_dir"] sub_temp_dir = self.create_temp_dir() shutil.move(output_plot_path, sub_temp_dir) shutil.move(output_dir_path, sub_temp_dir)
def test_load_actuals_iid(self): print("Running ", str(self.id()).split('.')[2]) # python -m mape_maker "mape_maker/samples/based_rts_gmlc/Load_rts_gmlc_based/processed_file.csv" -st "actuals" -n 2 -bp "ARMA" -o "load_actuals_iid" -s 1234 parm_dict = self._base_dict() parm_dict["input_file"] = self.load_data parm_dict["simulated_timeseries"] = "actuals" parm_dict["number_simulations"] = 2 parm_dict["base-process"] = "ARMA" parm_dict["output_dir"] = "load_actuals_iid" parm_list = list(parm_dict.values()) # run the test mapemain.main_func(*parm_list) # add a new column to compare two simulations # step 1 : read the output file # step 2 : convert the output file into dataframe # step 3 : add a new column called "simulation_1_minus_2" # step 4 : save the new output file and create a graph to show the differences csv_path = self.temp_dir + dir_sep + parm_dict["output_dir"] + dir_sep + "*.csv" output_file = glob.glob(csv_path) df = pd.read_csv(output_file[0], index_col=0) df["simulation_1_minus_2"] = df["simulation_n_1"] - df["simulation_n_2"] df.index.name = 'dates' new_output_file_path = self.temp_dir + dir_sep + parm_dict["output_dir"] \ + dir_sep + "simulation_comparison.csv" plt.figure(1) plt.scatter(df.index, df["simulation_1_minus_2"], s=2) plt.xlabel("dates(from 2020-01 to 2020-12)") plt.ylabel("simulation differences") plot_path = self.temp_dir + dir_sep + parm_dict["output_dir"] \ + dir_sep + "plot" plt.savefig(plot_path) df.to_csv(new_output_file_path) # save the output dir to the sub temporary directory output_dir_path = self.temp_dir + dir_sep + parm_dict["output_dir"] shutil.move(output_dir_path, self.create_temp_dir())
def test_for_single_date_ranges(self): """ The user needs to set the input dates, otherwise the test will ends with errors :return: """ print("Running ", str(self.id()).split('.')[2]) parm_dict = self._basic_dict() parm_dict["input_file"] = self.wind_data parm_dict["simulated_timeseries"] = "actuals" parm_dict["base-process"] = "ARMA" parm_dict["simulation_start_dt"] = datetime(year=2014, month=6, day=1, hour=0, minute=0, second=0) parm_dict["simulation_end_dt"] = datetime(year=2014, month=6, day=30, hour=0, minute=0, second=0) parm_list = list(parm_dict.values()) # the function should get an error message with self.assertRaises(TypeError) as context: mapemain.main_func(*parm_list) self.assertTrue(isinstance(context, Iterable)) self.assertTrue("'<' not supported between instances of" " 'datetime.datetime' and 'NoneType'" in context)
def test_with_known_error(self): """ This test will fail because the simulation date range is too small :return: """ print("Running ", str(self.id()).split('.')[2]) # here is the command : # python -m mape_maker "mape_maker/samples/wind_total_forecast_actual_070113_063015.csv" -st "actuals" -n 2 -bp "ARMA" -o "wind_actuals_ARMA_1" -is "2014-6-1 00:00:00" -ie "2014-6-30 00:00:00" -sd "2014-6-27 01:00:00" -ed "2014-6-29 00:00:00" -s 1234 parm_dict = self._basic_dict() parm_dict["input_file"] = self.wind_data parm_dict["simulated_timeseries"] = "actuals" parm_dict["number_simulations"] = 2 parm_dict["base-process"] = "ARMA" parm_dict["output_dir"] = "wind_actuals_ARMA_1" parm_dict["simulation_start_dt"] = datetime(year=2014, month=6, day=27, hour=1, minute=0, second=0) parm_dict["simulation_end_dt"] = datetime(year=2014, month=6, day=29, hour=0, minute=0, second=0) parm_dict["input_start_dt"] = datetime(year=2014, month=6, day=1, hour=0, minute=0, second=0) parm_dict["input_end_dt"] = datetime(year=2014, month=6, day=30, hour=0, minute=0, second=0) parm_dict["seed"] = 1234 parm_list = list(parm_dict.values()) # the function should get an error message with self.assertRaises(TypeError) as context: mapemain.main_func(*parm_list) self.assertTrue(isinstance(context, Iterable)) self.assertTrue('cannot unpack non-iterable NoneType object' in context)
def test_wind_actuals_ARMA_with_dates(self): # here is the command : # python -m mape_maker "mape_maker/samples/wind_total_forecast_actual_070113_063015.csv" -st "actuals" -n 1 -bp "iid" -o "wind_actuals_iid" -is "2014-7-1 00:00:00" -ie "2014-8-1 00:00:00" -sd "2014-7-2 00:00:00" -ed "2014-7-31 00:00:00" -s 1234 parm_dict = self._basic_dict() parm_dict["input_file"] = self.wind_data parm_dict["simulated_timeseries"] = "actuals" parm_dict["base-process"] = "ARMA" parm_dict["input_start_dt"] = datetime(year=2014, month=7, day=1, hour=0, minute=0, second=0) parm_dict["input_end_dt"] = datetime(year=2014, month=8, day=1, hour=0, minute=0, second=0) parm_dict["simulation_start_dt"] = datetime(year=2014, month=7, day=2, hour=0, minute=0, second=0) parm_dict["simulation_end_dt"] = datetime(year=2014, month=7, day=31, hour=0, minute=0, second=0) parm_dict["seed"] = 1134 parm_list = list(parm_dict.values()) mapemain.main_func(*parm_list)
def test_load_actuals_ARMA(self): print("Running ", str(self.id()).split('.')[2]) # python -m mape_maker "mape_maker/samples/based_rts_gmlc/Load_rts_gmlc_based/processed_file.csv" -st "forecasts" -n 3 -bp "ARMA" -o "load_actuals_ARMA" -s 1234 parm_dict = self._base_dict() parm_dict["input_file"] = self.load_data parm_dict["simulated_timeseries"] = "forecasts" parm_dict["base-process"] = "ARMA" parm_dict["output_dir"] = "load_actuals_ARMA" parm_list = list(parm_dict.values()) # run the test mapemain.main_func(*parm_list) # save the output dir to the sub temporary directory output_dir_path = self.temp_dir + dir_sep + parm_dict["output_dir"] shutil.move(output_dir_path, self.create_temp_dir())
def test_wind_actuals_ARMA(self): print("Running ", str(self.id()).split('.')[2]) # here is the command : # python -m mape_maker "mape_maker/samples/wind_total_forecast_actual_070113_063015.csv" -st "actuals" -n 2 -bp "ARMA" -o "wind_actuals_ARMA_2" -s 1234 parm_dict = self._basic_dict() parm_dict["input_file"] = self.wind_data parm_dict["simulated_timeseries"] = "actuals" parm_dict["number_simulations"] = 2 parm_dict["base-process"] = "ARMA" parm_dict["output_dir"] = "wind_actuals_ARMA" parm_list = list(parm_dict.values()) mapemain.main_func(*parm_list) # save the output dir to the sub temporary directory output_plot_path = self.temp_dir + dir_sep + "mmFinalFig.png" output_dir_path = self.temp_dir + dir_sep + parm_dict["output_dir"] sub_temp_dir = self.create_temp_dir() shutil.move(output_plot_path, sub_temp_dir) shutil.move(output_dir_path, sub_temp_dir)
def test_input_and_simulation_dates(self): """ python -m mape_maker "mape_maker/samples/based_rts_gmlc/Load_rts_gmlc_based/processed_file.csv" -st "forecasts" -n 3 -is "2020-5-1 1:0:0" -ie "2020-7-30 0:0:0" -sd "2020-4-22 0:0:0" -ed "2020-6-29 23:0:0" -s 1234 This test is used to make sure if the simulation start date is earlier than the input start dates, then the code will throw some error messages. If MapeMaker raises an error, then this test will pass. """ print("Running ", str(self.id()).split('.')[2]) # initialize the parameters parm_dict = self._base_dict() parm_dict["input_file"] = self.load_data parm_dict["input_start_dt"] = datetime(year=2020, month=5, day=1, hour=1, minute=0, second=0) parm_dict["input_end_dt"] = datetime(year=2020, month=7, day=30, hour=0, minute=0, second=0) parm_dict["simulation_start_dt"] = datetime(year=2020, month=4, day=22, hour=0, minute=0, second=0) parm_dict["simulation_end_dt"] = datetime(year=2020, month=6, day=29, hour=23, minute=0, second=0) parm_list = list(parm_dict.values()) with self.assertRaises(RuntimeError) as context: mapemain.main_func(*parm_list) self.assertTrue(isinstance(context, Iterable)) self.assertTrue( 'Simulation must start after input start' in context)
def test_commmand(self): """ here is the command : python -m mape_maker "mape_maker/samples/based_rts_gmlc/Wind_rts_gmlc_based/processed_file.csv" -st "actuals" -s 1234 -n 5 -bp "ARMA" -o "wind_forecasts_actuals" -is "2020-2-1 00:00:00" -ie "2020-5-1 00:00:00" -sd "2020-2-2 00:00:00" -ed "2020-3-2 00:00:00" :return: """ print("Running ", str(self.id()).split('.')[2]) parm_dict = self._basic_dict() parm_dict["input_file"] = self.wind_data parm_dict["simulated_timeseries"] = "actuals" parm_dict["number_simulations"] = 5 parm_dict["base-process"] = "ARMA" parm_dict["output_dir"] = "wind_forecasts_actuals" parm_dict["seed"] = 1234 parm_dict["simulation_start_dt"] = datetime(year=2020, month=2, day=2, hour=0, minute=0, second=0) parm_dict["simulation_end_dt"] = datetime(year=2020, month=3, day=2, hour=0, minute=0, second=0) parm_dict["input_start_dt"] = datetime(year=2020, month=2, day=1, hour=0, minute=0, second=0) parm_dict["input_end_dt"] = datetime(year=2020, month=5, day=1, hour=0, minute=0, second=0) parm_list = list(parm_dict.values()) mapemain.main_func(*parm_list)
def test_compare_output_dirs_without_seed(self): """ In this test, we are going to compare the first and the last number in the output files to see whether it gives the same results without the given seed. If the first number and the last number in the two files are different, then this test will pass. """ print("Running ", str(self.id()).split('.')[2]) # initialize the parameters parm_dict = self._base_dict() parm_dict["input_file"] = self.load_data parm_dict["seed"] = None parm_dict["output_dir"] = "first_testing_folder" parm_list = list(parm_dict.values()) mapemain.main_func(*parm_list) output_dir_path1 = self.temp_dir + dir_sep + parm_dict["output_dir"] # get the first and last number f1, l1 = self.get_the_first_and_last_num(output_dir_path1) shutil.move(output_dir_path1, self.create_temp_dir()) # run the test again to get the second output directory parm_dict["output_dir"] = "second_testing_folder" parm_list = list(parm_dict.values()) mapemain.main_func(*parm_list) output_dir_path2 = self.temp_dir + dir_sep + parm_dict["output_dir"] # get the first and last number f2, l2 = self.get_the_first_and_last_num(output_dir_path2) shutil.move(output_dir_path2, self.create_temp_dir()) # check the first and last numbers if f1 == f2 and l1 == l2: print( "Error: If you don't set the seed, when you run the tests twice," " the numbers should be different") sys.exit(1) else: print("compare output dirs without seed test passed.")
def test_load_forecasts_iid_dates(self): print("Running ", str(self.id()).split('.')[2]) # python -m mape_maker "mape_maker/samples/based_rts_gmlc/Load_rts_gmlc_based/processed_file.csv" -st "forecasts" -n 2 -bp "iid" -is "2020-5-1 1:0:0" -ie "2020-7-30 0:0:0" -sd "2020-6-1 0:0:0" -ed "2020-6-30 23:0:0" -o "load_forecasts_iid" -s 1234 parm_dict = self._base_dict() parm_dict["input_file"] = self.load_data parm_dict["simulated_timeseries"] = "forecasts" parm_dict["number_simulations"] = 2 parm_dict["base-process"] = "iid" parm_dict["input_start_dt"] = datetime(year=2020, month=5, day=1, hour=1, minute=0, second=0) parm_dict["input_end_dt"] = datetime(year=2020, month=7, day=30, hour=0, minute=0, second=0) parm_dict["simulation_start_dt"] = datetime(year=2020, month=6, day=1, hour=0, minute=0, second=0) parm_dict["simulation_end_dt"] = datetime(year=2020, month=6, day=30, hour=23, minute=0, second=0) parm_dict["output_dir"] = "load_forecasts_iid" parm_list = list(parm_dict.values()) # run the test mapemain.main_func(*parm_list) # save the output dir to the sub temporary directory output_dir_path = self.temp_dir + dir_sep + parm_dict["output_dir"] shutil.move(output_dir_path, self.create_temp_dir())
def test_simulation_and_input_dates(self): """ python -m mape_maker "mape_maker/samples/wind_total_forecast_actual_070113_063015.csv" -is "2014-6-2 00:00:00" -ie "2014-6-30 00:00:00" -sd "2014-6-1 01:00:00" -ed "2014-6-30 00:00:00" This test is used to make sure if the simulation start date is earlier than the input start dates, then the code will throw some error messages. :return: """ print("Running ", str(self.id()).split('.')[2]) # initialize the parameters parm_dict = self._basic_dict() parm_dict["input_file"] = self.wind_data parm_dict["simulation_start_dt"] = datetime(year=2014, month=6, day=1, hour=1, minute=0, second=0) parm_dict["simulation_end_dt"] = datetime(year=2014, month=6, day=30, hour=0, minute=0, second=0) parm_dict["input_start_dt"] = datetime(year=2014, month=6, day=2, hour=0, minute=0, second=0) parm_dict["input_end_dt"] = datetime(year=2014, month=6, day=30, hour=0, minute=0, second=0) parm_list = list(parm_dict.values()) # the function should get an error message with self.assertRaises(RuntimeError) as context: mapemain.main_func(*parm_list) self.assertTrue(isinstance(context, Iterable)) self.assertTrue("Simulation must start after input start" in context)
def test_output_dirs_with_seed(self): """ In this test, we are going to compare the first and the last number in the output files to see whether it gives the same results with the given seed. :return: boolean """ print("Running ", str(self.id()).split('.')[2]) # initialize the parameters parm_dict = self._basic_dict() parm_dict["seed"] = 1234 parm_dict["input_file"] = self.wind_data parm_dict["number_simulations"] = 2 parm_dict["output_dir"] = "first_testing_folder_with_seed" parm_list = list(parm_dict.values()) mapemain.main_func(*parm_list) output_plot_path1 = self.temp_dir + dir_sep + "mmFinalFig.png" output_dir_path1 = self.temp_dir + dir_sep + parm_dict["output_dir"] # get the first and last number l1 = self.get_the_first_and_last_num(output_dir_path1) sub_temp_dir1 = self.create_temp_dir() shutil.move(output_plot_path1, sub_temp_dir1) shutil.move(output_dir_path1, sub_temp_dir1) # run the test again to get the second output directory parm_dict["output_dir"] = "second_testing_folder_with_seed" parm_list = list(parm_dict.values()) mapemain.main_func(*parm_list) output_plot_path2 = self.temp_dir + dir_sep + "mmFinalFig.png" output_dir_path2 = self.temp_dir + dir_sep + parm_dict["output_dir"] # get the first and last number l2 = self.get_the_first_and_last_num(output_dir_path2) sub_temp_dir2 = self.create_temp_dir() shutil.move(output_plot_path2, sub_temp_dir2) shutil.move(output_dir_path2, sub_temp_dir2) # check the first and last numbers if l1 != l2: print("If you set the seed, when you run the tests twice," " the numbers should be the same") sys.exit(1)
def test_wind_actuals_iid_with_dates(self): print("Running ", str(self.id()).split('.')[2]) # here is the command : # python -m mape_maker "mape_maker/samples/wind_total_forecast_actual_070113_063015.csv" -st "actuals" -n 2 -bp "iid" -o "wind_actuals_iid" -is "2014-7-1 00:00:00" -ie "2014-8-1 00:00:00" -sd "2014-7-2 00:00:00" -ed "2014-7-31 00:00:00" -s 1234 parm_dict = self._basic_dict() parm_dict["input_file"] = self.wind_data parm_dict["simulated_timeseries"] = "actuals" parm_dict["number_simulations"] = 2 parm_dict["base-process"] = "iid" parm_dict["input_start_dt"] = datetime(year=2014, month=7, day=1, hour=0, minute=0, second=0) parm_dict["input_end_dt"] = datetime(year=2014, month=8, day=1, hour=0, minute=0, second=0) parm_dict["simulation_start_dt"] = datetime(year=2014, month=7, day=2, hour=0, minute=0, second=0) parm_dict["simulation_end_dt"] = datetime(year=2014, month=7, day=31, hour=0, minute=0, second=0) parm_dict["output_dir"] = "wind_actuals_iid" parm_dict["seed"] = 1234 parm_list = list(parm_dict.values()) mapemain.main_func(*parm_list) # save the output dir to the sub temporary directory output_plot_path = self.temp_dir + dir_sep + "mmFinalFig.png" output_dir_path = self.temp_dir + dir_sep + parm_dict["output_dir"] sub_temp_dir = self.create_temp_dir() shutil.move(output_plot_path, sub_temp_dir) shutil.move(output_dir_path, sub_temp_dir)
def test_Bus_220_load(self): print("Running ", str(self.id()).split('.')[2]) # python -m mape_maker "test/rts_data/prescient_rts_gmlc/timeseries_data_files_noerror/Bus_220_Load_zone2_forecasts_actuals.csv" -st "actuals" -n 5 -bp "ARMA" -is "2020-1-10 0:0:0" -ie "2020-7-20 0:0:0" -sd "2020-6-1 0:0:0" -ed "2020-6-30 23:0:0" -o "Bus_220_load" -s 1234 parm_dict = self._base_dict() parm_dict["input_file"] = self.load_data parm_dict["simulated_timeseries"] = "actuals" parm_dict["number_simulations"] = 5 parm_dict["base-process"] = "ARMA" parm_dict["input_start_dt"] = datetime(year=2020, month=1, day=10, hour=0, minute=0, second=0) parm_dict["input_end_dt"] = datetime(year=2020, month=7, day=20, hour=0, minute=0, second=0) parm_dict["simulation_start_dt"] = datetime(year=2020, month=6, day=1, hour=0, minute=0, second=0) parm_dict["simulation_end_dt"] = datetime(year=2020, month=6, day=30, hour=23, minute=0, second=0) parm_dict["output_dir"] = "Bus_220_load" parm_list = list(parm_dict.values()) # run the test mapemain.main_func(*parm_list)
def test_load_actuals_ARMA_dates(self): print("Running ", str(self.id()).split('.')[2]) # python -m mape_maker "mape_maker/samples/based_rts_gmlc/Load_rts_gmlc_based/processed_file.csv" -st "actuals" -n 2 -bp "ARMA" -is "2020-1-1 1:0:0" -ie "2020-3-30 0:0:0" -sd "2020-2-10 0:0:0" -ed "2020-2-30 23:0:0"-o "load_actuals_iid_dates" -s 1234 parm_dict = self._base_dict() parm_dict["input_file"] = self.load_data parm_dict["simulated_timeseries"] = "actuals" parm_dict["number_simulations"] = 2 parm_dict["base-process"] = "ARMA" parm_dict["input_start_dt"] = datetime(year=2020, month=1, day=1, hour=1, minute=0, second=0) parm_dict["input_end_dt"] = datetime(year=2020, month=3, day=30, hour=0, minute=0, second=0) parm_dict["simulation_start_dt"] = datetime(year=2020, month=2, day=10, hour=0, minute=0, second=0) parm_dict["simulation_end_dt"] = datetime(year=2020, month=2, day=28, hour=23, minute=0, second=0) parm_dict["output_dir"] = "load_actuals_iid_dates" parm_list = list(parm_dict.values()) # run the test mapemain.main_func(*parm_list) # save the output dir to the sub temporary directory output_dir_path = self.temp_dir + dir_sep + parm_dict["output_dir"] print("output_dir_path = ", output_dir_path) print("parm_dict[output_dir]", parm_dict["output_dir"]) temp_sub_dir = self.create_temp_dir() print("Created temp_sub_dir = ", temp_sub_dir) shutil.move(output_dir_path, temp_sub_dir)
def main(input_file, capacity_file, target_mape, simulated_timeseries, base_process, a, output_dir, number_simulations, input_start_dt, input_end_dt, simulation_start_dt, simulation_end_dt, title, seed, load_pickle, curvature, time_limit, curvature_target, mip_gap, solver, latex_output, show, verbosity, verbosity_output): # convert MW into percentage of capacity compute_capacity_percentage(input_file, capacity_file) # call the mape_maker main function to generate the simulations mare_embedder = mapemain.main_func(input_file, target_mape, simulated_timeseries, base_process, a, output_dir, number_simulations, input_start_dt, input_end_dt, simulation_start_dt, simulation_end_dt, title, seed, load_pickle, curvature, time_limit, curvature_target, mip_gap, solver, latex_output, show, verbosity, verbosity_output) t = mare_embedder.r_tilde * 100 # convert the simulation file back into MW mw_df = compute_megawatt(capacity_file, output_dir) # reset plt plt.clf() plot_megawatt_simulation(mw_df, input_file, "", round(100 * t, 2), simulated_timeseries)
def test_wind_actuals_iid_with_dates(self): print("Running ", str(self.id()).split('.')[2]) # here is the command : # python -m mape_maker "mape_maker/samples/wind_total_forecast_actual_070113_063015.csv" -st "actuals" -n 3 -bp "iid" -o "wind_actuals_iid" -is "2014-7-1 00:00:00" -ie "2014-8-1 00:00:00" -sd "2014-7-2 00:00:00" -ed "2014-7-31 00:00:00" -s 1234 parm_dict = self._basic_dict() parm_dict["input_file"] = self.wind_data parm_dict["simulated_timeseries"] = "actuals" parm_dict["number_simulations"] = 3 parm_dict["base-process"] = "iid" parm_dict["input_start_dt"] = datetime(year=2014, month=7, day=1, hour=0, minute=0, second=0) parm_dict["input_end_dt"] = datetime(year=2014, month=8, day=1, hour=0, minute=0, second=0) parm_dict["simulation_start_dt"] = datetime(year=2014, month=7, day=2, hour=0, minute=0, second=0) parm_dict["simulation_end_dt"] = datetime(year=2014, month=7, day=31, hour=0, minute=0, second=0) parm_dict["output_dir"] = "wind_actuals_iid" parm_dict["seed"] = 1234 parm_list = list(parm_dict.values()) mapemain.main_func(*parm_list) # add a new column to compare two simulations # step 1 : read the output file # step 2 : convert the output file into dataframe # step 3 : add a new column called "simulation_1_minus_2" # step 4 : save the new output file and create a graph to show the differences csv_path = self.temp_dir + dir_sep + parm_dict[ "output_dir"] + dir_sep + "*.csv" output_file = glob.glob(csv_path) df = pd.read_csv(output_file[0], index_col=0) df["simulation_1_minus_2"] = df["simulation_n_1"] - df["simulation_n_2"] df.index.name = 'dates' new_output_file_path = self.temp_dir + dir_sep + parm_dict["output_dir"] \ + dir_sep + "simulation_comparison.csv" plt.figure(1) plt.scatter(df.index, df["simulation_1_minus_2"], s=2) plt.xlabel("dates") plt.ylabel("simulation differences") plot_path = self.temp_dir + dir_sep + parm_dict["output_dir"] \ + dir_sep + "plot" plt.savefig(plot_path) df.to_csv(new_output_file_path) # save the output dir to the sub temporary directory output_dir_path = self.temp_dir + dir_sep + parm_dict["output_dir"] shutil.move(output_dir_path, self.create_temp_dir())