{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Quickstart" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "If you have a working version of Python installed on your system, it is easy to install Lightkurve and its dependencies using the ``pip`` package manager. In a terminal window or Jupyter notebook cell, type:\n", "```\n", "! python -m pip install lightkurve --upgrade\n", "```\n", "\n", "See our [installation instructions](about/install.rst) page for details and troubleshooting information.\n", "\n", "With Lightkurve installed, it is easy to extract brightness time series data (astronomers call this a *light curve*)\n", "from the tiny images of stars collected by NASA's Kepler and TESS planet-hunting telescopes.\n", "\n", "For example, let's download and display the pixels of a famous star named [KIC 8462852](https://en.wikipedia.org/wiki/KIC_8462852), also known as *Tabby's Star* or *Boyajian's Star*, which is known to show unusual light fluctuations.\n", "\n", "First, we start Python and use the `search_targetpixelfile` function to obtain the Kepler pixel data for the star from the [data archive](https://archive.stsci.edu/kepler/):" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from lightkurve import search_targetpixelfile\n", "pixelfile = search_targetpixelfile(\"KIC 8462852\", quarter=16).download();" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Next, let's display the first image in this data set:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "pixelfile.plot(frame=1);" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "It looks like the star is an isolated object, so we can extract a light curve by simply summing up all the pixel values in each image:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "lc = pixelfile.to_lightcurve(aperture_mask='all');" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The above method returned a `LightCurve` object which gives us access to the number of photons received by the spacecraft over time (known as the *flux*). The time is an [AstroPy Time object](https://docs.astropy.org/en/stable/time/) in units of *days*:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "lc.time" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The flux is an [AstroPy Quantity object](https://docs.astropy.org/en/stable/units/) in units *electrons/second*:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "lc.flux" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We can plot these data using the `plot()` method:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "lc.plot();" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The plot reveals a short-lived 20% dip in the brightness of the star. It looks like we re-discovered one of the [intriguing dips in Tabby's star](https://en.wikipedia.org/wiki/KIC_8462852#Luminosity).\n", "\n", "Congratulations, you are now able to make new discoveries in Kepler and TESS data!\n", "\n", "Next, head to our [tutorials section](https://docs.lightkurve.org/tutorials) to be guided through more detailed examples of carrying out science with Lightkurve!" ] } ], "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.8.6" } }, "nbformat": 4, "nbformat_minor": 4 }