Permalink
Browse files

recalculating cdf based on the pdf

  • Loading branch information...
1 parent 6d36a09 commit f3817132cb302f557cf902244845189a966154f3 @deanmalmgren deanmalmgren committed Apr 23, 2013
Showing with 6 additions and 6 deletions.
  1. +6 −6 beeswithmachineguns/bees.py
View
12 beeswithmachineguns/bees.py
@@ -307,12 +307,12 @@ def width(self):
proportion = (_tmax - _tmin) / _w
if _w > 0.0:
bin.mass += proportion * pct_complete * 0.01 / 0.99
-
- print "total mass", sum(bin.mass for bin in request_time_pdf)
-
- # request_time_pdf.append(Bin(i["Time in ms"], j["Time in ms"], mass=0.01*r['complete_requests']/total_complete_requests/0.99))
- # request_time_pdf.sort(key=operator.attrgetter('lwrbnd'))
-
+ cumulative_mass = 0.0
+ request_time_cdf = [tmin]
+ for bin in request_time_pdf:
+ cumulative_mass += bin.mass
+ if cumulative_mass * 100 > len(request_time_cdf):
+ request_time_cdf.append(bin.uprbnd)
complete_results = [r['fifty_percent'] for r in complete_bees]
mean_fifty = sum(complete_results) / num_complete_bees

0 comments on commit f381713

Please sign in to comment.