spherematch¶
-
cosmo_utils.mock_catalogues.spherematch.
spherematch
(ra1, dec1, ra2, dec2, tol=None, nnearest=1, nthreads=1)[source] [edit on github]¶ Determines the matches between two catalogues of sources with <ra, dec> coordinates.
Parameters: ra1, dec1 : array_like
Right ascension and declination of the 1st catalogue. Units are in
degrees
.ra2, dec2 : array_like
Right ascension and declination of the 2nd catalogue. Units are in
degrees
.tol : float or None, optional
How close (in degrees) a match has to be to count as a match. If None, all nearest neighbors for the 1st catalogue will be returned.
nnearest : int, optional
The nth neighbor to find. E.g. 1 for the nearest nearby, 2 for the second nearest neighbor, etc. Partcularly useful if you want to get the nearest non-self neighbor of a catalogue. To do this use:
``spherematch(ra, dec, ra, dec, nnearest=2)``
if
nnearest == 0
, all matches are returned.nthreads : int, optional
Number of threads to use for calculation. This variable is set to 1 by default. Must be larger than 1.
Returns: idx1 : int
numpy.ndarray
Indices of the 1st catalogue of the matches. Will never be larger than
ra1
/dec1
.idx2 : int
numpy.ndarray
Indices of the 2nd catalogue of the matches. Will never be larger than
ra1
/dec1
.ds : float
numpy.ndarray
Distance (in degrees) between the matches.