Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Non-integer oversampling factors cause index error in TLS pipeline #105

Open
e-gillis opened this issue Jan 12, 2023 · 0 comments
Open

Non-integer oversampling factors cause index error in TLS pipeline #105

e-gillis opened this issue Jan 12, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@e-gillis
Copy link

e-gillis commented Jan 12, 2023

When the Oversampling factor is set to a float with more than one decimal place, or a float less than 1, TLS fails because of an index error in the running_median function because a non-integer kernel is passed into running_median.

This happens when running_median is called through the spectra function, and can be reproduced by running:

from transitleastsquares import transitleastsquares
import numpy as np

# Random noise timeseries
t = np.linspace(0, 30, num=300)
data = np.random.normal(size=t.shape)*0.1 + 1

model = transitleastsquares(t, data)
# Any oversampling factor with more than two decimal places will cause an error
result = model.power(oversampling_factor=3.14)

Adding something like kernel = int(kernel) to the spectra function to ensure that the median filter kernel is an integer should fix this issue.

After submitting, I'm seeing that this was already discussed in the follow-ups to https://github.com/hippke/tls/issues/88, but it seems the bug is still outstanding.

Install Details:
MacOS, Python 3.10.7, TLS Version 1.0.31

@e-gillis e-gillis added the bug Something isn't working label Jan 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant