Skip to content

Commit

Permalink
Push result_rows down int omain loop of means
Browse files Browse the repository at this point in the history
  • Loading branch information
jcorbin committed Aug 6, 2012
1 parent e7cc094 commit 0031516
Showing 1 changed file with 12 additions and 16 deletions.
28 changes: 12 additions & 16 deletions means.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,20 +112,6 @@ def run_collections(run):
colls[i % nc].add(record)
return results, usage

def result_rows(runs):
fields = None
for i, run in enumerate(runs):
results, usage = run_collections(run)
if usage is not None:
raise NotImplementedError('no support for usage in result_rows')
runfields, stats = zip(*collection_stats(results))
if i == 0:
fields = runfields
yield ('samplename',) + fields
else:
assert runfields == fields
yield (run.samplename,) + stats

import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--table', '-t', action='store_true',
Expand All @@ -138,8 +124,18 @@ def result_rows(runs):
runs = map(named_records.read, args.files)

if args.table:
for row in result_rows(runs):
print(*row)
fields = None
for i, run in enumerate(runs):
results, usage = run_collections(run)
if usage is not None:
raise NotImplementedError('no support for usage in result_rows')
runfields, stats = zip(*collection_stats(results))
if i == 0:
fields = runfields
print('samplename', *fields)
else:
assert runfields == fields
print(run.samplename, *stats)

else:
for i, run in enumerate(runs):
Expand Down

0 comments on commit 0031516

Please sign in to comment.