Pixelization functions

These functions can be call without referencing any class. e.g.:

>>> import mhealpy as mhp
>>> mhp.nest2uniq(nside = 128, ipix = 3)
65539

Single-resolution maps

mhealpy.pixelfunc.single.order2npix(order)[source]

Get the number of pixel for a map of a given order

Parameters

order (int or array) –

Returns

int or array

mhealpy.pixelfunc.single.vec2ang(vectors, lonlat=False)[source]

Same as healpy.pixelfunc.vec2ang. Included here for convinience.

mhealpy.pixelfunc.single.ang2vec(theta, phi, lonlat=False)[source]

Same as healpy.pixelfunc.ang2vec. Included here for convinience.

Multi-resolution maps

mhealpy.pixelfunc.moc.uniq2nside(uniq)[source]

Extract the corresponding nside from a UNIQ numbered pixel

Parameters

uniq (int or array) – Pixel number

Returns

int or array

mhealpy.pixelfunc.moc.uniq2nest(uniq)[source]

Convert from UNIQ ordering scheme to NESTED

Parameters

uniq (int or array) – Pixel number

Return

(int or array, int or array): nside, npix

mhealpy.pixelfunc.moc.nest2uniq(nside, ipix)[source]

Convert from from NESTED to UNIQ scheme

Parameters
  • nside (int) – HEALPix NSIDE parameter

  • ipix (int or array) – Pixel number in NESTED scheme

Returns

int or array

mhealpy.pixelfunc.moc.nest2range(nside_input, pix, nside_output)[source]

Get the equivalent range of pixel that correspond to all child pixels of a map of a greater order.

Parameters
  • nside_input (int or array) – Nside of input pixel

  • pix (int or array) – Input pixel.

  • nside_output (int) – Nside of map with child pixels

Returns

Start pixel (inclusive) and

stop pixel (exclusive)

Return type

(int or array, int or array)

mhealpy.pixelfunc.moc.uniq2range(nside, uniq)[source]

Convert from a pixel number in NUNIQ scheme to the range of children pixels that it would correspond to in a NESTED map of a given order

Parameters
  • order (int) – Nside of equivalent single resolution map

  • uniq (int or array) – Pixel number in NUNIQ scheme

Returns

Start pixel (inclusive) and

stop pixel (exclusive)

Return type

(int or array, int or array)

mhealpy.pixelfunc.moc.range2uniq(nside, pix_range)[source]

Convert from range of children pixels in a NESTED map of a given order to the corresponding uniq pixel number.

Parameters
  • nside (int) – Nside of equivalent single resolution map

  • pix_range (int or array, int or array) – Star pixel (inclusive) and stop pixel (exclusive)

Returns

int