def calc_theta_i(mag, mag_err, maxmag, limmag):
"""
Calculate theta_i. This is reproduced from calclambda_chisq_theta_i.pr
parameters
----------
mag:
mag_err:
maxmag:
limmag:
returns
-------
theta_i:
"""
theta_i = np.ones((len(mag)))
eff_lim = np.clip(maxmag,0,limmag)
dmag = eff_lim - mag
calc = dmag < 5.0
N_calc = np.count_nonzero(calc==True)
if N_calc > 0: theta_i[calc] = 0.5 + 0.5*erf(dmag[calc]/(np.sqrt(2)*mag_err[calc]))
hi = mag > limmag
N_hi = np.count_nonzero(hi==True)
if N_hi > 0:
theta_i[hi] = 0.0
return theta_i
评论列表
文章目录