Skip to content

Commit

Permalink
Add script to transform CT result to trace list
Browse files Browse the repository at this point in the history
  • Loading branch information
deepanjanroy committed Sep 1, 2017
1 parent a902fca commit 8f69b07
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions experimental/csm/ct_csv_to_traces.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import csv
import sys

def csv_to_traces(infile, outfile):
traces = []
with open(infile) as inf:
results = csv.DictReader(inf)
for r in results:
for t in r['trace'].split(','):
traces.append(t)

with open(outfile, 'w') as outf:
for trace in traces:
outf.write(trace + '\n')

def main():
if len(sys.argv) < 3:
print "Usage: {0} <input-file> <output-file>".format(sys.argv[0])
return

input_filename = sys.argv[1]
output_filename = sys.argv[2]
csv_to_traces(input_filename, output_filename)

if __name__ == "__main__":
main()

0 comments on commit 8f69b07

Please sign in to comment.