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
separationmethods.- Parameters:
- coords1astropy:coordinate-like
The first set of coordinates, which will be searched for matches from
coords2withinseplimit. Cannot be a scalar coordinate.- coords2astropy:coordinate-like
The second set of coordinates, which will be searched for matches from
coords1withinseplimit. Cannot be a scalar coordinate.- seplimit
Quantity[:ref: ‘angle’] The on-sky separation to search within.
- storekdtreebool or
python:str, optional If a string, will store the KD-Tree used in the search with the name
storekdtreeincoords2.cache. This speeds up subsequent calls to this function. If False, the KD-Trees are not saved.
- Returns:
- idx1
python:intarray Indices into
coords1that matches to the corresponding element ofidx2. Shape matchesidx2.- idx2
python:intarray Indices into
coords2that matches to the corresponding element ofidx1. Shape matchesidx1.- sep2d
Angle The on-sky separation between the coordinates. Shape matches
idx1andidx2.- dist3d
Quantity[:ref: ‘length’] The 3D distance between the coordinates. Shape matches
idx1andidx2; the unit is that ofcoords1. If eithercoords1orcoords2don’t have a distance, this is the 3D distance on the unit sphere, rather than a physical distance.
- idx1
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(soidx1is in ascending order). This is considered an implementation detail, though, so it could change in a future release.