diff options
| author | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-02-11 18:28:31 -0500 |
|---|---|---|
| committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-02-11 18:28:31 -0500 |
| commit | b2fa65ecfe14bb9377fbd8afa5f457a07472b6fb (patch) | |
| tree | 5bb1402027e1c56eccf38682166b1850c8b89aa9 /parse/tuple_table.py | |
| parent | 7c647198fc40e72ef6ca23c2484bf49eba2079ee (diff) | |
First attempt at plot_exps.py.
Diffstat (limited to 'parse/tuple_table.py')
| -rw-r--r-- | parse/tuple_table.py | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/parse/tuple_table.py b/parse/tuple_table.py index 469a424..105b786 100644 --- a/parse/tuple_table.py +++ b/parse/tuple_table.py | |||
| @@ -12,7 +12,7 @@ class TupleTable(object): | |||
| 12 | self.col_map = col_map | 12 | self.col_map = col_map |
| 13 | self.table = defaultdict(default) | 13 | self.table = defaultdict(default) |
| 14 | 14 | ||
| 15 | def col_map(self): | 15 | def get_col_map(self): |
| 16 | return self.col_map | 16 | return self.col_map |
| 17 | 17 | ||
| 18 | def __getitem__(self, kv): | 18 | def __getitem__(self, kv): |
| @@ -93,14 +93,21 @@ class ReducedTupleTable(TupleTable): | |||
| 93 | Leaf = namedtuple('Leaf', ['stat', 'variable', 'base', | 93 | Leaf = namedtuple('Leaf', ['stat', 'variable', 'base', |
| 94 | 'summary', 'config', 'values']) | 94 | 'summary', 'config', 'values']) |
| 95 | def leafs(): | 95 | def leafs(): |
| 96 | for path, values in dir_map.leafs(): | 96 | for path, node in dir_map.leafs(): |
| 97 | stat, variable, base_type, summary_type, leaf = path | 97 | # The path will be of at least size 1: the filename |
| 98 | leaf = path.pop() | ||
| 99 | |||
| 100 | # Set acceptable defaults for the rest of the path | ||
| 101 | path += ['?', '?', 'Avg', 'Avg'][len(path):] | ||
| 102 | |||
| 103 | [stat, variable, base_type, summary_type] = path | ||
| 98 | 104 | ||
| 99 | config_str = leaf[:leaf.index('.csv')] | 105 | config_str = leaf[:leaf.index('.csv')] |
| 100 | config = ColMap.decode(config_str) | 106 | config = ColMap.decode(config_str) |
| 101 | 107 | ||
| 102 | yield Leaf(stat, variable, base_type, | 108 | leaf = Leaf(stat, variable, base_type, |
| 103 | summary_type, config, values) | 109 | summary_type, config, node.values) |
| 110 | yield leaf | ||
| 104 | 111 | ||
| 105 | builder = ColMapBuilder() | 112 | builder = ColMapBuilder() |
| 106 | 113 | ||
| @@ -119,7 +126,6 @@ class ReducedTupleTable(TupleTable): | |||
| 119 | summary = table[leaf.config][leaf.stat] | 126 | summary = table[leaf.config][leaf.stat] |
| 120 | summary[leaf.summary][leaf.base] = y | 127 | summary[leaf.summary][leaf.base] = y |
| 121 | 128 | ||
| 122 | print("read: %s" % table) | ||
| 123 | return table | 129 | return table |
| 124 | 130 | ||
| 125 | def write_map(self, out_map): | 131 | def write_map(self, out_map): |
