-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add script to transform CT result to trace list
- Loading branch information
1 parent
a902fca
commit 8f69b07
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |