hpparvi / PyTransit

Fast and easy exoplanet transit light curve modelling.
GNU General Public License v2.0
102 stars 24 forks source link

EclipseModel broken #132

Closed delinea closed 3 years ago

delinea commented 3 years ago

When calling evaluate_ps in an EclipseModel instance, it returns a constant flux equal to 1 for all times. I might have identified the issue as coming from the function pytransit.orbits.taylor_z.t14 used in uniform_model_s (and uniform_model_v) to compute the variable half_window_width. For eclipse configurations, t14 returns negative values, which in turn generates a negative half_window_width and prevents points to fall in the eclipse window. A quick fix I implemented locally is modifying lines 174-178 of pytransit/models/numba/ma_uniform_nb.py as follows:

if zsign >= 0:
    y0, vx, vy, ax, ay, jx, jy, sx, sy = vajs_from_paiew(p, a, i, e, w)
    et = 0.0
    half_window_width = 0.025 + 0.5 * t14(k[0], y0, vx, vy, ax, ay, jx, jy, sx, sy)
else:
    et, y0, vx, vy, ax, ay, jx, jy, sx, sy = vajs_from_paiew_eclipse(p, a, i, e, w)
    half_window_width = 0.025 - 0.5 * t14(k[0], y0, vx, vy, ax, ay, jx, jy, sx, sy)

The same correction might be needed for the function uniform_model_v.

hpparvi commented 3 years ago

Thanks, @delinea! I introduced this bug recently when improving the calculation of the bounding box of the transit. The issue is fixed now.