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

First light curve parser #10

Merged
merged 5 commits into from
Apr 19, 2023
Merged

Conversation

bmorris3
Copy link
Contributor

This PR implements a first crack at the light curve parser.

If you have a local Kepler FITS data product (or can download one from MAST), you can load it into LCviz with:

from lightkurve import search_lightcurve
from lcviz import LCviz

light_curve = search_lightcurve(
    "HAT-P-11", mission="Kepler", cadence="long", quarter=10
).download()

lcviz = LCviz()

# # Optionally normalize the light curve:
# light_curve = light_curve.normalize()

lcviz.load_data(light_curve)
lcviz.show()

Screen Shot 2023-04-18 at 17 02 09

I've made the x label show the time since the start of the reference data, and it defaults to units of seconds (the WCS default, I think?), and the y label shows units of "Flux" for count rates, and "Relative flux" for dimensionless light curves.

I've written some tests that I had anticipated would fail because of lightkurve/lightkurve#1299, but it looks like that error may have been a mirage from a mismatch of the astropy and lightkurve versions (still investigating).

@codecov
Copy link

codecov bot commented Apr 18, 2023

Codecov Report

Patch coverage: 79.24% and project coverage change: -4.33 ⚠️

Comparison is base (909ed65) 91.82% compared to head (96c1d12) 87.50%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #10      +/-   ##
==========================================
- Coverage   91.82%   87.50%   -4.33%     
==========================================
  Files           9        9              
  Lines         159      192      +33     
==========================================
+ Hits          146      168      +22     
- Misses         13       24      +11     
Impacted Files Coverage Δ
lcviz/parsers.py 67.85% <65.38%> (-32.15%) ⬇️
lcviz/viewers.py 94.59% <90.47%> (-5.41%) ⬇️
lcviz/conftest.py 91.66% <100.00%> (+0.75%) ⬆️
lcviz/helper.py 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Member

@kecnry kecnry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure how I feel about the time since reference thing... we'll likely eventually want options for that in a plugin somewhere... but works for now! Thanks!

@bmorris3
Copy link
Contributor Author

Not sure how I feel about the time since reference thing...

I agree it's not perfect. I usually prefer to plot my transiting exoplanet LCs in units of BJD - <some number>, like this. In general of course, LCs can span only a few seconds, or many years, so having unit options other than seconds would be great.

we'll likely eventually want options for that in a plugin somewhere...

Agreed. This might require a bit of work. I'm using the ndcube TimeTableCoordinate to convert Time objects into gwcs representations of the time axis. TimeTableCoordinate defaults to units of seconds, I think because the WCS TIME spec expects seconds. More to look into there.

@bmorris3
Copy link
Contributor Author

With approval from @kecnry, I'll merge now and make a ticket to follow-up when lightkurve/lightkurve#1299 is addressed. Thanks!

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

Successfully merging this pull request may close these issues.

2 participants