-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathauto_extract.py
47 lines (30 loc) · 1004 Bytes
/
auto_extract.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# -*- coding: utf-8 -*-
import os
import argparse
import pcode.utils.op_files as op_files
from pcode.tools.show_results import load_raw_info_from_experiments
"""parse and define arguments for different tasks."""
def get_args():
# feed them to the parser.
parser = argparse.ArgumentParser(description='Extract results.')
# add arguments.
parser.add_argument('--in_dir', type=str)
parser.add_argument('--out_name', type=str, default='summary.pickle')
# parse aˇˇrgs.
args = parser.parse_args()
# an argument safety check.
check_args(args)
return args
def check_args(args):
assert args.in_dir is not None
# define out path.
args.out_path = os.path.join(args.in_dir, args.out_name)
"""write the results to path."""
def main(args):
# save the parsed results to path.
op_files.write_pickle(
load_raw_info_from_experiments(args.in_dir),
args.out_path)
if __name__ == '__main__':
args = get_args()
main(args)