Skip to content

Commit

Permalink
Test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
hombit committed Jul 30, 2024
1 parent 9ba17f1 commit c83c13c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/hipscat/pixel_math/healpix_shim.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import numpy as np
import healpy as hp
import numpy as np

# pylint: disable=missing-function-docstring

Expand Down Expand Up @@ -150,6 +150,7 @@ def mindist2avgsize(mindist: np.ndarray) -> np.ndarray:
"""
return mindist * 1.6


def avgsize2order(avg_size_arcmin: np.ndarray) -> np.ndarray:
"""Get the largest order with average healpix size larger than avg_size_arcmin
Expand Down
8 changes: 7 additions & 1 deletion tests/hipscat/pixel_math/test_healpix_shim.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import numpy as np
import pytest
from numpy.testing import assert_allclose, assert_array_equal

from hipscat.pixel_math import healpix_shim as hps
Expand All @@ -22,3 +21,10 @@ def test_order2avgsize2order():
order = np.arange(20)
nside = hps.order2nside(order)
assert_array_equal(hps.avgsize2order(hps.nside2resol(nside, arcmin=True)), order)


def test_margin2order():
"""Test margin2order for some pre-computed values"""
margin_thr_arcmin = np.array([1 / 60, 10 / 60, 1, 5, 60])
orders = np.array([17, 13, 11, 8, 5])
assert_array_equal(hps.margin2order(margin_thr_arcmin), orders)

0 comments on commit c83c13c

Please sign in to comment.