Skip to content

Commit 951df26

Browse files
committed
Add z_qso to tracer class
1 parent 473ad10 commit 951df26

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

lya_2pt/read_io.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ def read_from_image(hdul, absorption_line, healpix_id, need_distortion=False, pr
3333
los_id_array = hdul["METADATA"]["LOS_ID"][:]
3434
ra_array = hdul["METADATA"]["RA"][:]
3535
dec_array = hdul["METADATA"]["DEC"][:]
36+
z_qso_array = hdul["METADATA"]["Z"][:]
3637
dwave = hdul["LAMBDA"].read_header()['DELTA_LAMBDA']
3738

3839
deltas_array = hdul["DELTA"].read().astype(float)
@@ -52,10 +53,12 @@ def read_from_image(hdul, absorption_line, healpix_id, need_distortion=False, pr
5253
"Did not find LOGLAM or LAMBDA in delta file")
5354

5455
tracers = np.empty(los_id_array.shape, dtype=Tracer)
55-
for i, (los_id, ra, dec) in enumerate(zip(los_id_array, ra_array, dec_array)):
56+
for i, (los_id, ra, dec, z_qso) in enumerate(
57+
zip(los_id_array, ra_array, dec_array, z_qso_array)
58+
):
5659
mask = ~np.isnan(deltas_array[i])
5760
tracers[i] = Tracer(
58-
healpix_id, los_id, ra, dec, projection_order, deltas_array[i][mask],
61+
healpix_id, los_id, ra, dec, z_qso, projection_order, deltas_array[i][mask],
5962
weights_array[i][mask], log_lambda[mask], z[mask], need_distortion
6063
)
6164

@@ -97,6 +100,7 @@ def read_from_hdu(hdul, absorption_line, healpix_id, need_distortion=False, proj
97100
los_id = header["LOS_ID"]
98101
ra = header['RA']
99102
dec = header['DEC']
103+
z_qso = header['Z']
100104

101105
delta = hdu["DELTA"][:].astype(float)
102106
weights = hdu["WEIGHT"][:].astype(float)
@@ -114,7 +118,7 @@ def read_from_hdu(hdul, absorption_line, healpix_id, need_distortion=False, proj
114118
"Did not find LOGLAM or LAMBDA in delta file")
115119

116120
tracers.append(Tracer(
117-
healpix_id, los_id, ra, dec, projection_order, delta, weights,
121+
healpix_id, los_id, ra, dec, z_qso, projection_order, delta, weights,
118122
log_lambda, z, need_distortion
119123
))
120124

lya_2pt/tracer.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class Tracer:
7575
project():
7676
Apply projection matrix to deltas
7777
"""
78-
def __init__(self, healpix_id, los_id, ra, dec, order,
78+
def __init__(self, healpix_id, los_id, ra, dec, z_qso, order,
7979
deltas, weights, log_lambda, z, need_distortion=False):
8080
"""Initializes class instance
8181
@@ -89,6 +89,8 @@ def __init__(self, healpix_id, los_id, ra, dec, order,
8989
Line of sight's right ascension
9090
dec: float
9191
Line of sight's declination
92+
z_qso: float
93+
Background quasar redshift
9294
order: int
9395
Order of polynomial used for the continuum fitting
9496
deltas: array of float
@@ -108,6 +110,7 @@ def __init__(self, healpix_id, los_id, ra, dec, order,
108110
self.los_id = los_id
109111
self.ra = ra
110112
self.dec = dec
113+
self.z_qso = z_qso
111114
self.order = order
112115

113116
self.x_cart = np.cos(ra) * np.cos(dec)

0 commit comments

Comments
 (0)