lsdb.core.crossmatch.bounded_kdtree_match#

Classes#

BoundedKdTreeCrossmatch

Nearest neighbor crossmatch using a distance range

Module Contents#

class BoundedKdTreeCrossmatch(left: nested_pandas.NestedFrame, right: nested_pandas.NestedFrame, left_order: int, left_pixel: int, right_order: int, right_pixel: int, left_catalog_info: hats.catalog.TableProperties, right_catalog_info: hats.catalog.TableProperties, right_margin_catalog_info: hats.catalog.TableProperties | None)[source]#

Bases: lsdb.core.crossmatch.kdtree_match.KdTreeCrossmatch

Nearest neighbor crossmatch using a distance range

classmethod validate(left: lsdb.Catalog, right: lsdb.Catalog, n_neighbors: int = 1, radius_arcsec: float = 1, min_radius_arcsec: float = 0)[source]#

Validate the metadata and arguments.

This method will be called once, after the algorithm object has been initialized, during the lazy construction of the execution graph. This can be used to catch simple errors without waiting for an expensive .compute() call.

This must accept any additional arguments the crossmatch method accepts.

perform_crossmatch(n_neighbors: int = 1, radius_arcsec: float = 1, min_radius_arcsec: float = 0) tuple[numpy.ndarray, numpy.ndarray, pandas.DataFrame][source]#

Perform a cross-match between the data from two HEALPix pixels

Finds the n closest neighbors in the right catalog for each point in the left catalog that are within a threshold distance by using a K-D Tree.

Parameters:
  • n_neighbors (int) – The number of neighbors to find within each point.

  • radius_arcsec (float) – The threshold distance in arcseconds beyond which neighbors are not added

  • min_radius_arcsec (float) – The minimum distance from which neighbors are added

Returns:

A DataFrame from the left and right tables merged with one row for each pair of neighbors found from cross-matching. The resulting table contains the columns from the left table with the first suffix appended, the right columns with the second suffix, and a “_dist_arcsec” column with the great circle separation between the points.