summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Jung <flo@windfisch.org>2015-08-25 23:11:08 +0200
committerFlorian Jung <flo@windfisch.org>2015-08-25 23:11:08 +0200
commitb78d6f097f85aa41f384a0f0922c98c58a22c879 (patch)
treec9ad47e9b35031ae8fa53b5130b41af54394624c
parent9dcba9467aface38c1bb4f0d1a9a478c3e884f20 (diff)
stats can now be calculated over multiple files. readme.
-rw-r--r--README3
-rw-r--r--stats.py20
2 files changed, 21 insertions, 2 deletions
diff --git a/README b/README
index ad6b58a..fa3410e 100644
--- a/README
+++ b/README
@@ -10,3 +10,6 @@ s = lock input. toggle between "user controls" and "bot controls". hold shift fo
move mouse = move
mouse left/mid/right click: set markers (currently unused)
esc = quit
+
+the stats.py module automatically creates/overwrites the stats.pickle file (roughly 1MB per 5 minutes currently)
+which can be loaded using Stats.load() and analyzed using the Stats.analyze_* functions, or using analyze.py
diff --git a/stats.py b/stats.py
index be8b547..3856c64 100644
--- a/stats.py
+++ b/stats.py
@@ -117,6 +117,21 @@ class Stats:
def load(filename):
return Stats(None, pickle.load(open(filename,"rb")))
+ def merge(self, filename):
+ data2 = pickle.load(open(filename,"rb"))
+ self.data.min_mass = min(self.data.min_mass, data2.min_mass)
+ self.data.max_mass = max(self.data.max_mass, data2.max_mass)
+
+ for i in data2.size_vs_visible_window:
+ self.data.size_vs_visible_window[i] += data2.size_vs_visible_window[i]
+ for i in data2.mass_vs_visible_window:
+ self.data.mass_vs_visible_window[i] += data2.mass_vs_visible_window[i]
+
+ for i in data2.size_vs_speed:
+ for j in data2.size_vs_speed[i]:
+ self.data.size_vs_speed[i][j] += data2.size_vs_speed[i][j]
+
+
def analyze_speed(self):
results=[]
@@ -125,7 +140,7 @@ class Stats:
average = quantile(values, 0.5)
maximum = quantile(values, 0.8)
- results += [(size,maximum,average,minimum,False,False,False,len(values))]
+ results += [(size,maximum,average,minimum,False,False,False,sum(values.values()))]
# mark outliers
for i in range(1, len(results)-1):
@@ -145,8 +160,9 @@ class Stats:
coeff_vs_stddev += [(coeff, avg(products), stddev(normalize(products)))]
best = min(coeff_vs_stddev, key=lambda v:v[2])
- print("size**"+str(best[0])+" * speed = "+str(best[1]) )
print("size\tcalc\tmax\tavg\tmin\t\tndata")
for size, maximum, average, minimum, maxoutlier, avgoutlier, minoutlier, ndata in results:
print(str(size) + ":\t" + "%.1f" % (best[1] / size**best[0]) + "\t" + ("*" if maxoutlier else "") + str(maximum) + "\t" + ("*" if avgoutlier else "") + str(average) + "\t" + ("*" if minoutlier else "") + str(minimum) + "\t\t" + str(ndata))
+
+ print("size**"+str(best[0])+" * speed = "+str(best[1]) )