summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Jung <flo@windfisch.org>2015-08-26 00:12:07 +0200
committerFlorian Jung <flo@windfisch.org>2015-08-26 00:12:07 +0200
commit0b0d7102b6efc629558a7a42fe869ac8b3f9319e (patch)
treecd2fe8e6ec78653e932ee7f9d5815c9ee798a79e
parent6a1f478e2168479f88de293a493ce6509d73f03f (diff)
find out zoom level w.r.t size
-rw-r--r--analyze.py1
-rw-r--r--stats.py17
2 files changed, 17 insertions, 1 deletions
diff --git a/analyze.py b/analyze.py
index aa2bd9f..1c864b0 100644
--- a/analyze.py
+++ b/analyze.py
@@ -12,5 +12,6 @@ for f in files[1:]:
s.merge(f)
s.analyze_speed()
+print("\n" + "-"*40 + "\n")
s.analyze_visible_window()
diff --git a/stats.py b/stats.py
index 24378cb..16910e5 100644
--- a/stats.py
+++ b/stats.py
@@ -171,6 +171,7 @@ class Stats:
def analyze_visible_window(self):
svw = {}
ratios = []
+ print("size\tdiag")
for size, rects in sorted(self.data.size_vs_visible_window.items(), key=lambda x:x[0]):
maxwidth = quantile(sorted(map(lambda x:x[0], rects)), 0.95)
maxheight = quantile(sorted(map(lambda x:x[1], rects)), 0.95)
@@ -180,4 +181,18 @@ class Stats:
print(str(size)+"\t"+str(math.sqrt(maxwidth**2+maxheight**2)))
- print (quantile(sorted(ratios),0.5))
+ print ("median ratio = "+str(quantile(sorted(ratios),0.5)))
+
+ coeff_vs_stddev=[]
+ for coeff in [x/100 for x in range(10,100,1)]:
+ quotients = []
+ for size, rect in svw.items():
+ if size != 0:
+ diag = math.sqrt(rect[0]**2+rect[1]**2)
+ quotients += [diag / size**coeff]
+
+ coeff_vs_stddev += [(coeff, avg(quotients), stddev(normalize(quotients)))]
+
+ best = min(coeff_vs_stddev, key=lambda v:v[2])
+
+ print("diag / size**"+str(best[0])+" = "+str(best[1]))