def test_generate_kpis(self): self.assertIn('recording.bag', os.listdir(ROOT_PATH),'recording.bag cannot be found') sim_eval = Evaluation(ROSBAG, RESULTS_DIR) sim_eval.compute_kpis() self.assertTrue(type(sim_eval.get_kpis()) == dict, 'KPIs structure is not a dictionary')
def test_store_kpis(self): self.assertIn('recording.bag', os.listdir(ROOT_PATH),'recording.bag cannot be found') sim_eval = Evaluation(ROSBAG, RESULTS_DIR) sim_eval.compute_kpis() sim_eval.save_kpis() self.assertIn('computed_kpis.yaml', os.listdir(RESULTS_DIR), 'KPIs were not stored in file computed_kpis.yaml') self.assertIn('kpi_labels.yaml', os.listdir(RESULTS_DIR), 'KPIs labels were not stored in file kpis_labels.yaml')
def test_generate_kpis(self): runner = SimulationRunner(PARAMS, TASK, RESULTS_DIR, True) runner.run(PARAMS) self.assertIn('recording.bag', os.listdir(runner.current_sim_results_dir),'recording.bag cannot be found') sim_eval = Evaluation(runner.recording_filename, runner.current_sim_results_dir) sim_eval.compute_kpis() self.assertTrue(type(sim_eval.get_kpis()) == dict, 'KPIs structure is not a dictionary')
def test_store_kpis(self): runner = SimulationRunner(PARAMS, TASK, RESULTS_DIR, True) runner.run(PARAMS) self.assertIn('recording.bag', os.listdir(runner.current_sim_results_dir),'recording.bag cannot be found') sim_eval = Evaluation(runner.recording_filename, runner.current_sim_results_dir) sim_eval.compute_kpis() sim_eval.save_kpis() self.assertIn('computed_kpis.yaml', os.listdir(runner.current_sim_results_dir), 'KPIs were not stored in file computed_kpis.yaml') self.assertIn('kpi_labels.yaml', os.listdir(runner.current_sim_results_dir), 'KPIs labels were not stored in file kpis_labels.yaml')
def test_store_images(self): self.assertIn('recording.bag', os.listdir(ROOT_PATH), 'recording.bag cannot be found') sim_eval = Evaluation(ROSBAG, RESULTS_DIR) sim_eval.compute_kpis() sim_eval.save_evaluation() pdf_files = list() for f in os.listdir(RESULTS_DIR): if '.pdf' in f: pdf_files.append(f)
def test_store_images(self): runner = SimulationRunner(PARAMS, TASK, RESULTS_DIR, True) runner.run(PARAMS) self.assertIn('recording.bag', os.listdir(runner.current_sim_results_dir),'recording.bag cannot be found') sim_eval = Evaluation(runner.recording_filename, runner.current_sim_results_dir) sim_eval.compute_kpis() sim_eval.save_evaluation() pdf_files = list() for f in os.listdir(runner.current_sim_results_dir): if '.pdf' in f: pdf_files.append(f) self.assertGreater(len(pdf_files), 0, 'PDF files were not generated')
record_all = False params = parse_input(args, opt_config['input_map']) if 'store_all_results' in opt_config: record_all = opt_config['store_all_results'] try: runner = SimulationRunner(params, task, results_dir, record_all) runner.run(params) sim_eval = Evaluation(runner.recording_filename, runner.current_sim_results_dir) output_path = deepcopy(runner.current_sim_results_dir) sim_eval.compute_kpis() if 'store_kpis_only' in opt_config: if opt_config['store_kpis_only']: sim_eval.save_kpis() else: sim_eval.save_evaluation() else: sim_eval.save_kpis() cost = 0.0 for tag in opt_config['cost_fcn']: cost += sim_eval.get_kpi(tag) * opt_config['cost_fcn'][tag] status = 'SUCCESS' output = dict(status=status, cost=float(cost))