lsdb.core.crossmatch.kdtree_match#

Classes#

KdTreeCrossmatch

Nearest neighbor crossmatch using a 3D k-D tree

Module Contents#

class KdTreeCrossmatch(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.abstract_crossmatch_algorithm.AbstractCrossmatchAlgorithm

Nearest neighbor crossmatch using a 3D k-D tree

extra_columns[source]#

The metadata for the columns generated by the crossmatch algorithm

classmethod validate(left: lsdb.catalog.Catalog, right: lsdb.catalog.Catalog, n_neighbors: int = 1, radius_arcsec: float = 1)[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) 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

Returns:

Indices of the matching rows from the left and right tables found from cross-matching, and a datafame with the “_dist_arcsec” column with the great circle separation between the points.

_get_point_coordinates() tuple[numpy.typing.NDArray[numpy.float64], numpy.typing.NDArray[numpy.float64]][source]#