def flash_check_cv(flash_output_path):
    hist_files = [os.path.join(flash_output_path, f) for f in os.listdir(flash_output_path) if f.endswith('.hist')]
    total_cv = total_mean = 0
    for f in hist_files:
        with open(f) as inf:
            csv_inf = csv.reader(inf, delimiter="\t")
            x2f = 0
            sum = 0
            cnt = 0
            for row in csv_inf:
                row = [int(r) for r in row]
                cnt = cnt + row[1]
                sum = sum + row[0] * row[1]
                x2f = x2f + row[0] * row[0] * row[1]
            mean = sum/cnt
            std = math.sqrt((x2f - sum*sum/cnt)/(cnt-1))
            cv = std/mean
            total_cv = total_cv + cv
            total_mean = total_mean + mean
    total_files = len(hist_files)
    return total_cv/total_files, total_mean/total_files