Skip to content

Commit cfd0701

Browse files
committed
flexibility for k-space masking in apply_window
1 parent 22076fc commit cfd0701

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

pixell/enmap.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1369,16 +1369,18 @@ def calc_window(shape, order=0, scale=1):
13691369
wx = utils.pixwin_1d(np.fft.fftfreq(shape[-1], scale), order=order)
13701370
return wy, wx
13711371

1372-
def apply_window(emap, pow=1.0, order=0, scale=1, nofft=False):
1372+
def apply_window(emap, pow=1.0, order=0, scale=1, nofft=False, kmask=None):
13731373
"""Apply the pixel window function to the specified power to the map,
13741374
returning a modified copy. Use pow=-1 to unapply the pixel window.
13751375
By default the pixel window for interpolation order 0 mapmaking
1376-
(nearest neighbor) is applied. Pass 1 for bilinear mapmaking's pixel window."""
1376+
(nearest neighbor) is applied. Pass 1 for bilinear mapmaking's pixel window.
1377+
Optionally, zero out regions specified by kmask."""
13771378
wy, wx = calc_window(emap.shape, order=order, scale=scale)
13781379
if not nofft: emap = fft(emap)
13791380
else: emap = emap.copy()
13801381
emap *= wy[:,None]**pow
13811382
emap *= wx[None,:]**pow
1383+
if kmask is not None: emap[kmask] = 0
13821384
if not nofft: emap = ifft(emap).real
13831385
return emap
13841386

0 commit comments

Comments
 (0)