def slice_vis(step, uvw, v=None):
    """ Slice visibilities into a number of chunks.

    :param step: Maximum chunk size
    :param uvw: uvw coordinates
    :param src: visibility source
    :param v: Visibility values (optional)
    :returns: List of visibility chunk (pairs)
    """
    nv = len(uvw)
    ii = range(0, nv, step)
    if v is None:
        return [ uvw[i:i+step] for i in ii ]
    else:
        return [ (uvw[i:i+step], v[i:i+step]) for i in ii ]