Skip to content

Commit

Permalink
Updating test
Browse files Browse the repository at this point in the history
  • Loading branch information
bmorris3 committed Nov 9, 2017
1 parent f374e6f commit 0b457b0
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions mrspoc/tests/test_centroid.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,33 @@


@pytest.mark.parametrize('x', (0.8, 0.6, 0.4, 0.2, 0.0))
def test_col_methods(x):
def test_centroid_small_spots(x):
"""
python -c "from mrspoc.tests.test import test_col_methods as f; f()"
python -c "from mrspoc.tests.test import test_centroid_small_spots as f; f()"
"""
star = Star()
star.spots = [Spot(x=x, y=0.0, r=0.01)]

x0, y0 = star._centroid_analytic()
x1, y1 = star._centroid_numerical()

diff = np.sqrt((x0 - x1)**2 + (y0 - y1)**2)
assert diff < 0.00001


@pytest.mark.parametrize('x', (0.8, 0.6, 0.4, 0.2, 0.0))
def test_centroid_large_spots(x):
"""
python -c "from mrspoc.tests.test import test_centroid_large_spots as f; f()"
"""
star = Star()
star.spots = [Spot(x=x, y=0.00, r=0.2)]
star.spots = [Spot(x=x, y=0.0, r=0.1)]

x0, y0 = star._centroid_analytic()
x1, y1 = star._centroid_numerical()

diff = np.sqrt((x0 - x1)**2 + (y0 - y1)**2)
assert diff < star.r / 100

# Allow for bigger error because large spots are more affected by difference
# in limb-darkening across the spot.
assert diff < 0.0005

0 comments on commit 0b457b0

Please sign in to comment.