hats.inspection.visualize_catalog#

Generate a molleview map with the pixel densities of the catalog

NB: Testing validity of generated plots is currently not tested in our unit test suite.

Functions#

plot_density(catalog, *[, plot_title, order, unit])

Create a visual map of the density of input points of a catalog on-disk.

plot_pixels(catalog[, plot_title])

Create a visual map of the pixel density of the catalog.

plot_pixel_list(pixels[, plot_title, projection, ...])

Create a visual map of the pixel density of a list of pixels.

plot_moc(→ tuple[matplotlib.figure.Figure, ...)

Plots a moc

plot_healpix_map(healpix_map, *[, projection, title, ...])

Plot a map of HEALPix pixels to values as a colormap across a projection of the sky

Module Contents#

plot_density(catalog: hats.catalog.Catalog, *, plot_title: str | None = None, order=None, unit=None, **kwargs)[source]#

Create a visual map of the density of input points of a catalog on-disk.

Parameters:
catalog: Catalog

on-disk catalog object

plot_titlestr | None

Optional title for the plot

orderint

Optionally reduce the display healpix order, and aggregate smaller tiles. (Default value = None)

unitastropy.units.Unit

Unit to show for the angle for angular density. (Default value = None)

**kwargs

Additional args to pass to plot_healpix_map

plot_pixels(catalog: hats.catalog.healpix_dataset.healpix_dataset.HealpixDataset, plot_title: str | None = None, **kwargs)[source]#

Create a visual map of the pixel density of the catalog.

Parameters:
plot_titlestr | None

Optional title for the plot

catalog: HealpixDataset

on-disk or in-memory catalog, with healpix pixels.

**kwargs

Additional args to pass to plot_healpix_map

plot_pixel_list(pixels: list[hats.pixel_math.HealpixPixel], plot_title: str = '', projection='MOL', color_by_order=True, **kwargs)[source]#

Create a visual map of the pixel density of a list of pixels.

Parameters:
pixelslist[HealpixPixel]

healpix pixels (order and pixel number) to visualize

plot_titlestr

(Default value = “”) heading for the plot

projectionstr

The projection to use. Available projections listed at https://docs.astropy.org/en/stable/wcs/supported_projections.html (Default value = “MOL”)

color_by_orderbool

Whether to color the pixels by their order. True by default.

**kwargs

Additional args to pass to plot_healpix_map

plot_moc(moc: mocpy.MOC, *, projection: str = 'MOL', title: str = '', fov: astropy.units.Quantity | tuple[astropy.units.Quantity, astropy.units.Quantity] = None, center: astropy.coordinates.SkyCoord | None = None, wcs: astropy.wcs.WCS = None, frame_class: Type[astropy.visualization.wcsaxes.frame.BaseFrame] | None = None, ax: astropy.visualization.wcsaxes.WCSAxes | None = None, fig: matplotlib.figure.Figure | None = None, **kwargs) tuple[matplotlib.figure.Figure, astropy.visualization.wcsaxes.WCSAxes][source]#

Plots a moc

By default, a new matplotlib figure and axis will be created, and the projection will be a Molleweide projection across the whole sky.

Parameters:
mocmocpy.MOC

MOC to plot

projectionstr

The projection to use in the WCS. Available projections listed at https://docs.astropy.org/en/stable/wcs/supported_projections.html (Default value = “MOL”)

titlestr

The title of the plot (Default value = “”)

fovQuantity | tuple[Quantity, Quantity] = None

The Field of View of the WCS. Must be an astropy Quantity with an angular unit, or a tuple of quantities for different longitude and latitude FOVs (Default covers the full sky)

centerSkyCoord | None

The center of the projection in the WCS (Default: SkyCoord(0, 0))

wcsWCS | None

The WCS to specify the projection of the plot. If used, all other WCS parameters are ignored and the parameters from the WCS object is used.

frame_classType[BaseFrame] | None

The class of the frame for the WCSAxes to be initialized with. if the ax kwarg is used, this value is ignored (By Default uses EllipticalFrame for full sky projection. If FOV is set, RectangularFrame is used)

axWCSAxes | None

The matplotlib axes to plot onto. If None, an axes will be created to be used. If specified, the axes must be an astropy WCSAxes, and the wcs parameter must be set with the WCS object used in the axes. (Default: None)

figFigure | None

The matplotlib figure to add the axes to. If None, one will be created, unless ax is specified (Default: None)

**kwargs

Additional kwargs to pass to mocpy.MOC.fill

Returns:
Tuple[Figure, WCSAxes]

The figure and axes used to plot the healpix map

plot_healpix_map(healpix_map: numpy.ndarray, *, projection: str = 'MOL', title: str = '', cmap: str | matplotlib.colors.Colormap = 'viridis', norm: matplotlib.colors.Normalize | None = None, ipix: numpy.ndarray | None = None, depth: numpy.ndarray | None = None, cbar: bool = True, fov: astropy.units.Quantity | tuple[astropy.units.Quantity, astropy.units.Quantity] = None, center: astropy.coordinates.SkyCoord | None = None, wcs: astropy.wcs.WCS = None, frame_class: Type[astropy.visualization.wcsaxes.frame.BaseFrame] | None = None, ax: astropy.visualization.wcsaxes.WCSAxes | None = None, fig: matplotlib.figure.Figure | None = None, **kwargs)[source]#

Plot a map of HEALPix pixels to values as a colormap across a projection of the sky

Plots the given healpix pixels on a spherical projection defined by a WCS. Colors each pixel based on the corresponding value in a map. The map can be across all healpix pixels at a given order, or specify a subset of healpix pixels with the ipix and depth parameters.

By default, a new matplotlib figure and axis will be created, and the projection will be a Molleweide projection across the whole sky. Additional kwargs will be passed to the creation of a matplotlib PathCollection object, which is the artist that draws the tiles.

Parameters:
healpix_mapnp.ndarray

Array of map values for the healpix tiles. If ipix and depth are not specified, the length of this array will be used to determine the healpix order, and will plot healpix pixels with pixel index corresponding to the array index in NESTED ordering. If ipix and depth are specified, all arrays must be of the same length, and the pixels specified by the ipix and depth arrays will be plotted with their values specified in the healpix_map array.

projectionstr

The projection to use in the WCS. Available projections listed at https://docs.astropy.org/en/stable/wcs/supported_projections.html

titlestr

The title of the plot

cmapstr | Colormap

The matplotlib colormap to plot with

normNormalize | None

The matplotlib normalization to plot with

ipixnp.ndarray | None

Array of HEALPix NESTED pixel indices. Must be used with depth, and arrays must be the same length

depthnp.ndarray | None

Array of HEALPix pixel orders. Must be used with ipix, and arrays must be the same length

cbarbool

If True, includes a color bar in the plot (Default: True)

fovQuantity or Quantity | tuple[Quantity, Quantity]

The Field of View of the WCS. Must be an astropy Quantity with an angular unit, or a tuple of quantities for different longitude and latitude FOVs (Default covers the full sky)

centerSkyCoord | None

The center of the projection in the WCS (Default: SkyCoord(0, 0))

wcsWCS | None

The WCS to specify the projection of the plot. If used, all other WCS parameters are ignored and the parameters from the WCS object is used.

frame_classType[BaseFrame] | None

The class of the frame for the WCSAxes to be initialized with. if the ax kwarg is used, this value is ignored (By Default uses EllipticalFrame for full sky projection. If FOV is set, RectangularFrame is used)

axWCSAxes | None

The matplotlib axes to plot onto. If None, an axes will be created to be used. If specified, the axes must be an astropy WCSAxes, and the wcs parameter must be set with the WCS object used in the axes. (Default: None)

figFigure | None

The matplotlib figure to add the axes to. If None, one will be created, unless ax is specified (Default: None)

**kwargs

Additional kwargs to pass to creating the matplotlib PathCollection artist

Returns:
Tuple[Figure, WCSAxes]

The figure and axes used to plot the healpix map