Skip to content

Commit

Permalink
Merge pull request #118 from astronomy-commons/sandro/update-crossmat…
Browse files Browse the repository at this point in the history
…ch-docs

Update custom crossmatch function docs
  • Loading branch information
camposandro authored Jan 11, 2024
2 parents 20c2d67 + cb7fa01 commit e265018
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
15 changes: 9 additions & 6 deletions src/lsdb/catalog/catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,13 @@ def crossmatch(
The function should be able to perform a crossmatch on two pandas DataFrames
from a HEALPix pixel from each catalog. It should return a dataframe with the
combined set of columns from the input dataframes with the appropriate suffixes,
and a column with the name {AbstractCrossmatchAlgorithm.DISTANCE_COLUMN_NAME}
with the distance between the points.
combined set of columns from the input dataframes with the appropriate suffixes
and, eventually, a set of extra columns generated by the crossmatch algorithm.
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" column with the distance between
data points. Its extra_columns attribute is specified as follows:
`pd.DataFrame({"_DIST": pd.Series(dtype=np.dtype("float64"))})`.
The class will have been initialized with the following parameters, which the
crossmatch function should use:
Expand All @@ -161,9 +165,8 @@ def crossmatch(
pair of neighbors found from cross-matching.
The resulting table contains all columns from the left and right catalogs with their
respective suffixes, and a column with the name
{AbstractCrossmatchAlgorithm.DISTANCE_COLUMN_NAME} with the great circle separation
between the points.
respective suffixes and, whenever specified, a set of extra columns generated by the
crossmatch algorithm.
"""
if suffixes is None:
suffixes = (f"_{self.name}", f"_{other.name}")
Expand Down
3 changes: 1 addition & 2 deletions src/lsdb/core/crossmatch/kdtree_match.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ def crossmatch(
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 column with the name {AbstractCrossmatchAlgorithm.DISTANCE_COLUMN_NAME} with the great
circle separation between the points.
a "_DIST" column with the great circle separation between the points.
"""
# Distance in 3-D space for unit sphere
d_chord = 2.0 * math.sin(math.radians(0.5 * d_thresh))
Expand Down

0 comments on commit e265018

Please sign in to comment.