Skip to content

Commit

Permalink
Merge b242b78 into 2ad7ea5
Browse files Browse the repository at this point in the history
  • Loading branch information
corentinravoux committed Mar 31, 2023
2 parents 2ad7ea5 + b242b78 commit 3795d3a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
12 changes: 11 additions & 1 deletion bin/picca_Pk1D.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,8 @@ def process_all_files(index_file_args):
axis=1),
k=k,
delta_pixel=pixel_step,
num_pixel=len(lambda_new))
num_pixel=len(lambda_new),
pixelization_correction = args.add_pixelization_correction)
elif reso_correction == 'Gaussian':
#this is roughly converting the mean resolution estimate back to pixels
#and then multiplying with pixel size
Expand Down Expand Up @@ -504,6 +505,15 @@ def main(cmdargs):
help=('do not use the resolution matrix even '
'if it exists and we are on linear binning'))

parser.add_argument('--add-pixelization-correction',
default=False,
action='store_true',
required=False,
help=('Add a pixelization correction, as if the resolution '
'matrix was doubly pixelized. Only use this option in '
'quickquasars mocks'))


parser.add_argument(
'--force-output-in-velocity',
default=False,
Expand Down
7 changes: 4 additions & 3 deletions py/picca/pk1d/compute_pk1d.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ def compute_correction_reso(delta_pixel, mean_reso, k):
return correction


def compute_correction_reso_matrix(reso_matrix, k, delta_pixel, num_pixel):
def compute_correction_reso_matrix(reso_matrix, k, delta_pixel, num_pixel, pixelization_correction = False):
"""Computes the resolution correction based on the resolution matrix using linear binning
Arguments
Expand Down Expand Up @@ -455,12 +455,13 @@ def compute_correction_reso_matrix(reso_matrix, k, delta_pixel, num_pixel):
w2_arr.append(w2)

w_res2 = np.mean(w2_arr, axis=0)
pixelization_factor = np.sinc(k * delta_pixel / (2 * np.pi))**2

# the following assumes that the resolution matrix is storing the actual
# resolution convolved with the pixelization kernel along each matrix axis
correction = w_res2
correction /= pixelization_factor
if pixelization_correction :
pixelization_factor = np.sinc(k * delta_pixel / (2 * np.pi))**2
correction /= pixelization_factor

return correction

Expand Down

0 comments on commit 3795d3a

Please sign in to comment.