healpy.pixelfunc.npix2nside

healpy.pixelfunc.npix2nside(npix)

Give the nside parameter for the given number of pixels.

Parameters:
npixint

the number of pixels

Returns:
nsideint

the nside parameter corresponding to npix

Notes

Raise a ValueError exception if number of pixel does not correspond to the number of pixel of a healpix map.

Examples

>>> import healpy as hp
>>> hp.npix2nside(768)
8
>>> np.all([hp.npix2nside(12 * nside**2) == nside for nside in [2**n for n in range(12)]])
True
>>> hp.npix2nside(1000)
Traceback (most recent call last):
    ...
ValueError: Wrong pixel number (it is not 12*nside**2)