Skip to content

Commit

Permalink
fix the fsky computation
Browse files Browse the repository at this point in the history
  • Loading branch information
thibautlouis committed Feb 21, 2024
1 parent 01ca6b3 commit 64b91f7
Showing 1 changed file with 21 additions and 11 deletions.
32 changes: 21 additions & 11 deletions pspy/so_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def get_spinned_windows(w, lmax, niter):
return w1_plus, w1_minus, w2_plus, w2_minus


def get_survey_solid_angle(window):
def get_survey_solid_angle(window, naive=False):
"""
return Omega, the effective solid angle convered by the window function
we use the window correction as displayed in equation 17 of https://arxiv.org/pdf/astro-ph/0105302.pdf
Expand All @@ -170,17 +170,27 @@ def get_survey_solid_angle(window):
----------
window: ``so_map``
map of the window function
naive: boolean
the area of the non zero pixell
"""

shape, wcs = window.data.shape, window.data.wcs
area_sr = enmap.area(shape, wcs)
pixsize_map = window.data.pixsizemap()

def get_w(window, order):
pixsize_map = window.data.pixsizemap()
return 1 / (4 * np.pi) * np.sum(window.data ** order * pixsize_map)

w2 = get_w(window, 2)
w4 = get_w(window, 4)
win_corr = w2 ** 2 / w4

return area_sr * win_corr
if naive == True:
binary = window.copy()
binary.data[binary.data != 0] = 1
Omega = np.sum(binary.data * pixsize_map)

else:
def get_w(window, order):
pixsize_map = window.data.pixsizemap()
return 1 / (4 * np.pi) * np.sum(window.data ** order * pixsize_map)

w2 = get_w(window, 2)
w4 = get_w(window, 4)
fsky_eff = w2 ** 2 / w4
Omega = fsky_eff * 4 *np.pi


return Omega

0 comments on commit 64b91f7

Please sign in to comment.