Skip to content

Commit

Permalink
Ensure maps are weighted before reprojection
Browse files Browse the repository at this point in the history
  • Loading branch information
arahlin committed Nov 5, 2024
1 parent c49aa9d commit 862c407
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion maps/python/map_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -868,14 +868,18 @@ class ReprojectMaps(object):
interp : bool
If True, use bilinear interpolation to extract values from the input
map. Otherwise, the nearest-neighbor value is used.
weighted : bool
If True (default), ensure that maps have had weights applied before
reprojection. Otherwise, reproject maps without checking the weights.
"""

def __init__(self, map_stub=None, rebin=1, interp=False):
def __init__(self, map_stub=None, rebin=1, interp=False, weighted=True):
assert map_stub is not None, "map_stub argument required"
self.stub = map_stub.clone(False)
self.stub.pol_type = None
self.rebin = rebin
self.interp = interp
self.weighted = weighted

def __call__(self, frame):
if isinstance(frame, core.G3Frame) and frame.type != core.G3FrameType.Map:
Expand All @@ -886,6 +890,9 @@ def __call__(self, frame):
"Coordinate rotation of polarized maps is not implemented"
)

if self.weighted:
ApplyWeights(frame)

if "U" in frame and not self.stub.polarized:
self.stub.pol_conv = frame["U"].pol_conv

Expand Down

0 comments on commit 862c407

Please sign in to comment.