Skip to content

Commit

Permalink
Make FlattenPol set flat_pol attribute of T maps and weights (#136)
Browse files Browse the repository at this point in the history
`FlattenPol` sets the `flat_pol` attribute of QU maps and weights to keep track of whether a frame has been flattened, but does not set this attribute for T maps and weights. While `FlattenPol` does not affect T, a frame's T map is often used as a "stub" containing metadata for the generation of subsequent data products. As a result, polarized data products generated from a T stub will not inherit the `flat_pol` attribute as one might expect.  To avoid this issue, make `FlattenPol` modify `flat_pol` for T as well as Q and U.
  • Loading branch information
cailmdaley authored Jan 22, 2024
1 parent 92944be commit 7052169
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 4 additions & 1 deletion maps/python/map_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def FlattenPol(frame, invert=False):
return

ValidateMaps(frame)
qmap, umap = frame.pop("Q"), frame.pop("U")
tmap, qmap, umap = frame.pop("T"), frame.pop("Q"), frame.pop("U")

if "Wpol" in frame:
wmap = frame.pop("Wpol")
Expand All @@ -134,6 +134,9 @@ def FlattenPol(frame, invert=False):
else:
maps.flatten_pol(qmap, umap, invert=invert)

tmap.flat_pol = not invert

frame["T"] = tmap
frame["Q"] = qmap
frame["U"] = umap

Expand Down
2 changes: 2 additions & 0 deletions maps/src/maputils.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,8 @@ void FlattenPol(FlatSkyMapPtr Q, FlatSkyMapPtr U, G3SkyMapWeightsPtr W, double h
U->SetFlatPol(!invert);

if (!!W) {
flatptr = boost::dynamic_pointer_cast<FlatSkyMap>(W->TT);
flatptr->SetFlatPol(!invert);
flatptr = boost::dynamic_pointer_cast<FlatSkyMap>(W->TQ);
flatptr->SetFlatPol(!invert);
flatptr = boost::dynamic_pointer_cast<FlatSkyMap>(W->TU);
Expand Down

0 comments on commit 7052169

Please sign in to comment.