Open cdeil opened 7 years ago
In principle there's no reason we can't make the Cython wrappers take a vector nside and it would be easy. My main concern is that we need to keep it efficient for the scalar case and avoid creating an unnecessary array for nside.
Could you explain why gammapy needs this, to see if there is another way we can do this efficiently?
I guess what I'm thinking is that for now it wouldn't be that inefficient to simply call the astropy-healpix routines once for each nside value, since there are only 30 possible nside values.
Actually, maybe before worrying we should just try and change the Cython wrappers to use vector nside values and then if a scalar nside is passed in core.py
, convert to an array. We might find the performance penalty is not actually large.
I need this too because I use healpy for supporting NUNIQ indexing.
As commented by @lpsinger in https://github.com/astropy/astropy-healpix/pull/71#issuecomment-401027171 - this should still be implemented, but we should change to ufuncs
first.
One of the issues trying to switch Gammapy over to using astropy-healpix is that we call
ang2pix
with an array of nside values: https://gist.github.com/cdeil/754b76dc7f22511a5504fbbe74dccd62#file-gistfile1-txt-L989Minimum test case that works with healpy
but doesn't work with
astropy_healpix.healpy
(casting to numpy arrays is missing):and also support for array-valued
nside
is missing:I didn't look yet how much work it would be to make this work for
ang2pix
or possibly also similar other functions, I'm just going through and see what's missing for Gammapy today.