Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def eval_sigma_crit (self, z_len, z_src):
a_len = _get_a_from_z (z_len)
a_src = np.atleast_1d (_get_a_from_z (z_src))
cte = ccl.physical_constants.CLIGHT**2 / (4.0 * np.pi * ccl.physical_constants.GNEWT * ccl.physical_constants.SOLAR_MASS) * ccl.physical_constants.PC_TO_METER
z_cut = (a_src < a_len)
if np.isscalar (a_len):
a_len = np.repeat (a_len, len (a_src))
res = np.zeros_like (a_src)
if np.any (z_cut):
Ds = ccl.angular_diameter_distance (self.cosmo, a_src[z_cut])
Dl = ccl.angular_diameter_distance (self.cosmo, a_len)
Dls = ccl.angular_diameter_distance (self.cosmo, a_len, a_src[z_cut])
res[z_cut] = (cte * Ds / (Dl * Dls)) * self.cor_factor * 1.0e-6 / self.cosmo['h']
res[~z_cut] = np.Inf