Skip to content

Commit

Permalink
test limb darkening
Browse files Browse the repository at this point in the history
  • Loading branch information
arjunsavel committed Aug 18, 2024
1 parent 2d8818b commit 152cac0
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/scope/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import numpy as np

import pytest

from scope.utils import *


Expand Down Expand Up @@ -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

0 comments on commit 152cac0

Please sign in to comment.