astro py:docs

- Index
- Modules

### Navigation

- next »
- « previous |
- Astropy v1.1.1 »
- Astronomical Coordinate Systems (`astropy.coordinates`) »
- search_around_sky

# search_around_sky

`astropy.coordinates.``search_around_sky`(coords1, coords2, seplimit, storekdtree=u'_kdtree_sky')

  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:

  coords1 : `BaseCoordinateFrame` or `SkyCoord`

  > The first set of coordinates, which will be searched for matches from `coords2` within `seplimit`. Cannot be a scalar coordinate.

  coords2 : `BaseCoordinateFrame` or `SkyCoord`

  > The second set of coordinates, which will be searched for matches from `coords1` within `seplimit`. Cannot be a scalar coordinate.

  seplimit : `Quantity` with angle units

  > The on-sky separation to search within.

  storekdtree : bool or str, optional

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

  Returns:

  idx1 : integer array

  > Indices into `coords1` that matches to the corresponding element of `idx2`. Shape matches `idx2`.

  idx2 : integer array

  > Indices into `coords2` that matches to the corresponding element of `idx1`. Shape matches `idx1`.

  sep2d : `Angle`

  > The on-sky separation between the coordinates. Shape matches `idx1` and `idx2`.

  dist3d : `Quantity`

  > The 3D distance between the coordinates. Shape matches `idx1` and `idx2`. If either `coords1` or `coords2` don’t have a distance, this is the 3D distance on the unit sphere, rather than a physical distance.

  Notes

  This function requires SciPy (>=0.12.0) 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.