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

lightkurve.LightCurve.create_transit_mask breaks when using astropy units #1141

Closed
decaelus opened this issue Sep 17, 2021 · 2 comments
Closed

Comments

@decaelus
Copy link

Problem description

If I send an orbital period, transit time, and transit duration all with astropy units (which seems to be what the function wants), I get an error about subtracting numbers with units from numbers without units.

Example

import lightkurve as lk
import astropy.units as u

search_result = lk.search_lightcurve("Kepler-13", mission="Kepler")
lc = search_result[3].download()

transit_mask = lc.create_transit_mask(1.7635869*u.d, (718.82552  + 2458000. - 2454833.)*u.d, 0.1359816*u.d)

It's line 2647 in lightcurve.py that produces the error.

Expected behavior

I expected to get a transit mask array.

Environment

  • platform (e.g. Linux, OSX, Windows): Mac OS 11.2.3
  • lightkurve version (e.g. 1.0b6): 2.0.10
  • installation method (e.g. pip, conda, source): pip
@decaelus
Copy link
Author

If I don't send the transit parameters using units, I don't get an error:

transit_mask = lc.create_transit_mask(1.7635869, (718.82552  + 2458000. - 2454833.), 0.1359816)

does NOT throw an error.

@barentsen
Copy link
Collaborator

@decaelus Thank you for reporting this! 👍

The issue is that the method was expecting transit_time to be a Time or a float object. I have modified this over in #1143 to also support Quantity objects.

The example you posted should start working in the next release (v2.0.11).

Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants