Skip to content

Commit

Permalink
fixes to gamma gamma
Browse files Browse the repository at this point in the history
  • Loading branch information
calumgordon committed Apr 11, 2024
1 parent 9cbcbe6 commit 74800fa
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 11 deletions.
26 changes: 17 additions & 9 deletions lya_2pt/correlation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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
#<gamma gamma>
gamma_grid[bins] += gamma_1[i] * gamma_2[j] * weight12
5 changes: 3 additions & 2 deletions lya_2pt/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand All @@ -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
}


Expand Down

0 comments on commit 74800fa

Please sign in to comment.