barentsen / notebooks

Curated Notebooks from STScI
BSD 3-Clause "New" or "Revised" License
1 stars 0 forks source link

Tutorial: Understanding Target Pixel File Products with Lightkurve #4

Closed ojhall94 closed 4 years ago

ojhall94 commented 4 years ago

This notebook will form part of the series: Getting started with Kepler and K2 data products.

In this second notebook, we will focus on downloading and studying a target pixel file. This will include i.e. looking at the flux in individual pixels, setting a rudimentary aperture, and plotting the background. The user may already be familiar with how to use Light Curve products (#3) we can point back to that. When talking about aperture photometry, it should point forward to #2.

We can draw inspiration from existing Lightkurve tutorials:


Learning Goals:

To think about:

astrobel commented 4 years ago

I think it would be a great idea to include interactive functionality in this tutorial! For the regular interact() function, it might work well to put that near the beginning so users can poke around and then go on to learn what the various functions mean: e.g. under learning goal "what does a TPF look like?" As for interact_sky(), I would certainly find that useful, but as it's auxiliary to the main goal of the notebook, it might be good to put it at the end as a "bonus" example.

ojhall94 commented 4 years ago

Great ideas, thanks Isabel! Hoping to get started on this notebook today or tomorrow.

ojhall94 commented 4 years ago

Finished a first draft of the notebook, it's on Google Drive under the same name as this issue. I'll add some deep links tomorrow or Monday.

barentsen commented 4 years ago

Thanks for posting the draft notebook @ojhall94!

Here are my first impressions:

Feel free to push back of course!!

ojhall94 commented 4 years ago

Thanks for the comments @barentsen!

I've been working through the notebook start to finish implementing your comments, and trying to mimic the style that we settled on for Tutorial #3. For some paragraphs that means I've replicated them verbatim but changed the object names and links. Not sure if this is a good idea or not... I'll let the crowd deci

I'll get on this one tomorrow :)

  • I would emphasize the use of tpf.header() as the way to access metadata. It is of course great to demo show_properties() and explain what all the properties/arrays mean, but the object properties only expose a subset of the metadata.

Unless I'm missing something, there isn't actually a header() method in KeplerTargetPixelFile, but there is the header attribute, which does the same thing. Not sure if this is intended or not.

  • Quite a bit of matplotlib magic was needed to plot the image of the background flux. If we think it is worth plotting the background, should we just add it as a feature of tpf.plot()?

I think it is worth explaining to the user that the background is a thing that exists and is removed (especially if they wind up working with TESS data). It would be trivial to add to tpf.plot(), I could open a PR tomorrow.

barentsen commented 4 years ago

there isn't actually a header() method in KeplerTargetPixelFile, but there is the header attribute, which does the same thing. Not sure if this is intended or not.

Oops, LightCurveFile has a header() method whereas TargetPixelFile has a header attribute. That is inconsistent and bad! I fixed it over in https://github.com/KeplerGO/lightkurve/pull/736. Both classes now have a consistent get_header() method. Please use that!

To use this new feature, you'll have to use the master branch of Lightkurve in Colab. I'll push a new release to pypi in a few days, but the easiest solution for now is to have the notebook install Lightkurve straight from the master branch as follows:

!pip install --quiet git+https://github.com/KeplerGO/lightkurve.git

I think it is worth explaining to the user that the background is a thing ... It would be trivial to add to tpf.plot(), I could open a PR tomorrow.

I think this is a good idea!

ojhall94 commented 4 years ago

Done & done!

ojhall94 commented 4 years ago

At Rebekah's request, I split this tutorial and split in two. Tutorial #4 (this one) is now "Understanding Target Pixel File Products with Lightkurve", which focuses on the basics of downloading a TPF, plotting it, and understanding the metadata.

The new tutorial #9 instead focuses on plotting and understanding background file products and performing simple aperture photometry with Lightkurve's built in tools, to build a foundation for more advanced aperture photometry later on (see #2).

barentsen commented 4 years ago

I'm fine with splitting this tutorial in two, but I recommend adding at least one or two cells to the shortened "Understanding TPFs" tutorial which explain what tpf.time and tpf.flux contain. Those properties are the raison d'être of TPFs after all.

ojhall94 commented 4 years ago

Done!

ojhall94 commented 4 years ago

Updated this notebook to be Lightkurve 2.0 compatible.

barentsen commented 4 years ago

I carried out a final review and made a few changes:

lglattly commented 4 years ago

@ojhall94 and @barentsen I finished copy editing this tutorial "Using Kepler Target Pixel File Products with Lightkurve."

As with the other tutorials, I made small copy editing changes throughout, and I also combined the information from summary and companion content into the Introduction section as per the tutorial template. I also made sure that all of the terms used were defined in text, and then I removed the Defining Terms section, as per the template. Here again, I didn't touch the Additional Resources section in case there are resources listed that need to be worked into the text somehow (there might be a few at the bottom of the list, the rest I saw linked to in the text).

Other than the Additional Resources section incorporation, the tutorial is all set on my end and ready to go!

barentsen commented 4 years ago

Thank you! I reviewed the Additional Resources section and believe all the necessary materials are linked in the text.

barentsen commented 4 years ago

This notebook has successfully been merged into spacetelescope/notebooks. Thanks everyone! Closing the issue...