stats.py (1317:0b6026d3000b) stats.py (1318:57d49cdb92a5)
1#!/usr/bin/env python
2from __future__ import division
1#!/usr/bin/env python
2from __future__ import division
3import re, sys
3import re, sys, math
4
5def usage():
6 print '''\
7Usage: %s [-E] [-F] [-d <db> ] [-g <get> ] [-h <host>] [-p]
8 [-s <system>] [-r <runs> ] [-u <username>] <command> [command args]
9''' % sys.argv[0]
10 sys.exit(1)
11

--- 240 unchanged lines hidden (view full) ---

252 if command == 'stability':
253 stats = info.source.getStat(args[0])
254 info.source.get = "avg"
255
256 #loop through all the stats selected
257 for stat in stats:
258
259 print "%s:" % stat.name
4
5def usage():
6 print '''\
7Usage: %s [-E] [-F] [-d <db> ] [-g <get> ] [-h <host>] [-p]
8 [-s <system>] [-r <runs> ] [-u <username>] <command> [command args]
9''' % sys.argv[0]
10 sys.exit(1)
11

--- 240 unchanged lines hidden (view full) ---

252 if command == 'stability':
253 stats = info.source.getStat(args[0])
254 info.source.get = "avg"
255
256 #loop through all the stats selected
257 for stat in stats:
258
259 print "%s:" % stat.name
260 print "%-30s %12s %12s %4s %5s %6s" % \
261 ("run name", "average", "stdev", ">10%", ">1SDV", "SAMP")
262 print "%-30s %12s %12s %4s %5s %6s" % \
263 ("------------------------------", "------------", "------------", "----", "-----", "------")
260 print "%-30s %12s %12s %4s %5s %5s %5s" % \
261 ("run name", "average", "stdev", ">10%", ">1SDV", ">2SDV", "SAMP")
262 print "%-30s %12s %12s %4s %5s %5s %5s" % \
263 ("------------------------------", "------------",
264 "------------", "----", "-----", "-----", "-----")
264 #loop through all the selected runs
265 for run in runs:
266 info.display_run = run.run;
267 runTicks = info.source.retTicks([ run ])
268 #throw away the first one, it's 0
269 runTicks.pop(0)
270 stat.ticks = runTicks
271 avg = float(stat)
272 stdev = 0
273 numoutsideavg = 0
265 #loop through all the selected runs
266 for run in runs:
267 info.display_run = run.run;
268 runTicks = info.source.retTicks([ run ])
269 #throw away the first one, it's 0
270 runTicks.pop(0)
271 stat.ticks = runTicks
272 avg = float(stat)
273 stdev = 0
274 numoutsideavg = 0
275 numoutside1std = 0
276 numoutside2std = 0
274
275 #loop through all the various ticks for each run
276 for tick in runTicks:
277 stat.ticks = str(tick)
278 val = float(stat)
279 if (val < (avg * .9)) or (val > (avg * 1.1)):
280 numoutsideavg += 1
281 stdev += pow((val-avg),2)
282
277
278 #loop through all the various ticks for each run
279 for tick in runTicks:
280 stat.ticks = str(tick)
281 val = float(stat)
282 if (val < (avg * .9)) or (val > (avg * 1.1)):
283 numoutsideavg += 1
284 stdev += pow((val-avg),2)
285
283 stdev = pow(stdev / len(runTicks), 0.5)
284 numoutsidestd = 0
286 stdev = math.sqrt(stdev / len(runTicks))
285 for tick in runTicks:
286 stat.ticks = str(tick)
287 val = float(stat)
288 if (val < (avg - stdev)) or (val > (avg + stdev)):
287 for tick in runTicks:
288 stat.ticks = str(tick)
289 val = float(stat)
290 if (val < (avg - stdev)) or (val > (avg + stdev)):
289 numoutsidestd += 1
291 numoutside1std += 1
292 if (val < (avg - (2*stdev))) or (val > (avg + (2*stdev))):
293 numoutside2std += 1
290
294
291 print "%-30s %12s %12s %4s %5s %6s" % \
295 print "%-30s %12s %12s %4s %5s %5s %5s" % \
292 (run.name, "%.1f" % avg, "%.1f" % stdev,
296 (run.name, "%.1f" % avg, "%.1f" % stdev,
293 "%d" % numoutsideavg, "%d" % numoutsidestd,
294 "%d" % len(runTicks))
297 "%d" % numoutsideavg, "%d" % numoutside1std,
298 "%d" % numoutside2std, "%d" % len(runTicks))
295 return
296
297
298 if command == 'stats':
299 if len(args) == 0:
300 info.source.listStats()
301 elif len(args) == 1:
302 info.source.listStats(args[0])

--- 436 unchanged lines hidden ---
299 return
300
301
302 if command == 'stats':
303 if len(args) == 0:
304 info.source.listStats()
305 elif len(args) == 1:
306 info.source.listStats(args[0])

--- 436 unchanged lines hidden ---