From 152cac080ecb33afb62a53a9374c81f4b1281bbb Mon Sep 17 00:00:00 2001 From: arjunsavel Date: Sun, 18 Aug 2024 11:33:22 -0400 Subject: [PATCH] test limb darkening --- src/scope/tests/test_utils.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/scope/tests/test_utils.py b/src/scope/tests/test_utils.py index 28ed1cb..4c262c0 100644 --- a/src/scope/tests/test_utils.py +++ b/src/scope/tests/test_utils.py @@ -2,6 +2,8 @@ import numpy as np +import pytest + from scope.utils import * @@ -30,3 +32,30 @@ def test_cube_normalized_max_still_max(self): n_order, n_exp, n_pix = self.test_cube.shape detrended_cube = detrend_cube(self.test_cube, n_order, n_exp) self.assertTrue(np.all(orig_min_arr == np.argmax(detrended_cube, axis=0))) + + +# todo: benchmark against batman at some point. + + +@pytest.mark.parametrize( + "values, output", + [ + ([0, 0, 1, 0, 1, 0, True], 1.0), # if no coefficients, no LD + ([0, 0, 1, 0, 1, 0, False], 1.0), # but that doesn't matter if LD is turned off + ( + [1, 1, 10 * rsun, 0, 1e-3, 0.3, True], + 0.0, + ), # if there is a really tiny sun, you're not gonna hit the sun + ([1, 1, 1, 0, 1, 0, True], 1.0), # at center phase, should be 1 + ( + [0.3, 0.3, 10 * rsun, 0.0, 1, 0.25, True], + 0.0, + ), # at quadrature you're definitely not transiting! + ( + [0.3, 0.3, 10 * rsun, 1.3, 1, 0.0, True], + 0.0, + ), # non-transiting planets don't transit! + ], +) +def test_calc_limb_darkening(values, output): + assert calc_limb_darkening(*values) == output