Skip to content

Commit

Permalink
Test box edge case with dec of 90 deg
Browse files Browse the repository at this point in the history
  • Loading branch information
camposandro committed Nov 22, 2024
1 parent 9387b06 commit 0f36391
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
8 changes: 4 additions & 4 deletions tests/lsdb/catalog/test_box_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def test_box_search_filters_correct_points_margin(


def test_box_search_ra_complement(small_sky_order1_catalog):
dec = (-90, 89)
dec = (-90, 90)
ra_column = small_sky_order1_catalog.hc_structure.catalog_info.ra_column

ra_search_catalog = small_sky_order1_catalog.box_search(ra=(280, 300), dec=dec)
Expand All @@ -55,7 +55,7 @@ def test_box_search_ra_complement(small_sky_order1_catalog):


def test_box_search_ra_wrapped_filters_correct_points(small_sky_order1_catalog):
dec = (-90, 89)
dec = (-90, 90)
ra_column = small_sky_order1_catalog.hc_structure.catalog_info.ra_column
ra_search_catalog = small_sky_order1_catalog.box_search(ra=(330, 30), dec=dec)
filtered_ra_values = ra_search_catalog.compute()[ra_column]
Expand All @@ -68,7 +68,7 @@ def test_box_search_ra_wrapped_filters_correct_points(small_sky_order1_catalog):


def test_box_search_ra_boundary(small_sky_order1_catalog):
dec = (-40, -30)
dec = (-90, 90)
ra_column = small_sky_order1_catalog.hc_structure.catalog_info.ra_column
dec_column = small_sky_order1_catalog.hc_structure.catalog_info.dec_column

Expand All @@ -79,7 +79,7 @@ def test_box_search_ra_boundary(small_sky_order1_catalog):

assert len(ra_search_df) > 0
assert all((0 <= ra <= 360) for ra in ra_values)
assert all((-40 <= dec <= -30) for dec in dec_values)
assert all((-90 <= dec <= 90) for dec in dec_values)

for ra_range in [(0, 360), (360, 0)]:
catalog_df = small_sky_order1_catalog.box_search(ra=ra_range, dec=dec).compute()
Expand Down
7 changes: 0 additions & 7 deletions tests/lsdb/catalog/test_polygon_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,6 @@ def test_polygon_search_invalid_dec(small_sky_order1_catalog):
small_sky_order1_catalog.polygon_search(vertices)


def test_polygon_search_invalid_shape(small_sky_order1_catalog):
"""The polygon is not convex, so the shape is invalid"""
with pytest.raises(ValueError, match=ValidatorsErrors.INVALID_CONCAVE_SHAPE):
vertices = [(45, 30), (60, 60), (90, 45), (60, 50)]
small_sky_order1_catalog.polygon_search(vertices)


def test_polygon_search_invalid_polygon(small_sky_order1_catalog):
with pytest.raises(ValueError, match=ValidatorsErrors.INVALID_NUM_VERTICES):
vertices = [(100.1, -20.3), (100.1, 40.3)]
Expand Down

0 comments on commit 0f36391

Please sign in to comment.