convolve.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:slitSpectrographBlind 作者: aasensio 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号