Closed taldcroft closed 4 months ago
Is this a bug? The return value does really contain invalid pixel indices (-1) for pixels that are near the poles and do not have the full complement of neighbors.
To be precise, this happens at the locations where the 12 base pixels meet and that are not on the poles or the equator. For Nside>1, at most one of the neighbours can be -1 (i.e. nonexistant), for Nside==1, two of the neighbours may be absent.
[Edit: by "meet" I mean at the corners of the base pixels.]
An easier interpretation: these warnings happen at pixels that touch corners where exactly 3 base pixels meet. Every Healpix map has exactly 8 of those locations, and each is touched by three pixels,so you get 24 warnings.
I would call this a bug and a documentation issue.
Bug - there is no reason this code should be issuing a scary sounding warning for a situation that is expected and normal. This warning ended up making me not trust the results and I spent an hour tracking down what was happening and submitting this issue.
Documentation - the neighbours()
docstring and any examples should highlight that -1
is an expected return value in this case, effectively "Not a Neighbour". Basically I didn't understand or trust astropy_healpix
until I read the corresponding healpy documentation and confirmed the -1 return value with that code.
I would call this a bug and a documentation issue.
I agree. Proposed fix in #220.
Bug - there is no reason this code should be issuing a scary sounding warning for a situation that is expected and normal. This warning ended up making me not trust the results and I spent an hour tracking down what was happening and submitting this issue.
It would be easy enough to remove the warning; we would just remove this line: https://github.com/astropy/astropy-healpix/blob/v1.0.3/astropy_healpix/_core.c#L302.
However, that would make this method inconsistent with the others; all of the functions set the invalid status if they return any invalid pixel values.
More generally: