Skip to content

Commit

Permalink
also pre-fill ra
Browse files Browse the repository at this point in the history
  • Loading branch information
weaverba137 committed Jan 10, 2025
1 parent ce36070 commit 7f7b770
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions py/desiutil/names.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ def radec_to_desiname(target_ra, target_dec):
# IAU compliant term
desinames = []
for ra, dec in zip(ratrunc, dectrunc):
desiname = 'DESI J' + ra[:-precision].zfill(3) + '.' + ra[-precision:]
zra = ra.zfill(7)
desiname = 'DESI J' + zra[:-precision] + '.' + zra[-precision:]
# Positive numbers need an explicit "+" while negative numbers
# already have a "-".
# zfill works properly with '-' but counts it in number of characters
Expand All @@ -75,7 +76,7 @@ def radec_to_desiname(target_ra, target_dec):
desiname += zdec[:-precision] + '.' + zdec[-precision:]
else:
zdec = dec.zfill(6)
desiname += '+' + dec[:-precision] + '.' + dec[-precision:]
desiname += '+' + zdec[:-precision] + '.' + zdec[-precision:]
desinames.append(desiname)

return np.array(desinames)

0 comments on commit 7f7b770

Please sign in to comment.