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

fix: use uint dtype for ant numbers to comply with pyuvdata #925

Closed
wants to merge 1 commit into from
Closed
Changes from all 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
18 changes: 9 additions & 9 deletions hera_cal/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,12 @@ def comply_pol(pol):
def split_bl(bl):
'''Splits a (i,j,pol) baseline key into ((i,pi),(j,pj)), where pol=pi+pj.'''
pi, pj = split_pol(bl[2])
return ((bl[0], pi), (bl[1], pj))
return ((np.uint64(bl[0]), pi), (np.uint64(bl[1]), pj))


def join_bl(ai, aj):
'''Joins two (i,pi) antenna keys to make a (i,j,pol) baseline key.'''
return (ai[0], aj[0], join_pol(ai[1], aj[1]))
return (np.uint64(ai[0]), np.uint64(aj[0]), join_pol(ai[1], aj[1]))


def reverse_bl(bl):
Expand All @@ -141,7 +141,7 @@ def reverse_bl(bl):
if len(bl) == 2:
return (j, i)
else:
return (j, i, conj_pol(_comply_vispol(bl[2])))
return (np.uint64(j), np.uint64(i), conj_pol(_comply_vispol(bl[2])))


def comply_bl(bl):
Expand All @@ -151,7 +151,7 @@ def comply_bl(bl):
return bl
else:
i, j, p = bl
return (i, j, _comply_vispol(p))
return (np.uint64(i), np.uint64(j), _comply_vispol(p))


def make_bl(*args):
Expand All @@ -163,7 +163,7 @@ def make_bl(*args):
(i, j), pol = args
else:
i, j, pol = args
return (i, j, _comply_vispol(pol))
return (np.uint64(i), np.uint64(j), _comply_vispol(pol))


def filter_bls(bls, ants=None, ex_ants=None, pols=None, antpos=None, min_bl_cut=None, max_bl_cut=None):
Expand All @@ -190,15 +190,15 @@ def filter_bls(bls, ants=None, ex_ants=None, pols=None, antpos=None, min_bl_cut=
for bl in bls:
ant1, ant2 = split_bl(bl)
# filter on antennas to keep
if (ants is not None) and (ant1 not in ants) and (ant1[0] not in ants):
if (ants is not None) and (ant1 not in ants) and (ant1[0].item() not in ants):
continue
if (ants is not None) and (ant2 not in ants) and (ant2[0] not in ants):
if (ants is not None) and (ant2 not in ants) and (ant2[0].item() not in ants):
continue

# filter on antennas to exclude
if (ex_ants is not None) and ((ant1 in ex_ants) or (ant1[0] in ex_ants)):
if (ex_ants is not None) and ((ant1 in ex_ants) or (ant1[0].item() in ex_ants)):
continue
if (ex_ants is not None) and ((ant2 in ex_ants) or (ant2[0] in ex_ants)):
if (ex_ants is not None) and ((ant2 in ex_ants) or (ant2[0].item() in ex_ants)):
continue

# filter on polarizations
Expand Down