Skip to content

Commit

Permalink
Merge pull request #100 from rapoliveira/bugfix-negative-u0-teff
Browse files Browse the repository at this point in the history
Fix bug #99, related to negative u_0
  • Loading branch information
rpoleski authored Sep 29, 2023
2 parents 537e33c + 4f4205f commit 179ceef
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion source/MulensModel/modelparameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -975,7 +975,7 @@ def t_E(self):
return self.t_star / self.rho
elif ('t_eff' in self.parameters.keys() and
'u_0' in self.parameters.keys()):
return self.t_eff / self.u_0
return self.t_eff / abs(self.u_0)
else:
raise KeyError("You're trying to access t_E that was not set")

Expand Down
13 changes: 13 additions & 0 deletions source/MulensModel/tests/test_ModelParameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,19 @@ def test_repr_t_0_kep():
assert (out_1 + out_2) == str(params)


def test_positive_t_E():
"""
Check if t_E is positive when t_eff is given, even if u_0 is negative.
"""
t_0 = 10205.1
u_0 = -0.50
t_eff = 12.5
params = mm.ModelParameters({'t_0': t_0, 'u_0': u_0, 't_eff': t_eff})

assert params.t_E >= 0.
assert params.t_E == params.t_eff / abs(params.u_0)


def test_rho_t_e_t_star():
"""check if conversions between rho, t_E, and t_star work ok"""
t_0 = 2450000.
Expand Down
2 changes: 1 addition & 1 deletion source/MulensModel/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "2.18.0"
__version__ = "2.18.1"

0 comments on commit 179ceef

Please sign in to comment.