def generate_overlapping_segments( workspace_size, segment_size, num_segments ):

    s = segment_size

    while s < workspace_size:
        for x in xrange( 0, workspace_size, s):
            yield (x, min(workspace_size,x+s) )
        s *= 2
        
    yield( 0, workspace_size )
generate a covering set of segments with overlap
dataset/ETHPy150Open CGATOxford/cgat/obsolete/benchmark_ranges.py/generate_overlapping_segments