Skip to content

Commit

Permalink
Introduce warning and fix it.
Browse files Browse the repository at this point in the history
  • Loading branch information
delucchi-cmu committed Feb 15, 2024
1 parent a0080c6 commit 1119f21
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/hipscat/pixel_math/healpix_pixel_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def get_pixel_argsort(pixels: List[HealpixPixel]):
Returns:
array of indices that sort the pixels in breadth-first order.
"""
if not pixels:
if pixels is None or len(pixels) == 0:
return []
# Construct a parallel list of exploded, high order pixels.
highest_order = np.max(pixels).order
Expand Down
6 changes: 6 additions & 0 deletions tests/hipscat/pixel_math/test_healpix_pixel_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,9 @@ def test_get_pixel_argsort(pixel_list_depth_first, pixel_list_breadth_first):
def test_get_pixel_argsort_empty():
argsort = get_pixel_argsort([])
npt.assert_array_equal(argsort, [])

argsort = get_pixel_argsort(None)
npt.assert_array_equal(argsort, [])

argsort = get_pixel_argsort(np.array([]))
npt.assert_array_equal(argsort, [])

0 comments on commit 1119f21

Please sign in to comment.