def hanningWindow(nPix, percentage):
"""
Return a Hanning window in 2D
Args:
size (int): size of the final image
percentage (TYPE): percentage of the image that is apodized
Returns:
real: 2D apodization mask
"""
M = np.ceil(nPix*percentage/100.0)
win = np.hanning(M)
winOut = np.ones(nPix)
winOut[0:M/2] = win[0:M/2]
winOut[-M/2:] = win[-M/2:]
return np.outer(winOut, winOut)
# @jit
# def conv(spec, psf, nPixBorder):
# nx, ny, nlambda = spec.shape
# nxPSF, nyPSF, nPSF = psf.shape
# out = np.zeros_like(spec)
# for i in range(nx-2*nPixBorder):
# for j in range(ny-2*nPixBorder):
# for k in range(nxPSF):
# for l in range(nyPSF):
# out[i,j,0] += spec[i+k-nxPSF/2+nPixBorder,j+l-nyPSF/2+nPixBorder,0] * psf[k,l,i]
# return out
评论列表
文章目录