hpparvi / PyTransit

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

Additional transit when using high eccentricity #127

Closed LucaMalavolta closed 3 years ago

LucaMalavolta commented 3 years ago

Dear Hannu, I've been trying out PyTransit and I got an unexpected behaviour when pushing the eccentricity higher than 0.45: a second transit is appearing in the light curve! See the attached plot: pytransit_e_comparison

To Reproduce These are the rather simple steps to reproduce the behavior:

%matplotlib notebook
import numpy as np
import matplotlib.pyplot as plt
from pytransit import QuadraticModel

t_plot = np.arange(0.85, 1.05, 0.00001)
tm = QuadraticModel()

tm.set_data(t_plot)

k, t0, p, a, i, e, w = 0.1, 0., 1., 15., 87./180.*np.pi, 0.4, 47./180.*np.pi
ldc = [0.1, 0.3]
flux_pytransit = tm.evaluate_ps(k, ldc, t0, p, a, i, e, w)

e = 0.50
flux_pytransit_02 = tm.evaluate_ps(k, ldc, t0, p, a, i, e, w)

plt.figure(figsize=(5,5))

plt.plot(t_plot, flux_pytransit_02, c='C1', label="e=0.5")
plt.plot(t_plot, flux_pytransit, c='C0', label="e=0.4")

plt.legend()
plt.xlabel('time')
plt.ylabel('flux')
plt.show()

Expected behavior Only one transit!

Desktop

Thank you for your attention, Luca

hpparvi commented 3 years ago

Thanks for spotting this Luca! I had simplified the calculation of the transit bounding box too much... The issue is now fixed (for the QuadraticModel) in the latest commit. I still need to apply the same fix to the rest of the transit models, but this will need to wait until tomorrow.

LucaMalavolta commented 3 years ago

Hi Hannu, I tried the QuadraticModel, QPower2Model, and RoadRunnerModel, and they all worked without problems! Thank you very much for the quick bugfix, Luca

hpparvi commented 3 years ago

Great, and thanks again for pointing out the bug!