NTRT Simulator  Version: Master
 All Classes Namespaces Files Functions Variables Typedefs Friends Pages
statsDistances.py
1 """ Prints the min, avg, max of the numbers on each line """
2 
3 import sys
4 
5 try:
6  f = open(sys.argv[1], 'r')
7  lines = 0
8  sum = 0
9  max = 0
10  min = 9999999
11  for line in f:
12  lines += 1
13  x = float(line.partition(',')[0])
14  sum += x
15  if x < min:
16  min = x
17  if x > max:
18  max = x
19  print "min: " + str(min)
20  print "avg: " + str((sum / lines))
21  print "max: " + str(max)
22 finally:
23  f.close()
24