Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compare earth oriented pols. #206

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions hera_sim/visibilities/vis_cpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,8 +418,19 @@ def _get_req_pols(self, uvdata, uvbeam, polarized: bool) -> List[Tuple[int, int]
# TODO: this can be updated to just access uvbeam.feed_array once the
# AnalyticBeam API has been improved.
feeds = list(getattr(uvbeam, "feed_array", ["x", "y"]))

# In order to get all 4 visibility polarizations for a dual feed system
# We should compare pols in the earth-oriented frame so here we convert
# to earth orientations (if possible)
if getattr(uvbeam, "x_orientation", None) is not None:
for fn, feed in enumerate(feeds):
if feed == "x":
feeds[fn] = uvbeam.x_orientation[0]
elif feed == "y":
if uvbeam.x_orientation.lower() == "north":
feeds[fn] = "e"
else:
feeds[fn] = "n"

vispols = set()
for p1, p2 in itertools.combinations_with_replacement(feeds, 2):
vispols.add(p1 + p2)
Expand All @@ -428,9 +439,13 @@ def _get_req_pols(self, uvdata, uvbeam, polarized: bool) -> List[Tuple[int, int]
vispol: (feeds.index(vispol[0]), feeds.index(vispol[1]))
for vispol in vispols
}
# Get the mapping from uvdata pols to uvbeam pols

# We want to compare pols in the earth-oriented labels (nn, ee)
# So I've changed this to compute the uvdata earth-oriented pols
# and compare directly to avail_pols which are alos earth-oriented
# from the UVBeam object.
uvdata_pols = [
uvutils.polnum2str(polnum, getattr(uvbeam, "x_orientation", None))
uvutils.polnum2str(polnum, getattr(uvdata, "x_orientation", None))
for polnum in uvdata.polarization_array
]
if any(pol not in avail_pols for pol in uvdata_pols):
Expand Down