Skip to content

Commit

Permalink
add moc search to catalog
Browse files Browse the repository at this point in the history
  • Loading branch information
smcguire-cmu committed Nov 18, 2024
1 parent 37e82f6 commit 665eb0c
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/lsdb/catalog/catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import nested_pandas as npd
import pandas as pd
from hats.catalog.index.index_catalog import IndexCatalog as HCIndexCatalog
from mocpy import MOC
from pandas._libs import lib
from pandas._typing import AnyAll, Axis, IndexLabel
from pandas.api.extensions import no_default
Expand All @@ -18,6 +19,7 @@
from lsdb.core.crossmatch.crossmatch_algorithms import BuiltInCrossmatchAlgorithm
from lsdb.core.search import BoxSearch, ConeSearch, IndexSearch, OrderSearch, PolygonSearch
from lsdb.core.search.abstract_search import AbstractSearch
from lsdb.core.search.moc_search import MOCSearch
from lsdb.core.search.pixel_search import PixelSearch
from lsdb.dask.crossmatch_catalog_data import crossmatch_catalog_data
from lsdb.dask.join_catalog_data import (
Expand Down Expand Up @@ -324,6 +326,18 @@ def pixel_search(self, pixels: List[Tuple[int, int]]) -> Catalog:
"""
return self.search(PixelSearch(pixels))

def moc_search(self, moc: MOC, fine: bool = True) -> Catalog:
"""Finds all catalog points that are contained within a moc.
Args:
moc (mocpy.MOC): The moc that defines the region for the search.
fine (bool): True if points are to be filtered, False if only partitions. Defaults to True.
Returns:
A new Catalog containing only the points that are within the moc.
"""
return self.search(MOCSearch(moc, fine=fine))

def search(self, search: AbstractSearch):
"""Find rows by reusable search algorithm.
Expand Down

0 comments on commit 665eb0c

Please sign in to comment.