Find the indices of a set of angles into a set of pixels

    Parameters:
    -----------
    pix    : set of search pixels
    pixels : set of reference pixels
  
    Returns:
    --------
    index : index into the reference pixels
10031
def index_lonlat_in_pixels(lon,lat,pixels,nside,sort=False,outside=-1):
    

    pix = ang2pix(nside,lon,lat)
    return index_pix_in_pixels(pix,pixels,sort,outside)
1132770
def affine(self, pixelbuffer=0):
        
        return Affine(
            self.pixel_x_size,
            0,
            self.bounds(pixelbuffer).left,
            0,
            -self.pixel_y_size,
            self.bounds(pixelbuffer).top
        )
690743
def indexXY(self, index):
        
        rect = self.visualRect(index)
        return rect.x(), rect.y()
995391
def pix2vec(nside, ipix, nest=False):
    """"""
    lon, lat = healpix_to_lonlat(ipix, nside, order='nested' if nest else 'ring')
    return ang2vec(*_lonlat_to_healpy(lon, lat))
1018622
def surveyPixel(lon, lat, nside_pix, nside_subpix = None):
    
    pix = np.unique(ang2pix(nside_pix, lon, lat))
    if nside_subpix is None:
        return pix
    else:
        subpix_array = []
        for ii in range(0, len(pix)):
            subpix = subpixel(pix[ii], nside_pix, nside_subpix)
            subpix_array.append(subpix)
        return pix, np.array(subpix_array)
131209
def castroData_from_pix_xy(self, xy, colwise=False):
        
        ipix = self._tsmap.xy_pix_to_ipix(xy, colwise)
        return self.castroData_from_ipix(ipix)
388161
def get_pixel(framebuf, x, y):
        """"""
        index = (y >> 3) * framebuf.stride + x
        offset = y & 0x07
        return (framebuf.buf[index] >> offset) & 0x01
897308
def upix_to_pix(upix):
    """"""
    nside = np.power(2, np.floor(np.log2(upix / 4)) / 2).astype(int)
    pix = upix - 4 * np.power(nside, 2)
    return pix, nside
1209516
def get_pixel(x,y)
      index = (y*@width + x)
      pointindex = index*3
      Color.from_rgba(
        @array[pointindex+2].ord,
        @array[pointindex+1].ord,
        @array[pointindex].ord,
        @alpha ? @alpha[index].ord : 255
        )

    end
1361180
def set_pixels(self, pixels):
        
        if not (pixels.shape == self._pixels.shape):
            raise AssertionError("Shape mismatch between pixels supplied {0} and existing image pixels {1}".format(pixels.shape,self._pixels.shape))
        self._pixels = pixels
        # reset this so that it is calculated next time the function is called
        self._rms = None
        return
1234388
public void generatePixels( HashSet<Point> pix ) {
        // Reset all pixels to background
        for( int j = 0; j < height; ++j ) {
            for( int i = 0; i < width; ++i ) {
                pixels[i][j] = BACKGROUND;
            }
        }
        convertToPixels(pix);
    }
1312973
def bbox(img):
    
    rows = np.any(img, axis=1)
    cols = np.any(img, axis=0)
    rmin, rmax = np.where(rows)[0][[0, -1]]
    cmin, cmax = np.where(cols)[0][[0, -1]]

    return rmin, rmax, cmin, cmax
744322
def subpixel(superpix, nside_superpix, nside_subpix):
    
    if nside_superpix==nside_subpix: return superpix
    vec = hp.pix2vec(nside_superpix, superpix)
    radius = np.degrees(2. * hp.max_pixrad(nside_superpix))
    subpix = query_disc(nside_subpix, vec, radius)
    pix_for_subpix = superpixel(subpix,nside_subpix,nside_superpix)
    # Might be able to speed up array indexing...
    return subpix[pix_for_subpix == superpix]
625883
def irect(self):
        """"""
        val = _fitz.Pixmap_irect(self)
        val = IRect(val)

        return val
155729
public void convertToPixels( HashSet<Point> pix ) {
        Iterator<Point> it = pix.iterator();
        while( it.hasNext() ) {
            Point p = it.next();
            pixels[p.x][p.y] = FOREGROUND;
        }
    }
1290350
def get_position(self):
        
        with self._lock:
            return self.x, self.y, self.angle
386902
def pixel(self, ix, iy):
        
        x = (ix - self.xoffset + 0.5) / self.scale
        y = (iy - self.yoffset + 0.5) / self.scale
        z = complex(x, y)
        self.set_c(z)
        return self.mpixel(z)