healpy.pixelfunc.get_map_size

healpy.pixelfunc.get_map_size(m)

Returns the npix of a given map (implicit or explicit pixelization).

If map is a dict type, assumes explicit pixelization: use nside key if present, or use nside attribute if present, otherwise use the smallest valid npix given the maximum key value. otherwise assumes implicit pixelization and returns len(m).

Parameters:
marray-like or dict-like

a map with implicit (array-like) or explicit (dict-like) pixellization

Returns:
npixint

a valid number of pixel

Notes

In implicit pixellization, raise a ValueError exception if the size of the input is not a valid pixel number.

Examples

>>> import healpy as hp
 >>> m = {0: 1, 1: 1, 2: 1, 'nside': 1}
 >>> print(hp.get_map_size(m))
 12
>>> m = {0: 1, 767: 1}
>>> print(hp.get_map_size(m))
768
>>> print(hp.get_map_size(np.zeros(12 * 8 ** 2)))
768