From 74800fa19947cd65367d0754df5dab21ab769895 Mon Sep 17 00:00:00 2001 From: calumgordon Date: Thu, 11 Apr 2024 23:59:07 +0200 Subject: [PATCH] fixes to gamma gamma --- lya_2pt/correlation.py | 26 +++++++++++++++++--------- lya_2pt/interface.py | 5 +++-- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/lya_2pt/correlation.py b/lya_2pt/correlation.py index 0578082..8a38047 100644 --- a/lya_2pt/correlation.py +++ b/lya_2pt/correlation.py @@ -56,6 +56,8 @@ def compute_xi(healpix_id): num_pairs_grid = np.zeros(total_size, dtype=np.int32) gamma_grid = np.zeros(total_size) + sigma_v = globals.gamma_z_error + for tracer1 in globals.tracers1[healpix_id]: with globals.lock: xicounter = round(globals.counter.value * 100. / globals.num_tracers, 2) @@ -72,7 +74,16 @@ def compute_xi(healpix_id): globals.rp_max, globals.rt_max ) + #calculate rest frame waves and gamma function of tracer 1 + lambda_rest_1 = 1215.67 * (1 + tracer1.z) / (1 + tracer1.z_qso) + gamma_1 = gen_gamma(lambda_rest_1,sigma_v) + for tracer2 in neighbours: + + #calculate rest frame waves and gamma function of tracer 2 + lambda_rest_2 = 1215.67 * (1 + tracer2.z) / (1 + tracer2.z_qso) + gamma_2 = gen_gamma(lambda_rest_2,sigma_v) + angle = get_angle( tracer1.x_cart, tracer1.y_cart, tracer1.z_cart, tracer1.ra, tracer1.dec, tracer2.x_cart, tracer2.y_cart, tracer2.z_cart, tracer2.ra, tracer2.dec @@ -81,8 +92,8 @@ def compute_xi(healpix_id): compute_xi_pair( tracer1.deltas, tracer1.weights, tracer1.z, tracer1.dist_c, tracer1.dist_m, tracer2.deltas, tracer2.weights, tracer2.z, tracer2.dist_c, tracer2.dist_m, - angle, xi_grid, weights_grid, rp_grid, rt_grid, z_grid, num_pairs_grid, - tracer1.z_qso, tracer2.z_qso + angle, xi_grid, weights_grid, rp_grid, rt_grid, z_grid, num_pairs_grid, gamma_grid, + gamma_1, gamma_2 ) # Normalize correlation and average coordinate grids @@ -100,8 +111,8 @@ def compute_xi(healpix_id): def compute_xi_pair( deltas1, weights1, z1, dist_c1, dist_m1, deltas2, weights2, z2, dist_c2, dist_m2, angle, - xi_grid, weights_grid, rp_grid, rt_grid, z_grid, num_pairs_grid, - z_qso1,z_qso2 + xi_grid, weights_grid, rp_grid, rt_grid, z_grid, num_pairs_grid, gamma_grid, + gamma_1,gamma_2 ): sin_angle = np.sin(angle / 2) cos_angle = np.cos(angle / 2) @@ -138,8 +149,5 @@ def compute_xi_pair( z_grid[bins] += (z1[i] + z2[j]) / 2 * weight12 num_pairs_grid[bins] += 1 - #GAMMA FUNCTION - sigma_v = globals.gamma_z_error - lambda_rest_i = 1215.67 * (1 + z1) / (1 + z_qso1) - lambda_rest_j = 1215.67 * (1 + z2)/ (1 + z_qso2) - gamma_grid[bins] += gen_gamma(lambda_rest_i,sigma_v) * gen_gamma(lambda_rest_j,sigma_v) * weight12 \ No newline at end of file + # + gamma_grid[bins] += gamma_1[i] * gamma_2[j] * weight12 \ No newline at end of file diff --git a/lya_2pt/interface.py b/lya_2pt/interface.py index c1e8c92..c0b6082 100644 --- a/lya_2pt/interface.py +++ b/lya_2pt/interface.py @@ -16,7 +16,7 @@ accepted_options = [ "nside", "num-cpu", "z_min", "z_max", "rp_min", "rp_max", "rt_max", "num_bins_rp", "num_bins_rt", "num_bins_rp_model", "num_bins_rt_model", - "rejection_fraction", "get-old-distortion" + "rejection_fraction", "get-old-distortion",'gamma_z_error' ] defaults = { @@ -32,7 +32,8 @@ "num_bins_rp_model": 50, "num_bins_rt_model": 50, "rejection_fraction": 0.99, - "get-old-distortion": True + "get-old-distortion": True, + "gamma_z_error": 0 }