Advertisement
Guest User

wpm-stats.py

a guest
Jul 11th, 2014
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.04 KB | None | 0 0
  1. # The MIT License (MIT)
  2. #
  3. # Copyright (c) 2014
  4. #
  5. # Permission is hereby granted, free of charge, to any person obtaining a copy
  6. # of this software and associated documentation files (the "Software"), to deal
  7. # in the Software without restriction, including without limitation the rights
  8. # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  9. # copies of the Software, and to permit persons to whom the Software is
  10. # furnished to do so, subject to the following conditions:
  11. #
  12. # The above copyright notice and this permission notice shall be included in
  13. # all copies or substantial portions of the Software.
  14. #
  15. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16. # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17. # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18. # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19. # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20. # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  21. # THE SOFTWARE.
  22.  
  23. import numpy
  24.  
  25. #top 50
  26. wpm = [87, 86, 82, 77, 77, 76, 74, 74, 72, 72, 71, 71, 70, 70, 70, 69, 68, 68, 68, 68, 67, 67, 66, 66, 65, 65, 65, 65, 64, 64, 63, 63, 63, 63, 62, 62, 62, 62, 62, 62, 61, 61, 61, 61, 60, 60, 60, 60, 59, 59, ]
  27.  
  28. population = 2900
  29. distribution_range = 29
  30.  
  31. # distributes population wpm evenly
  32. # among distribution_range lower than 59
  33. # e.g. if distribution_range == 10, population is
  34. # distributed evenly amongst wpm 49, 50, 51, ... 58
  35. for i in range(59 - distribution_range,59):
  36.     wpm += [i]*(population/distribution_range)
  37.  
  38. def upper_outlier_bound(data):
  39.     return numpy.mean(data) + 3 * numpy.std(data)
  40.  
  41. def num_upper_outliers(data):
  42.     uob = upper_outlier_bound(data)
  43.     return sum(1 for d in data if d > uob)
  44.  
  45. print "Mean: {0:.1f}\nStandard Deviation: {1:.1f}\nOutlier if WPM > {2:.1f}\n# of Upper Outliers: {3}".format(numpy.mean(wpm), numpy.std(wpm), upper_outlier_bound(wpm), num_upper_outliers(wpm))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement