def core(im,x,y,r):
    x=float(x)
    y=float(y)
    r=float(r)
    size = im.shape[0]
    sumline = numpy.zeros(size)
    for i in xrange(size):
#        rad = radial(im[i,:,:],x,y)
#        mask = ( rad < r )
        mask = circmask(x,y,r,im.shape[1],im.shape[2])
        sumline[i]=masksum(im[i,:,:],mask)
    return sumline/mask.sum()
def core(im,x,y,r):
    x=float(x)
    y=float(y)
    r=float(r)
    size = im.shape[0]
    sumline = numpy.zeros(size)
    for i in xrange(size):
#        rad = radial(im[i,:,:],x,y)
#        mask = ( rad < r )
        mask = circmask(x,y,r,im.shape[1],im.shape[2])
        '''
        if i<2:
            numdisplay.open()
            numdisplay.display(mask.astype(float))
            numdisplay.close()
#            print "Displayed the mask for aperture at " + str(x) + "," + str(y) + " with radius " + str(r)
        '''
        sumline[i]=masksum(im[i,:,:],mask)
    return sumline