search_around_sky#

astropy.coordinates.search_around_sky(coords1, coords2, seplimit, storekdtree='kdtree_sky')[source]#

Searches for pairs of points that have an angular separation at least as close as a specified angle.

This is intended for use on coordinate objects with arrays of coordinates, not scalars. For scalar coordinates, it is better to use the separation methods.

Parameters:
coords1astropy:coordinate-like

The first set of coordinates, which will be searched for matches from coords2 within seplimit. Must be a one-dimensional coordinate array.

coords2astropy:coordinate-like

The second set of coordinates, which will be searched for matches from coords1 within seplimit. Must be a one-dimensional coordinate array.

seplimitQuantity [:ref: ‘angle’]

The on-sky separation to search within. It should be broadcastable to the same shape as coords1.

storekdtreebool or python:str, optional

If a string, will store the KD-Tree used in the search with the name storekdtree in coords2.cache. This speeds up subsequent calls to this function. If False, the KD-Trees are not saved.

Returns:
CoordinateSearchResult

A NamedTuple with attributes representing the indices of the elements of found pairs in both source sets and angular and physical separations of the pairs. If either set of sources lack distances, the physical separation is the 3D distance on the unit sphere, rather than a true distance.

Notes

This function requires SciPy to be installed or it will fail.

In the current implementation, the return values are always sorted in the same order as the coords1 (so idx1 is in ascending order). This is considered an implementation detail, though, so it could change in a future release.