def get_optflux_Eran (P, P_noshift, D, S, V):
"""Function that calculates optimal flux and corresponding error based
on the PSF [P], the PSF shifted by the fractional pixel shift
[P_shift], data [D], sky [S] and variance [V]. All are assumed to
be in electrons rather than counts. These can be 1- or
2-dimensional arrays with the same shape, while the sky can also
be a scalar. See Eqs. 36 and 37 of Zackay & Ofek 2017, ApJ, 836,
187.
"""
# and optimal flux and its error
denominator = np.sum((P_noshift*P)/V)
optflux = np.sum((P_noshift*(D-S)/V)) / denominator
optfluxerr = 1./np.sqrt(denominator)
return optflux, optfluxerr
################################################################################
评论列表
文章目录