Skip to content

Commit

Permalink
fixes #130 (#161)
Browse files Browse the repository at this point in the history
  • Loading branch information
dfm committed Apr 21, 2021
1 parent de30d91 commit 57d5787
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/exoplanet/orbits/keplerian.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,12 @@ def __init__(
"'b' must be provided for a circular orbit with a "
"'duration'"
)
if ror is None:
warnings.warn(
"When using the 'duration' parameter in KeplerianOrbit, "
"the 'ror' parameter should also be provided.",
UserWarning,
)
aor, daordtau = get_aor_from_transit_duration(
duration, period, b, ror=ror
)
Expand Down
18 changes: 18 additions & 0 deletions tests/orbits/keplerian_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,24 @@ def test_get_aor_from_transit_duration():
assert np.allclose(tt.sqrt(x ** 2 + y ** 2).eval(), r_star * (1 + ror))


@pytest.mark.filterwarnings("error::UserWarning")
def test_duration_without_ror_warning():
duration = 0.12
period = 10.1235
b = 0.34
ror = 0.06
r_star = 0.7

with pytest.raises(UserWarning):
KeplerianOrbit(
period=period, t0=0.0, b=b, duration=duration, r_star=r_star
)

KeplerianOrbit(
period=period, t0=0.0, b=b, duration=duration, r_star=r_star, ror=ror
)


def test_jacobians():
duration = 0.12
period = 10.1235
Expand Down

0 comments on commit 57d5787

Please sign in to comment.