Skip to content

Commit 59872d7

Browse files
committed
Started working on the contamination module tests.
1 parent cb0cec2 commit 59872d7

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

tests/test_contamination.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# PyTransit: fast and easy exoplanet transit modelling in Python.
2+
# Copyright (C) 2010-2020 Hannu Parviainen
3+
#
4+
# This program is free software: you can redistribute it and/or modify
5+
# it under the terms of the GNU General Public License as published by
6+
# the Free Software Foundation, either version 3 of the License, or
7+
# (at your option) any later version.
8+
#
9+
# This program is distributed in the hope that it will be useful,
10+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
# GNU General Public License for more details.
13+
#
14+
# You should have received a copy of the GNU General Public License
15+
# along with this program. If not, see <https://www.gnu.org/licenses/>.
16+
17+
import unittest
18+
from math import pi
19+
from numpy import array, copysign, inf
20+
from numpy.testing import assert_almost_equal
21+
22+
from pytransit.contamination import true_radius_ratio, apparent_radius_ratio
23+
24+
25+
class TestContamination(unittest.TestCase):
26+
"""Test the routines to calculate the normalized projected distance (z) assuming zero eccentricity.
27+
"""
28+
def setUp(self):
29+
pass
30+
31+
def test_true_radius_ratio(self):
32+
assert_almost_equal(true_radius_ratio(0.1, 0.0), 0.1)
33+
assert_almost_equal(true_radius_ratio(0.1, 1.0), inf)
34+
35+
def test_apparent_radius_ratio(self):
36+
assert_almost_equal(apparent_radius_ratio(0.1, 0.0), 0.1)
37+
assert_almost_equal(apparent_radius_ratio(0.1, 1.0), 0.0)
38+
39+
40+
if __name__ == '__main__':
41+
unittest.main()

0 commit comments

Comments
 (0)