def cal_lensing_signals(kap, bzz, ncc): dsx_arc = bzz / ncc # deflection maps alpha1, alpha2 = cf.call_cal_alphas(kap, bzz, ncc) # shear maps npad = 5 al11 = 1 - np.gradient(alpha1, dsx_arc, axis=0) al12 = -np.gradient(alpha1, dsx_arc, axis=1) al21 = -np.gradient(alpha2, dsx_arc, axis=0) al22 = 1 - np.gradient(alpha2, dsx_arc, axis=1) detA = al11 * al22 - al12 * al21 kappa0 = 1 - 0.5 * (al11 + al22) shear1 = 0.5 * (al11 - al22) shear2 = 0.5 * (al21 + al12) shear0 = (shear1**2 + shear2**2)**0.5 # magnification maps mu = 1.0 / ((1.0 - kap)**2.0 - shear1 * shear1 - shear2 * shear2) lambda_t = 1 - kappa0 - shear0 # tangential eigenvalue, page 115 # lensing potential phi = cf.call_cal_phi(kap, bzz, ncc) return alpha1, alpha2, mu, phi, detA, lambda_t
def cal_lensing_signals(kap, bzz, ncc, coord): dsx_arc = bzz / ncc # deflection maps alpha1, alpha2 = cf.call_cal_alphas(kap, bzz, ncc) #TODO: map to finer grid alpha1_spline = RectBivariateSpline(coord, coord, alpha1) alpha2_spline = RectBivariateSpline(coord, coord, alpha2) lencoord = len(coord) centre_coord = np.linspace(coord[int(lencoord / 3)], coord[int(2 * lencoord / 3)], 256) coord = np.concatenate((coord[:int(lencoord / 3)], centre_coord, coord[int(2 * lencoord / 3 + 1):])) alpha1 = alpha1_spline(coord, coord) alpha2 = alpha2_spline(coord, coord) # shear maps al11 = 1 - np.gradient(alpha1, coord, axis=0) al12 = -np.gradient(alpha1, coord, axis=1) al21 = -np.gradient(alpha2, coord, axis=0) al22 = 1 - np.gradient(alpha2, coord, axis=1) detA = al11 * al22 - al12 * al21 # = (1-kappa0-shear0)*(1-kappa0+shear0) kappa0 = 1 - 0.5 * (al11 + al22) shear1 = 0.5 * (al11 - al22) shear2 = 0.5 * (al21 + al12) shear0 = (shear1**2 + shear2**2)**0.5 # magnification maps mu = 1 / detA # = 1.0/((1.0-kappa0)**2.0-shear1*shear1-shear2*shear2) lambda_t = 1 - kappa0 - shear0 # tangential eigenvalue, page 115 # lensing potential phi = cf.call_cal_phi(kap, bzz, ncc) return alpha1, alpha2, mu, phi, detA, lambda_t, coord