Skip to content

Commit 64b91f7

Browse files
committed
fix the fsky computation
1 parent 01ca6b3 commit 64b91f7

File tree

1 file changed

+21
-11
lines changed

1 file changed

+21
-11
lines changed

pspy/so_window.py

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ def get_spinned_windows(w, lmax, niter):
158158
return w1_plus, w1_minus, w2_plus, w2_minus
159159

160160

161-
def get_survey_solid_angle(window):
161+
def get_survey_solid_angle(window, naive=False):
162162
"""
163163
return Omega, the effective solid angle convered by the window function
164164
we use the window correction as displayed in equation 17 of https://arxiv.org/pdf/astro-ph/0105302.pdf
@@ -170,17 +170,27 @@ def get_survey_solid_angle(window):
170170
----------
171171
window: ``so_map``
172172
map of the window function
173+
naive: boolean
174+
the area of the non zero pixell
173175
"""
174176

175-
shape, wcs = window.data.shape, window.data.wcs
176-
area_sr = enmap.area(shape, wcs)
177+
pixsize_map = window.data.pixsizemap()
177178

178-
def get_w(window, order):
179-
pixsize_map = window.data.pixsizemap()
180-
return 1 / (4 * np.pi) * np.sum(window.data ** order * pixsize_map)
181-
182-
w2 = get_w(window, 2)
183-
w4 = get_w(window, 4)
184-
win_corr = w2 ** 2 / w4
185179

186-
return area_sr * win_corr
180+
if naive == True:
181+
binary = window.copy()
182+
binary.data[binary.data != 0] = 1
183+
Omega = np.sum(binary.data * pixsize_map)
184+
185+
else:
186+
def get_w(window, order):
187+
pixsize_map = window.data.pixsizemap()
188+
return 1 / (4 * np.pi) * np.sum(window.data ** order * pixsize_map)
189+
190+
w2 = get_w(window, 2)
191+
w4 = get_w(window, 4)
192+
fsky_eff = w2 ** 2 / w4
193+
Omega = fsky_eff * 4 *np.pi
194+
195+
196+
return Omega

0 commit comments

Comments
 (0)