code: def _coords2idx(self, coords):
          
  
          x = self._coords2vec(coords)
          idx = self._kd.query(x, p=self._metric_p,
                               distance_upper_bound=self._max_pix_scale)
          return idx[1]
docs: Converts from sky coordinates to pixel indices.
  
          Args:
              coords (:obj:`astropy.coordinates.SkyCoord`): Sky coordinates.
  
          Returns:
              Pixel indices of the coordinates, with the same shape as the input
              coordinates. Pixels which are outside the map are given an index
              equal to the number of pixels in the map.