Find the indices of a set of pixels into another set of pixels.
    !!! ASSUMES SORTED PIXELS !!!

    Parameters:
    -----------
    pix    : set of search pixels
    pixels : set of reference pixels
  
    Returns:
    --------
    index : index into the reference pixels

def index_pix_in_pixels(pix,pixels,sort=False,outside=-1):
    """
    Find the indices of a set of pixels into another set of pixels.
    !!! ASSUMES SORTED PIXELS !!!

    Parameters:
    -----------
    pix    : set of search pixels
    pixels : set of reference pixels
  
    Returns:
    --------
    index : index into the reference pixels
    """
    # ADW: Not really safe to set index = -1 (accesses last entry); 
    # -np.inf would be better, but breaks other code...

    # ADW: Are the pixels always sorted? Is there a quick way to check?
    if sort: pixels = np.sort(pixels)

    # Assumes that 'pixels' is pre-sorted, otherwise...???
    index = np.searchsorted(pixels,pix)
    if np.isscalar(index):
        if not np.in1d(pix,pixels).any(): index = outside
    else:
        # Find objects that are outside the pixels
        index[~np.in1d(pix,pixels)] = outside
    return index