Perform binning on genome-wide measurements by summing each component
    in a window of variable size (subsampling_factor).

def bin_measurement(measurement=None, subsampling_factor=3):
    """Perform binning on genome-wide measurements by summing each component
    in a window of variable size (subsampling_factor).
    """

    subs = int(subsampling_factor)
    if measurement is None:
        measurement = np.array([])
    n = len(measurement)
    binned_measurement = [measurement[i - subs + 1:i].sum()
                          for i in range(n) if i % subs == 0 and i > 0]
    return np.array(binned_measurement)