{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Target Pixel Files\n", "\n", "The `lightkurve` documention has *awesome* resources for playing with Target Pixel Files (TPFs) from Kepler or TESS. Go look [there](http://docs.lightkurve.org)! However, we added a few small wrappers to make it very slightly easier to download a simple Target Pixel File for either Kepler, K2, or TESS. Here's the scoop:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import henrietta as hsl" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Downloading TPFs" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "For Kepler, you'll need to specify a Kepler quarter, a period of roughly 90 days. Remember that the pixels rotate on the sky 4 times a year, so you can't seamlessly stitch together multiple TPFs." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "tpf_kepler = hsl.download_kepler_tpf('Kepler-7', quarter=2)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "For K2, you can include a star name or an EPIC ID number (which can often be found on the NASA Exoplanet Archive)." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "tpf_k2 = hsl.download_k2_tpf(206103150)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "For TESS, only a *tiny* fraction of the data is available right now, all located at [MAST](https://archive.stsci.edu/prepds/tess-data-alerts/). Still, here's a wrapper to download a star, based on its TESS Input Catalog (TIC) identification number." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "tpf_tess = hsl.download_tess_tpf(25155310)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Simple TPF Procedures" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "This is just a tiny sample of things you can do with a TPF. Again, you should go read the `lightkurve` [documentation and tutorials](http://docs.lightkurve.org) for TPFs! You can make an imshow plot of a single frame, where you specify which image you want in the movie via the `frame` keyword." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "tpf_k2.plot(frame=0)\n", "tpf_k2.plot(frame=100);" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "You can make a light curve from the TPF." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "lc =tpf_k2.to_lightcurve(aperture_mask='all')\n", "lc.scatter();" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "You can access the times and the array of fluxes directly." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "time = tpf_k2.time\n", "movie = tpf_k2.flux\n", "print('This TPF has {} times and an array of pixels with shape {}.'.format(len(time), movie.shape))" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.6.5" } }, "nbformat": 4, "nbformat_minor": 2 }