summaryrefslogtreecommitdiff
path: root/sampling_alg_lac2020/figures/selection_count/calc_stats.py
blob: b192b7272637e0cf6cb68a57ce4e12d9b3d4c58b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/python3
import sys

#  if len(sys.argv) != 2:
#          print("Wrong number of arguments.")
#          print("USAGE: ./calc_stats.py <input_file>")
#          quit()

files = ["112_count.txt", "16_count.txt", "48_count.txt", "80_count.txt", "sweep_count.txt"]
for input_file in files:
	print(input_file)

	f = open(input_file)
	X = [int(i) for i in f.readlines()]

	mean = float(sum(X))/len(X)
	stddev = float(sum([x**2 for x in X]))/len(X) - mean**2

	print("{0:.2f}".format(mean) + " " + "{0:.2f}".format(stddev))