AbstractCrossmatchAlgorithm#

class AbstractCrossmatchAlgorithm[source]#

Abstract class used to write a crossmatch algorithm.

To specify a custom algorithm, write a class that subclasses the AbstractCrossmatchAlgorithm class, and either overwrite the crossmatch or the perform_crossmatch function.

The function should be able to perform a crossmatch on two pandas DataFrames from a partition from each catalog. It should return two 1d numpy arrays of equal lengths with the indices of the matching rows from the left and right dataframes, and a dataframe with any extra columns generated by the crossmatch algorithm, also with the same length. These columns are specified in {AbstractCrossmatchAlgorithm.extra_columns}, with their respective data types, by means of an empty pandas dataframe. As an example, the KdTreeCrossmatch algorithm outputs a “_dist_arcsec” column with the distance between data points. Its extra_columns attribute is specified as follows:

pd.DataFrame({"_dist_arcsec": pd.Series(dtype=np.dtype("float64"))})

The crossmatch/perform_crossmatch methods will receive an instance of CrossmatchArgs which includes the partitions and respective pixel information:

- left_df: npd.NestedFrame
- right_df: npd.NestedFrame
- left_order: int
- left_pixel: int
- right_order: int
- right_pixel: int
- left_catalog_info: hc.catalog.TableProperties
- right_catalog_info: hc.catalog.TableProperties
- right_margin_catalog_info: hc.catalog.TableProperties

Include any algorithm-specific parameters in the initialization of your object. These parameters should be validated in AbstractCrossmatchAlgorithm.validate, by overwriting the method.

Attributes:
extra_columns

Methods

crossmatch(crossmatch_args, how, suffixes[, ...])

Perform a crossmatch.

crossmatch_nested(crossmatch_args, ...)

Perform a crossmatch and store results in nested column.

perform_crossmatch(crossmatch_args)

Performs a crossmatch to get the indices of the matching rows and any extra columns

validate(left, right)

Validate the metadata and arguments.

__init__(*args, **kwargs)#

Methods

__init__(*args, **kwargs)

crossmatch(crossmatch_args, how, suffixes[, ...])

Perform a crossmatch.

crossmatch_nested(crossmatch_args, ...)

Perform a crossmatch and store results in nested column.

perform_crossmatch(crossmatch_args)

Performs a crossmatch to get the indices of the matching rows and any extra columns

validate(left, right)

Validate the metadata and arguments.

Attributes

extra_columns

The metadata for the columns generated by the crossmatch algorithm