cdshealpix:docs
  • Index
  • Modules

Navigation

  • next »
  • « previous |
  • cdshealpix 0.7.1 documentation »
  • API »
  • cdshealpix.nested.polygon_search

cdshealpix.nested.polygon_search¶

cdshealpix.nested.polygon_search(lon, lat, depth, flat=False)¶

Get the HEALPix cells contained in a polygon at a given depth.

This method is wrapped around the polygon_coverage method from the cdshealpix Rust crate.

Parameters:
lonastropy.coordinates.Longitude

The longitudes of the vertices defining the polygon.

latastropy.coordinates.Latitude

The latitudes of the vertices defining the polygon.

depthint

Maximum depth of the HEALPix cells that will be returned.

flatboolean, optional

False by default (i.e. returns a consistent MOC). If True, the HEALPix cells returned will all be at depth indicated by depth.

Returns:
ipix, depth, fully_covered(numpy.ndarray, numpy.ndarray, numpy.ndarray)

A tuple containing 3 numpy arrays of identical size:

  • ipix stores HEALPix cell indices.

  • depth stores HEALPix cell depths.

  • fully_covered stores flags on whether the HEALPix cells are fully covered by the polygon.

Raises:
ValueError

When lon and lat do not have the same dimensions.

IndexError

When the number of distinct vertices given is lesser than 3 (i.e. defining at least a triangle).

Examples

>>> from cdshealpix import polygon_search
>>> from astropy.coordinates import Longitude, Latitude
>>> import astropy.units as u
>>> import numpy as np
>>> lon = Longitude(np.random.rand(3) * 360, u.deg)
>>> lat = Latitude((np.random.rand(3) * 180 - 90), u.deg)
>>> max_depth = 12
>>> ipix, depth, fully_covered = polygon_search(lon, lat, max_depth)

Page Contents

  • cdshealpix.nested.polygon_search
    • polygon_search()

Previous topic

cdshealpix.nested.cone_search

Next topic

cdshealpix.nested.elliptical_cone_search

This Page

  • Show Source

Page Source   Back to Top

© Copyright 2024, Matthieu Baumann <matthieu.baumann@astro.unistra.fr> F.-X. Pineau <francois-xavier.pineau@astro.unistra.fr>.
Created using Sphinx 8.1.3.