Skip to content

Commit

Permalink
TST added test for optimized function
Browse files Browse the repository at this point in the history
  • Loading branch information
beckermr committed Aug 24, 2022
1 parent b363411 commit 8a6fe22
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions ngmix/tests/test_prepsfmom.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,34 @@
PrePSFMom,
_gauss_kernels,
_zero_pad_and_compute_fft_cached_impl,
_compute_cen_phase_shift,
_compute_cen_phase_shift_orig,
)
from ngmix import Jacobian
from ngmix import Observation
from ngmix.moments import make_mom_result
import ngmix.flags


@pytest.mark.parametrize("row", [-0.4, 0, 1.2, 4.5])
@pytest.mark.parametrize("col", [-0.32434, 0, 1.43232, 4.56775])
@pytest.mark.parametrize("dim,msk", [
(100, None),
(453, None),
(3, np.array([[True, False, True], [True, True, False], [True, True, True]])),
(4, np.array([
[False, True, False, True],
[False, True, True, False],
[True, True, True, True],
[False, False, True, False]])),
])
def test_cen_phase_shift(row, col, msk, dim):
np.testing.assert_allclose(
_compute_cen_phase_shift(row, col, dim, msk=msk),
_compute_cen_phase_shift_orig(row, col, dim, msk=msk)
)


def _report_info(s, arr, mn, err):
if mn is not None and err is not None:
print(
Expand Down

0 comments on commit 8a6fe22

Please sign in to comment.