def get_chunks(arr, start, stop):
    rng = stop - start
rng = rng[rng != 0]
np.cumsum(rng, out=rng)
inds = np.ones(rng[-1], dtype=np.int)
inds[rng[:-1]] = start[1:] - stop[:-1] + 1
inds[0] = start[0]
np.cumsum(inds, out=inds)
return np.take(arr, inds)
Construct single numpy array from smaller arrays of different sizes