def convolve_lsf(flux,lsf):
if len(flux) < len(np.atleast_1d(lsf)):
# Add padding to make sure to return the same length in flux.
padding = np.ones(len(lsf)-len(flux)+1)
flux = np.hstack([padding,flux])
conv_flux = 1-np.convolve(1-flux,lsf,mode='same') /np.sum(lsf)
return conv_flux[len(padding):]
else:
# convolve 1-flux to remove edge effects wihtout using padding
return 1-np.convolve(1-flux,lsf,mode='same') /np.sum(lsf)
###############################################################################
# Convergence
###############################################################################
评论列表
文章目录