search_around_3d¶

astropy.coordinates.
search_around_3d
(coords1, coords2, distlimit, storekdtree=u'_kdtree_3d')[source] [edit on github]¶ Searches for pairs of points that are at least as close as a specified distance in 3D space.
This is intended for use on coordinate objects with arrays of coordinates, not scalars. For scalar coordinates, it is better to use the
separation_3d
methods.Parameters: coords1 :
BaseCoordinateFrame
orSkyCoord
The first set of coordinates, which will be searched for matches from
coords2
withinseplimit
. Cannot be a scalar coordinate.coords2 :
BaseCoordinateFrame
orSkyCoord
The second set of coordinates, which will be searched for matches from
coords1
withinseplimit
. Cannot be a scalar coordinate.distlimit :
Quantity
with distance unitsThe physical radius to search within.
storekdtree : bool or str, optional
If a string, will store the KDTree used in the search as attributes with the name
storekdtree
incoords2
. This speeds up subsequent calls to this function. If False, the KDTrees are not saved.Returns: idx1 : integer array
Indices into
coords1
that matches to the corresponding element ofidx2
. Shape matchesidx2
.idx2 : integer array
Indices into
coords2
that matches to the corresponding element ofidx1
. Shape matchesidx1
.sep2d :
Angle
The onsky separation between the coordinates. Shape matches
idx1
andidx2
.dist3d :
Quantity
The 3D distance between the coordinates. Shape matches
idx1
andidx2
.Notes
This function requires SciPy (>=0.12.0) to be installed or it will fail.
If you are using this function to search in a catalog for matches around specific points, the convention is for
coords2
to be the catalog, andcoords1
are the points to search around. While these operations are mathematically the same ifcoords1
andcoords2
are flipped, some of the optimizations may work better if this convention is obeyed.In the current implementation, the return values are always sorted in the same order as the
coords1
(soidx1
is in ascending order). This is considered an implementation detail, though, so it could change in a future release.