Skip to main content
Ctrl+K

healpy 1.20.0b2.dev25+g91f49a315 documentation

  • healpy tutorial
  • Other tutorials
    • Example of using the alpha argument for transparency
    • New visualization function tutorial
    • Example of generating a Gaussian beam in spherical harmonics space
    • harmonic_ud_grade vs ud_grade: A Focused Comparison
  • Installation procedure for Healpy
  • pixelfunc – Pixelisation related functions
    • healpy.pixelfunc.pix2ang
    • healpy.pixelfunc.pix2vec
    • healpy.pixelfunc.ang2pix
    • healpy.pixelfunc.vec2pix
    • healpy.pixelfunc.vec2ang
    • healpy.pixelfunc.ang2vec
    • healpy.pixelfunc.xyf2pix
    • healpy.pixelfunc.pix2xyf
    • healpy.pixelfunc.get_all_neighbours
    • healpy.pixelfunc.get_interp_weights
    • healpy.pixelfunc.get_interp_val
    • healpy.pixelfunc.nest2ring
    • healpy.pixelfunc.ring2nest
    • healpy.pixelfunc.reorder
    • healpy.pixelfunc.nside2npix
    • healpy.pixelfunc.npix2nside
    • healpy.pixelfunc.nside2order
    • healpy.pixelfunc.order2nside
    • healpy.pixelfunc.npix2order
    • healpy.pixelfunc.order2npix
    • healpy.pixelfunc.nside2resol
    • healpy.pixelfunc.nside2pixarea
    • healpy.pixelfunc.max_pixrad
    • healpy.pixelfunc.isnsideok
    • healpy.pixelfunc.isnpixok
    • healpy.pixelfunc.get_map_size
    • healpy.pixelfunc.get_min_valid_nside
    • healpy.pixelfunc.get_nside
    • healpy.pixelfunc.maptype
    • healpy.pixelfunc.ud_grade
    • healpy.pixelfunc.UNSEEN
    • healpy.pixelfunc.mask_bad
    • healpy.pixelfunc.mask_good
    • healpy.pixelfunc.ma
    • healpy.pixelfunc.fit_dipole
    • healpy.pixelfunc.fit_monopole
    • healpy.pixelfunc.remove_dipole
    • healpy.pixelfunc.remove_monopole
  • sphtfunc – Spherical harmonic transforms
    • healpy.sphtfunc.anafast
    • healpy.sphtfunc.map2alm
    • healpy.sphtfunc.map2alm_spin
    • healpy.sphtfunc.map2alm_lsq
    • healpy.sphtfunc.synfast
    • healpy.sphtfunc.alm2map
    • healpy.sphtfunc.alm2map_der1
    • healpy.sphtfunc.alm2map_spin
    • healpy.sphtfunc.smoothing
    • healpy.sphtfunc.smoothalm
    • healpy.sphtfunc.harmonic_ud_grade
    • healpy.sphtfunc.alm2cl
    • healpy.sphtfunc.synalm
    • healpy.sphtfunc.almxfl
    • healpy.sphtfunc.pixwin
    • healpy.sphtfunc.Alm
      • healpy.sphtfunc.Alm.getlm
      • healpy.sphtfunc.Alm.getidx
      • healpy.sphtfunc.Alm.getsize
      • healpy.sphtfunc.Alm.getlmax
    • healpy.sphtfunc.resize_alm
    • healpy.sphtfunc.gauss_beam
    • healpy.sphtfunc.beam2bl
    • healpy.sphtfunc.bl2beam
    • healpy.sphtfunc.blm_gauss
    • healpy.sphtfunc.effective_resolution_fwhm
    • healpy.sphtfunc.check_max_nside
  • visufunc – Visualisation
    • healpy.visufunc.mollview
    • healpy.visufunc.gnomview
    • healpy.visufunc.cartview
    • healpy.visufunc.orthview
    • healpy.visufunc.azeqview
    • healpy.visufunc.graticule
    • healpy.visufunc.delgraticules
    • healpy.visufunc.projplot
    • healpy.visufunc.projscatter
    • healpy.visufunc.projtext
  • newvisufunc – Experimental visualisation
    • healpy.newvisufunc.projview
    • healpy.newvisufunc.newprojplot
  • fitsfunc – FITS file related functions
    • healpy.fitsfunc.read_map
    • healpy.fitsfunc.write_map
    • healpy.fitsfunc.read_alm
    • healpy.fitsfunc.write_alm
    • healpy.fitsfunc.read_cl
    • healpy.fitsfunc.write_cl
    • healpy.fitsfunc.getformat
  • Pixel querying routines
    • healpy.query_disc
    • healpy.query_polygon
    • healpy.query_strip
    • healpy.boundaries
  • rotator – Rotation and geometry functions
    • healpy.rotator.Rotator
      • healpy.rotator.Rotator.I
      • healpy.rotator.Rotator.__call__
      • healpy.rotator.Rotator.angle_ref
      • healpy.rotator.Rotator.do_rot
      • healpy.rotator.Rotator.get_inverse
      • healpy.rotator.Rotator.rotate_alm
      • healpy.rotator.Rotator.rotate_map_alms
      • healpy.rotator.Rotator.rotate_map_pixel
    • healpy.rotator.rotateVector
    • healpy.rotator.rotateDirection
    • healpy.rotator.rotate_alm
    • healpy.rotator.vec2dir
    • healpy.rotator.dir2vec
    • healpy.rotator.angdist
  • projector – Spherical projections
    • healpy.projector.SphericalProj
      • healpy.projector.SphericalProj.ang2xy
      • healpy.projector.SphericalProj.get_center
      • healpy.projector.SphericalProj.get_extent
      • healpy.projector.SphericalProj.get_fov
      • healpy.projector.SphericalProj.ij2xy
      • healpy.projector.SphericalProj.projmap
      • healpy.projector.SphericalProj.set_flip
      • healpy.projector.SphericalProj.vec2xy
      • healpy.projector.SphericalProj.xy2ang
      • healpy.projector.SphericalProj.xy2ij
      • healpy.projector.SphericalProj.xy2vec
    • healpy.projector.GnomonicProj
      • healpy.projector.GnomonicProj.ang2xy
      • healpy.projector.GnomonicProj.get_center
      • healpy.projector.GnomonicProj.get_extent
      • healpy.projector.GnomonicProj.get_fov
      • healpy.projector.GnomonicProj.ij2xy
      • healpy.projector.GnomonicProj.projmap
      • healpy.projector.GnomonicProj.set_flip
      • healpy.projector.GnomonicProj.vec2xy
      • healpy.projector.GnomonicProj.xy2ang
      • healpy.projector.GnomonicProj.xy2ij
      • healpy.projector.GnomonicProj.xy2vec
    • healpy.projector.MollweideProj
      • healpy.projector.MollweideProj.ang2xy
      • healpy.projector.MollweideProj.get_center
      • healpy.projector.MollweideProj.get_extent
      • healpy.projector.MollweideProj.get_fov
      • healpy.projector.MollweideProj.ij2xy
      • healpy.projector.MollweideProj.projmap
      • healpy.projector.MollweideProj.set_flip
      • healpy.projector.MollweideProj.vec2xy
      • healpy.projector.MollweideProj.xy2ang
      • healpy.projector.MollweideProj.xy2ij
      • healpy.projector.MollweideProj.xy2vec
    • healpy.projector.CartesianProj
      • healpy.projector.CartesianProj.ang2xy
      • healpy.projector.CartesianProj.get_center
      • healpy.projector.CartesianProj.get_extent
      • healpy.projector.CartesianProj.get_fov
      • healpy.projector.CartesianProj.ij2xy
      • healpy.projector.CartesianProj.projmap
      • healpy.projector.CartesianProj.set_flip
      • healpy.projector.CartesianProj.vec2xy
      • healpy.projector.CartesianProj.xy2ang
      • healpy.projector.CartesianProj.xy2ij
      • healpy.projector.CartesianProj.xy2vec
  • zoomtool – Interactive visualisation
    • healpy.zoomtool.mollzoom
    • healpy.zoomtool.set_g_clim
  • Line integral convolution
    • healpy.line_integral_convolution
  • Other functions
    • healpy.dist2holes
    • healpy.hotspots
    • healpy.ringinfo
    • healpy.pix2ring
  • Licenses
  • .rst

pixelfunc – Pixelisation related functions

Contents

  • conversion from/to sky coordinates
  • conversion between NESTED and RING schemes
  • nside/npix/resolution
  • Notes on downgrade quality
  • Masking pixels
  • Map data manipulation

pixelfunc – Pixelisation related functions#

conversion from/to sky coordinates#

pix2ang(nside, ipix[, nest, lonlat])

pix2ang : nside,ipix,nest=False,lonlat=False -> theta[rad],phi[rad] (default RING)

pix2vec(nside, ipix[, nest])

pix2vec : nside,ipix,nest=False -> x,y,z (default RING)

ang2pix(nside, theta, phi[, nest, lonlat, ...])

ang2pix : nside,theta[rad],phi[rad],nest=False,lonlat=False,latauto=False,latbounce=True -> ipix (default:RING)

vec2pix(nside, x, y, z[, nest])

vec2pix : nside,x,y,z,nest=False -> ipix (default:RING)

vec2ang(vectors[, lonlat])

vec2ang: vectors [x, y, z] -> theta[rad], phi[rad].

ang2vec(theta, phi[, lonlat])

ang2vec : convert angles to 3D position vector.

xyf2pix(nside, x, y, face[, nest])

xyf2pix : nside,x,y,face,nest=False -> ipix (default:RING)

pix2xyf(nside, ipix[, nest])

pix2xyf : nside,ipix,nest=False -> x,y,face (default RING)

get_all_neighbours(nside, theta[, phi, ...])

Return the 8 nearest pixels.

get_interp_weights(nside, theta[, phi, ...])

Return the 4 closest pixels on the two rings above and below the location and corresponding weights.

get_interp_val(m, theta, phi[, nest, lonlat])

Return the bi-linear interpolation value of map(s) using 4 nearest neighbours.

conversion between NESTED and RING schemes#

nest2ring(nside, ipix)

Convert pixel number from NESTED ordering to RING ordering.

ring2nest(nside, ipix)

Convert pixel number from RING ordering to NESTED ordering.

reorder(map_in[, inp, out, r2n, n2r])

Reorder a HEALPix map from RING/NESTED ordering to NESTED/RING.

nside/npix/resolution#

nside2npix(nside)

Give the number of pixels for the given nside.

npix2nside(npix)

Give the nside parameter for the given number of pixels.

nside2order(nside)

Give the resolution order for a given nside.

order2nside(order)

Give the nside parameter for the given resolution order.

npix2order(npix)

Give the resolution order for the given number of pixels.

order2npix(order)

Give the number of pixels for the given resolution order.

nside2resol(nside[, arcmin])

Give approximate resolution (pixel size in radian or arcmin) for nside.

nside2pixarea(nside[, degrees])

Give pixel area given nside in square radians or square degrees.

max_pixrad(nside[, degrees])

Maximum angular distance between any pixel center and its corners.

isnsideok(nside[, nest])

Returns True if nside is a valid nside parameter, False otherwise.

isnpixok(npix)

Return True if npix is a valid value for HEALPix map size, False otherwise.

get_map_size(m)

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

get_min_valid_nside(npix)

Returns the minimum acceptable nside so that npix <= nside2npix(nside).

get_nside(m)

Return the nside of the given map.

maptype(m)

Describe the type of the map (valid, single, sequence of maps).

ud_grade(map_in, nside_out[, pess, ...])

Upgrade or degrade resolution of a map (or list of maps).

Notes on downgrade quality#

For simple resolution changes, ud_grade() remains available and fast. It is usually the right choice for masks, hit-count maps, and compact pixel-localized features. For diffuse or band-limited downgrade workflows, healpy.sphtfunc.harmonic_ud_grade() can preserve the map more faithfully because it first band-limits the map in spherical-harmonic space before synthesizing it at the target nside.

See healpy.sphtfunc.harmonic_ud_grade() for the API and the following tutorial notebooks for worked comparisons:

  • harmonic_ud_grade vs ud_grade: A Focused Comparison

Masking pixels#

UNSEEN

Special value used for masked pixels

mask_bad(m[, badval, rtol, atol])

Returns a bool array with True where m is close to badval.

mask_good(m[, badval, rtol, atol])

Returns a bool array with False where m is close to badval.

ma(m[, badval, rtol, atol, copy])

Return map as a masked array, with badval pixels masked.

Map data manipulation#

fit_dipole(m[, nest, bad, gal_cut])

Fit a dipole and a monopole to the map, excluding bad pixels.

fit_monopole(m[, nest, bad, gal_cut])

Fit a monopole to the map, excluding unseen pixels.

remove_dipole(m[, nest, bad, gal_cut, ...])

Fit and subtract the dipole and the monopole from the given map m.

remove_monopole(m[, nest, bad, gal_cut, ...])

Fit and subtract the monopole from the given map m.

previous

Installation procedure for Healpy

next

healpy.pixelfunc.pix2ang

Contents
  • conversion from/to sky coordinates
  • conversion between NESTED and RING schemes
  • nside/npix/resolution
  • Notes on downgrade quality
  • Masking pixels
  • Map data manipulation

By Author name not set

© Copyright Documentation: CC/BY/4.0/International, Software: GPL-2.0+.

Last updated on Jun 22, 2026.