diff options
Diffstat (limited to 'parse_exps.py')
-rwxr-xr-x | parse_exps.py | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/parse_exps.py b/parse_exps.py index aa203d3..2d1c370 100755 --- a/parse_exps.py +++ b/parse_exps.py | |||
@@ -16,10 +16,12 @@ from parse.point import ExpPoint | |||
16 | from parse.tuple_table import ColMap,TupleTable | 16 | from parse.tuple_table import ColMap,TupleTable |
17 | 17 | ||
18 | def parse_args(): | 18 | def parse_args(): |
19 | # TODO: convert data-dir to proper option | ||
19 | parser = OptionParser("usage: %prog [options] [data_dir]...") | 20 | parser = OptionParser("usage: %prog [options] [data_dir]...") |
20 | 21 | ||
21 | parser.add_option('-o', '--out-dir', dest='out_dir', | 22 | parser.add_option('-o', '--out', dest='out', |
22 | help='directory for data output', default='parse-data') | 23 | help='file or directory for data output', default='parse-data') |
24 | |||
23 | # TODO: this means nothing | 25 | # TODO: this means nothing |
24 | parser.add_option('-c', '--clean', action='store_true', default=False, | 26 | parser.add_option('-c', '--clean', action='store_true', default=False, |
25 | dest='clean', help='do not output single-point csvs') | 27 | dest='clean', help='do not output single-point csvs') |
@@ -30,6 +32,9 @@ def parse_args(): | |||
30 | dest='force', help='overwrite existing data') | 32 | dest='force', help='overwrite existing data') |
31 | parser.add_option('-v', '--verbose', action='store_true', default=False, | 33 | parser.add_option('-v', '--verbose', action='store_true', default=False, |
32 | dest='verbose', help='print out data points') | 34 | dest='verbose', help='print out data points') |
35 | parser.add_option('-m', '--write-map', action='store_true', default=False, | ||
36 | dest='write_map', | ||
37 | help='Output map of values instead of csv tree') | ||
33 | 38 | ||
34 | return parser.parse_args() | 39 | return parser.parse_args() |
35 | 40 | ||
@@ -102,8 +107,8 @@ def main(): | |||
102 | raise IOError("Base column '%s' not present in any parameters!" % | 107 | raise IOError("Base column '%s' not present in any parameters!" % |
103 | base_conf.keys()[0]) | 108 | base_conf.keys()[0]) |
104 | 109 | ||
105 | base_table = TupleTable(col_map) | 110 | base_table = TupleTable(col_map) # For tracking 'base' experiments |
106 | result_table = TupleTable(col_map) | 111 | result_table = TupleTable(col_map) # For generating csv directories |
107 | 112 | ||
108 | # Used to find matching scaling_base for each experiment | 113 | # Used to find matching scaling_base for each experiment |
109 | for base in scaling_bases: | 114 | for base in scaling_bases: |
@@ -133,13 +138,17 @@ def main(): | |||
133 | if opts.verbose: | 138 | if opts.verbose: |
134 | print(result) | 139 | print(result) |
135 | 140 | ||
136 | if opts.force and os.path.exists(opts.out_dir): | 141 | if opts.force and os.path.exists(opts.out): |
137 | sh.rmtree(opts.out_dir) | 142 | sh.rmtree(opts.out) |
138 | 143 | ||
139 | # Remove un-plottable values | ||
140 | result_table.reduce() | 144 | result_table.reduce() |
141 | 145 | ||
142 | result_table.write_result(opts.out_dir) | 146 | if opts.write_map: |
147 | # Write summarized results into map | ||
148 | result_table.write_map(opts.out) | ||
149 | else: | ||
150 | # Write out csv directories for all variable params | ||
151 | result_table.write_csvs(opts.out) | ||
143 | 152 | ||
144 | if __name__ == '__main__': | 153 | if __name__ == '__main__': |
145 | main() | 154 | main() |