Skip to content

Commit

Permalink
Adding catch for key errors when populating ac_data structure
Browse files Browse the repository at this point in the history
  • Loading branch information
kartographer committed Sep 9, 2024
1 parent 634c8fd commit aa3a40b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/pyuvdata/uvdata/mir_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -2142,13 +2142,14 @@ def _fix_acdata(self):
for iband in unique_bands:
try:
ac_idx = ac_groups[(inhid, ant1rx, isb, iband)]
# Pull together all the sphid entries that are in this group,
# then add it to a list for handling later.
sp_idx = [sp_groups[(blhid, iband)] for blhid in blhid_arr]
except KeyError:
# If we have a key error, it means there are no entries with
# this receiver, sideband, band at this inhid, so just skip it.
continue
# Pull together all the sphid entries that are in this group, then
# add it to a list for handling later.
sp_idx = [sp_groups[(blhid, iband)] for blhid in blhid_arr]

try:
metablock_dict[(ant1rx, isb, iband)]["ac_idx"].append(ac_idx)
metablock_dict[(ant1rx, isb, iband)]["sp_idx"].append(sp_idx)
Expand Down

0 comments on commit aa3a40b

Please sign in to comment.