Skip to content
Browse files

replace median interpolation with avg interpolation

  • Loading branch information...
1 parent 713623a commit a7fb4df3281a73e7bcf2a7e3a86b69f93184de22 @baverman committed Feb 12, 2011
Showing with 4 additions and 1 deletion.
  1. +4 −1 typetrainer/ui/stat.py
View
5 typetrainer/ui/stat.py
@@ -14,6 +14,9 @@ def median(values):
return ( values[a-1] + values[b] ) / 2.0
+def avg(values):
+ return sum(values) / float(len(values))
+
class StatDrawer(gtk.DrawingArea):
__gsignals__ = { "expose-event": "override" }
@@ -71,7 +74,7 @@ def draw(self, cr, width, height):
cr.new_sub_path()
for i in range(len(data)-4):
x = float(data[i+2][0].toordinal())
- y = median([r[1][0] for r in data[i:i+5]])
+ y = avg([r[1][0] for r in data[i:i+5]])
cr.line_to(x, y*hfactor)
cr.stroke()

0 comments on commit a7fb4df

Please sign in to comment.
Something went wrong with that request. Please try again.