def find_closest_pixel(pos, pixel_tab):
    """
    Compute the closest pixel of a given position
    Parameters
    ----------
    pos : 1D Numpy array giving a position
    pixel_tab : N-dim Numpy array of pixels positions [X,Y]

    Returns
    -------
    Pixel index in the given pixel_tab, corresponding distance to the pixel
    """
    x = pixel_tab - pos
    D2 = x[:, 0] ** 2 + x[:, 1] ** 2
    return D2.argmin()