Go back to the Index

Tutorial 3: Cartosky and HEALPix

In this tutorial we introduce the interface between cartosky.Skymap and HEALPix (Gorski et al. 2005). The ability to accurately draw HEALPix maps with minimal overhead is one of the most powerful (and useful) feature of cartosky.

We start by importing several classes from cartosky and setting a few constants that we will use in this example. By this point, these modules and classes should be familiar.

We start off by creating and drawing a simple, low-resolution HEALPix map in ring format.

This is nothing special compared to what you can do with healpy.visfunc, but remember that cartosky gives you access to the underlying power of PROJ.

The draw_hpxmap function returns the image, longitude and latitude of each pixel, and the values of each pixel. You can take that output and draw it yourself if you like.

The draw_hpxmap function can also take a partial HEALPix map where the pixels and values are specified explicitly.

Notice that in the above maps all pixels that are not explicitly specified are masked by draw_hpxmap. The same behavior can be accomplished by setting HEALPix values to np.NaN, hp.UNSEEN or by using the numpy.MaskedArray module.

We have also implemented a HEALPix analog to the matplotlib.hexbin function called hpxbin (this function returns the healpix map in addition to image and associated pixel values).

Because cartosky can draw partial HEALPix maps with explicit pixel labeling, it is possible to draw small regions of the sky much more efficiently the healpy. The true power comes in the ability to plot ultra-high resolution HEALPix maps (nside > 1e5). This would take an enormous amount of memory if you needed to create the entire map. Notice the change in the axes ranges in the plots below.

Go back to the Index