def report_timings_summary(self,
                               summary,
                               summary_file_name = None,
                               mean_threshold = 1):
        """
            This will extract the details from the sheet and optionally save
            them to a summary file

            summary: the summary details returned from the spreadsheet (read_timings_sheet)
            summary_file_name: name of the file to record the summary details (if required)
            mean_threshold: The minimum number of values required to include
                            the mean in the regression calculations
        """
        import numpy
        import datetime
        good_values = []
        other_values = []
        total_values = []
        for date in summary["date"]:
             good_values.append([])
             other_values.append([])
             total_values.append([])
        for (url,results)  in summary.items():
            if url == "date":
                continue
            else:
                cnt = 0
            for (duration, broken) in results:
                if duration != "":
                    total_values[cnt].append(duration)
                    if broken:
                        other_values[cnt].append(duration)
                    else:
                        good_values[cnt].append(duration)
                cnt += 1
        # get the number of days each entry is after the first date
        # and calculate the average, if the average is NAN then ignore both
        date_summary = []
        gv_mean = []
        gv_std = []
        gv_date = []
        cnt = 0
        start = datetime.datetime.strptime(summary["date"][0],"%Y-%m-%d")
        for list in good_values:
            if len(list) > mean_threshold:
                mean = numpy.mean(list)
                std = numpy.std(list)
                if not numpy.isnan(mean):
                    this_date = datetime.datetime.strptime(summary["date"][cnt],"%Y-%m-%d")
                    date_summary.append((this_date - start).days)
                    gv_mean.append(mean)
                    gv_std.append(std)
                    gv_date.append(summary["date"][cnt])
            cnt += 1
        # calculate the regression line
        if len(gv_mean) > 2:
            (m,b) = numpy.polyfit(date_summary, gv_mean, 1)
        else:
            m = b = 0

        if summary_file_name != None:
            book = self.write_timings_sheet(summary)
            sheet = book.add_sheet("summary")
            row = 0
            for date in gv_date:
                sheet.write(row,0,str(date))
                sheet.write(row,1,gv_mean[row])
                row += 1
            sheet.write(row,0,"Trend")
            sheet.write(row,1,m)
            # Save the details to the summary file
            book.save(summary_file_name)
        return (date_summary, gv_mean, gv_std, m, b)
dataset/ETHPy150Open sahana/eden/modules/tests/smoke/broken_links.py/BrokenLinkTest.report_timings_summary/original