示例#1
0
 def boxes_by_week(self, weeks_ago=0):
     width = 700
     weeks_ago = -1*int(weeks_ago)
     
     plate_runtimes = sorted(plate_runtimes_for_week_box(weeks_ago), key=lambda tup: (tup[0].plate.box2.name, tup[1]))
     
     week_begin, week_end = week_bounds(weeks_ago)
     plate_runtime_dimensions = [(plate, int((width*round((start-week_begin).total_seconds())/(60*60*24*7))),
                                         max(1,int((width*round((end-start).total_seconds())/(60*60*24*7))))) for plate, start, end in plate_runtimes]
     c.run_histories = itertools.groupby(plate_runtime_dimensions, lambda tup: tup[0].plate.box2.name)
     
     c.days = [week_begin+(i*datetime.timedelta(1)) for i in range(7)]
     
     c.week = -1*weeks_ago
     c.first_day = week_begin
     return render('/stats/box2_week.html')
示例#2
0
    def index(self):
        
        events_by_week = []
        for i in range(5):
            weeks_ago = -1*i
            plates = plate_events_for_week(weeks_ago)
            droplet_sum = sum([num_events or 0 for plate, num_events in plates])
            week_begin, week_end = week_bounds(weeks_ago)
            events_by_week.append((week_begin, week_end, droplet_sum))
        
        c.events_by_week = events_by_week
        c.total_events = total_events()

        now = datetime.datetime.now()
        month_ago = now - datetime.timedelta(30)
        c.last_month_events = time_events(month_ago, now)
        
        return render('/stats/index.html')
示例#3
0
 def operators_by_week(self, weeks_ago=0):
     weeks_ago = -1*int(weeks_ago)
     plate_runtimes = sorted(plate_runtimes_for_week_operator(weeks_ago), key=lambda tup: tup[0].plate.operator.name_code if tup[0].plate.operator else '')
     
     c.run_profiles = sorted([(operator, list(plates)) \
                              for operator, plates in itertools.groupby(
                                  plate_runtimes,
                                  lambda tup: tup[0].plate.operator if tup[0].plate.operator else ''
                              )], key=lambda tup: sum([(plate.plate.score or 0) for plate, wells, data_wells, data_events in tup[1]]))
     unattributed_results = [results for operator, results in c.run_profiles if not operator]
     if len(unattributed_results) > 0:
         c.unattributed_results = unattributed_results[0]
     else:
         c.unattributed_results = []
     
     week_begin, week_end = week_bounds(weeks_ago)
     c.week = -1*weeks_ago
     c.first_day = week_begin
     return render('/stats/operator_week.html')
     c.first_day = we
示例#4
0
def plate_events_for_week(num_weeks=0):
    week_start, week_end = week_bounds(num_weeks)
    return plate_events_for_range(week_start, week_end)
示例#5
0
def plate_runtimes_for_week_box(num_weeks=0):
    week_start, week_end = week_bounds(num_weeks)
    return plate_runtimes_for_box_range(week_start, week_end)