Add proper per-file copyright notices/licenses and top-level license.
[bluesky.git] / parsetrace / gen-cdf.py
1 #!/usr/bin/python
2 #
3 # Convert a file with a sequence of data values to a CDF ready for gnuplot.
4
5 import re, sys
6
7 def split_line(l):
8     m = re.match(r"^([-+\d.e]+)(.*)$", l)
9     return (float(m.group(1)), m.group(2))
10
11 data = [split_line(s.strip()) for s in sys.stdin]
12 data.sort()
13
14 for i in range(len(data)):
15     sys.stdout.write("%s\t%s\n" % ((i + 1.0) / len(data), ''.join(map(str, data[i]))))