From 7071e38b5169fec73ffb782ee3b6d9c1d12cef3a Mon Sep 17 00:00:00 2001 From: shan yu Date: Fri, 18 Sep 2026 17:03:56 +0800 Subject: [PATCH] Compute Gaia TGE n_pix with nside2npix healpix_level is stored as int8. 4**level then overflows for every realistic TGE resolution, so the optimum map is empty and a nest index raises IndexError. Use the HEALPix identity nside2npix(2**int(level)). --- dustmaps/gaia_tge.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dustmaps/gaia_tge.py b/dustmaps/gaia_tge.py index bec149e..47e3803 100644 --- a/dustmaps/gaia_tge.py +++ b/dustmaps/gaia_tge.py @@ -98,7 +98,7 @@ def __init__(self, map_fname=None, healpix_level='optimum'): # Upscale to highest HEALPix level hpx_level = d['healpix_level'][idx_opt] hpx_level_max = np.max(hpx_level) - n_pix = 12 * 4**hpx_level_max + n_pix = hp.nside2npix(2 ** int(hpx_level_max)) # Index from original array to use in each pixel of final map idx = np.full(n_pix, -1, dtype='i8') # Empty pixel -> index=-1 # Get the ring-ordered index of the optimal pixels