def _configure_asfault() -> None: # asfault setup from asfault.config import init_configuration, load_configuration from tempfile import TemporaryDirectory temp_dir = TemporaryDirectory(prefix="testGenerator") init_configuration(temp_dir.name) load_configuration(temp_dir.name)
def process_results(exp_dir): l.info('Processing results in: %s', exp_dir) final_results = None config.load_configuration(exp_dir) config.rg.ensure_directories() results_file = config.rg.get_results_path() if os.path.exists(results_file): data = pd.read_csv(results_file, sep=';', quoting=csv.QUOTE_NONNUMERIC, names=experiments.CSV_HEADER) graph_oobs_over_gens(data, config.rg.get_oobs_gens_path()) props = get_exp_properties(data) props_file = 'props.json' props_file = os.path.join(exp_dir, props_file) with open(props_file, 'w') as out_file: out_file.write(json.dumps(props, indent=4, sort_keys=True)) execs_path = config.rg.get_execs_path() if os.path.exists(execs_path): oob_segs = defaultdict(int) oob_speeds = [] for root, _, files in os.walk(execs_path, topdown=True): for fil in files: fil = os.path.join(root, fil) with open(fil, 'r') as in_file: exec = json.loads(in_file.read()) exec = exec['execution'] if 'oob_speeds' in exec: oob_speeds.extend(exec['oob_speeds']) if 'seg_oob_count' in exec: seg_oob_count = exec['seg_oob_count'] for key, val in seg_oob_count.items(): oob_segs[key] += val oob_segs = process_oob_segs(oob_segs) graph_oob_segs(oob_segs, config.rg.get_oob_segs_path())
def read_environment(env_dir): l.info('Starting with environment from: %s', env_dir) config.load_configuration(env_dir)