def XI(theta1, phi1, theta2, phi2, delta1, delta2, weight1, weight2, bins, auto): t1 = time() cosbins = np.cos(bins) w = paircount(theta1, phi1, theta2, phi2, delta1, delta2, weight1, weight2, cosbins, auto) print('Finished hp Xi(theta) in %.2f secs'%(time()-t1)) #binc = 0.5*(bins[1:]+bins[:-1]) return bins, (w[0], w[1])
def run_paircount(self, maxang=10): bw = 3.*hp.nside2resol(self.nside)*180./3.1416 # 3x resol. bins = np.arange(bw, maxang, bw) #delta_i, rani = hp.ud_grade(delta, res), hp.ud_grade(weight, res) theta, phi, deltam, fpixm = maps2pcinput(self.delta, self.weight, self.mask) w = paircount(theta, phi, deltam, deltam, fpixm, np.deg2rad(bins)) binc = 0.5*(bins[1:]+bins[:-1]) return [binc, w[0]/w[1]]
def XIwindow(ouname, randoms, mask): nside = hp.get_nside(randoms) bw = hp.nside2resol(nside) bins = np.arange(bw, np.pi, bw)[::-1] cbins = np.cos(bins) theta, phi = hp.pix2ang(nside, np.argwhere(mask).flatten()) delta = np.ones(mask.sum()) weight = randoms[mask] counts = paircount(theta, phi, theta, phi, delta, delta, weight, weight, cbins, 1) return bins, counts