output.py (2006:3ca085495c69) | output.py (2185:1ae0d79e352c) |
---|---|
1# Copyright (c) 2005 The Regents of The University of Michigan | 1# Copyright (c) 2005-2006 The Regents of The University of Michigan |
2# All rights reserved. 3# 4# Redistribution and use in source and binary forms, with or without 5# modification, are permitted provided that the following conditions are 6# met: redistributions of source code must retain the above copyright 7# notice, this list of conditions and the following disclaimer; 8# redistributions in binary form must reproduce the above copyright 9# notice, this list of conditions and the following disclaimer in the --- 88 unchanged lines hidden (view full) --- 98 groupopts.append(group.subopts()) 99 skiplist[i] = True 100 elif group.flags.graph_bars: 101 baropts.append(group.subopts()) 102 skiplist[i] = True 103 else: 104 groups.append(group) 105 | 2# All rights reserved. 3# 4# Redistribution and use in source and binary forms, with or without 5# modification, are permitted provided that the following conditions are 6# met: redistributions of source code must retain the above copyright 7# notice, this list of conditions and the following disclaimer; 8# redistributions in binary form must reproduce the above copyright 9# notice, this list of conditions and the following disclaimer in the --- 88 unchanged lines hidden (view full) --- 98 groupopts.append(group.subopts()) 99 skiplist[i] = True 100 elif group.flags.graph_bars: 101 baropts.append(group.subopts()) 102 skiplist[i] = True 103 else: 104 groups.append(group) 105 |
106 if not groupopts: 107 raise AttributeError, 'No group selected for graph group' | 106 has_group = bool(groupopts) 107 if has_group: 108 groupopts = [ group for group in crossproduct(groupopts) ] 109 else: 110 groupopts = [ None ] |
108 | 111 |
109 if not baropts: | 112 if baropts: 113 baropts = [ bar for bar in crossproduct(baropts) ] 114 else: |
110 raise AttributeError, 'No group selected for graph bars' 111 | 115 raise AttributeError, 'No group selected for graph bars' 116 |
112 groupopts = [ group for group in crossproduct(groupopts) ] 113 baropts = [ bar for bar in crossproduct(baropts) ] 114 | |
115 directory = expanduser(graphdir) 116 if not isdir(directory): 117 os.mkdir(directory) 118 html = file(joinpath(directory, '%s.html' % name), 'w') 119 print >>html, '<html>' 120 print >>html, '<title>Graphs for %s</title>' % name 121 print >>html, '<body>' 122 html.flush() 123 124 for options in self.jobfile.options(groups): 125 chart = BarChart(self) 126 | 117 directory = expanduser(graphdir) 118 if not isdir(directory): 119 os.mkdir(directory) 120 html = file(joinpath(directory, '%s.html' % name), 'w') 121 print >>html, '<html>' 122 print >>html, '<title>Graphs for %s</title>' % name 123 print >>html, '<body>' 124 html.flush() 125 126 for options in self.jobfile.options(groups): 127 chart = BarChart(self) 128 |
127 data = zeros((len(groupopts), len(baropts)), Float) | |
128 data = [ [ None ] * len(baropts) for i in xrange(len(groupopts)) ] 129 enabled = False 130 stacked = 0 131 for g,gopt in enumerate(groupopts): 132 for b,bopt in enumerate(baropts): | 129 data = [ [ None ] * len(baropts) for i in xrange(len(groupopts)) ] 130 enabled = False 131 stacked = 0 132 for g,gopt in enumerate(groupopts): 133 for b,bopt in enumerate(baropts): |
134 if gopt is None: 135 gopt = [] |
|
133 job = self.jobfile.job(options + gopt + bopt) 134 if not job: 135 continue 136 137 if proxy: 138 import db 139 proxy.dict['system'] = self.info[job.system] 140 val = self.info.get(job, self.stat) --- 22 unchanged lines hidden (view full) --- 163 data[i][j] = [ 0.0 ] * stacked 164 elif len(val) != stacked: 165 raise ValueError, "some stats stacked, some not" 166 167 data = array(data) 168 if data.sum() == 0: 169 continue 170 | 136 job = self.jobfile.job(options + gopt + bopt) 137 if not job: 138 continue 139 140 if proxy: 141 import db 142 proxy.dict['system'] = self.info[job.system] 143 val = self.info.get(job, self.stat) --- 22 unchanged lines hidden (view full) --- 166 data[i][j] = [ 0.0 ] * stacked 167 elif len(val) != stacked: 168 raise ValueError, "some stats stacked, some not" 169 170 data = array(data) 171 if data.sum() == 0: 172 continue 173 |
174 dim = len(data.shape) |
|
171 x = data.shape[0] | 175 x = data.shape[0] |
172 y = data.shape[1] | |
173 xkeep = [ i for i in xrange(x) if data[i].sum() != 0 ] | 176 xkeep = [ i for i in xrange(x) if data[i].sum() != 0 ] |
177 y = data.shape[1] |
|
174 ykeep = [ i for i in xrange(y) if data[:,i].sum() != 0 ] 175 data = data.take(xkeep, axis=0) 176 data = data.take(ykeep, axis=1) | 178 ykeep = [ i for i in xrange(y) if data[:,i].sum() != 0 ] 179 data = data.take(xkeep, axis=0) 180 data = data.take(ykeep, axis=1) |
181 if not has_group: 182 data = data.take([ 0 ], axis=0) |
|
177 chart.data = data 178 | 183 chart.data = data 184 |
179 gopts = [ groupopts[i] for i in xkeep ] 180 bopts = [ baropts[i] for i in ykeep ] | |
181 | 185 |
186 bopts = [ baropts[i] for i in ykeep ] |
|
182 bdescs = [ ' '.join([o.desc for o in opt]) for opt in bopts] | 187 bdescs = [ ' '.join([o.desc for o in opt]) for opt in bopts] |
183 gdescs = [ ' '.join([o.desc for o in opt]) for opt in gopts] | |
184 | 188 |
189 if has_group: 190 gopts = [ groupopts[i] for i in xkeep ] 191 gdescs = [ ' '.join([o.desc for o in opt]) for opt in gopts] 192 |
|
185 if chart.legend is None: 186 if stacked: 187 try: 188 chart.legend = self.info.rcategories 189 except: 190 chart.legend = [ str(i) for i in xrange(stacked) ] 191 else: 192 chart.legend = bdescs 193 194 if chart.xticks is None: | 193 if chart.legend is None: 194 if stacked: 195 try: 196 chart.legend = self.info.rcategories 197 except: 198 chart.legend = [ str(i) for i in xrange(stacked) ] 199 else: 200 chart.legend = bdescs 201 202 if chart.xticks is None: |
195 chart.xticks = gdescs | 203 if has_group: 204 chart.xticks = gdescs 205 else: 206 chart.xticks = [] |
196 chart.graph() 197 198 names = [ opt.name for opt in options ] 199 descs = [ opt.desc for opt in options ] 200 201 if names[0] == 'run': 202 names = names[1:] 203 descs = descs[1:] --- 17 unchanged lines hidden --- | 207 chart.graph() 208 209 names = [ opt.name for opt in options ] 210 descs = [ opt.desc for opt in options ] 211 212 if names[0] == 'run': 213 names = names[1:] 214 descs = descs[1:] --- 17 unchanged lines hidden --- |