| | import os |
| | import csv |
| | import argparse |
| | from natsort import natsorted |
| |
|
| | parser = argparse.ArgumentParser() |
| | parser.add_argument('--dir', type=str, default='./run-reg') |
| | parser.add_argument('--output', type=str, default='summary.csv') |
| | args = parser.parse_args() |
| |
|
| | |
| | directory_path = args.dir |
| | output_csv = args.output |
| |
|
| | |
| | with open(output_csv, mode='w', newline='') as file: |
| | writer = csv.writer(file) |
| |
|
| | |
| | writer.writerow(['Valid']) |
| | writer.writerow(['Run', 'MAE', 'RSE', 'PCC', 'KCC']) |
| |
|
| | |
| | for subdirectory in natsorted(os.listdir(directory_path)): |
| | subdirectory_path = os.path.join(directory_path, subdirectory) |
| | if os.path.isdir(subdirectory_path): |
| | result_file_path = os.path.join(subdirectory_path, 'result.txt') |
| | if os.path.isfile(result_file_path): |
| | with open(result_file_path, 'r') as result_file: |
| | lines = result_file.readlines() |
| | if len(lines) >= 3: |
| | means_5_6 = lines[1].strip().split(',') |
| | std_devs_5_6 = lines[2].strip().split(',') |
| | if len(means_5_6) == 4 and len(std_devs_5_6) == 4: |
| | values_5_6 = [f'{float(mean.strip()) * 100:.2f}$_{{\\pm{{{float(std_dev.strip()) * 100:.2f}}}}}$' |
| | for mean, std_dev in zip(means_5_6, std_devs_5_6)] |
| | writer.writerow([subdirectory] + values_5_6) |
| |
|
| | |
| | writer.writerow([]) |
| |
|
| | |
| | writer.writerow(['QLX']) |
| | writer.writerow(['Run', 'MAE', 'RSE', 'PCC', 'KCC']) |
| |
|
| | |
| | for subdirectory in natsorted(os.listdir(directory_path)): |
| | subdirectory_path = os.path.join(directory_path, subdirectory) |
| | if os.path.isdir(subdirectory_path): |
| | result_file_path = os.path.join(subdirectory_path, 'result.txt') |
| | if os.path.isfile(result_file_path): |
| | with open(result_file_path, 'r') as result_file: |
| | lines = result_file.readlines() |
| | if len(lines) >= 6: |
| | means_5_6 = lines[4].strip().split(',') |
| | std_devs_5_6 = lines[5].strip().split(',') |
| | if len(means_5_6) == 4 and len(std_devs_5_6) == 4: |
| | values_5_6 = [f'{float(mean.strip()) * 100:.2f}$_{{\\pm{{{float(std_dev.strip()) * 100:.2f}}}}}$' |
| | for mean, std_dev in zip(means_5_6, std_devs_5_6)] |
| | writer.writerow([subdirectory] + values_5_6) |
| |
|
| | |
| | |
| |
|
| | |
| | |
| | |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |