Binder badge

How to open a light curve in Excel?

Learning Goals

By the end of this tutorial, you will:

  • Learn how to search and download TESS light curves.

  • Make a quick plot of a light curve you found.

  • Understand how to load the data into Excel.

This tutorial is aimed at first time users who may not have used Lightkurve before.

Imports

First we must install and import the Lightkurve package. We can do this as follows:

[ ]:
# This step is not necessary if you have already installed Lightkurve
!pip install lightkurve --quiet
[1]:
%matplotlib inline
import lightkurve as lk

1. Downloading a TESS light curve

The light curves of stars created by the TESS mission are stored at the Mikulksi Archive for Space Telescopes (MAST) archive, along with metadata about the observations, such as which CCD channel was used at each time.

Lightkurve’s built-in tools allow us to search for light curve files in the archive, and download them and their metadata. In this example, we will start by downloading one sector of TESS data for a star named V1357 Cyg, also known as Cygnus X-1. V1357 Cyg is a galactic X-ray source in the constellation Cygnus.

Using Lightkurve’s search_lightcurve function, we can find an itemized list of light curves produced by different data analysis pipelines:

[2]:
search_result = lk.search_lightcurve("V1357 Cyg")
search_result
[2]:
SearchResult containing 3 data products.
#missionyearauthorexptimetarget_namedistance
sarcsec
0TESS Sector 142019SPOC1201026046450.0
1TESS Sector 142019TESS-SPOC18001026046450.0
2TESS Sector 142019QLP18001026046450.0

By clicking on each of the “author” links above, you will obtain a description of the product and how each one is different from the other. The acronym SPOC refers to the TESS data calibration pipeline provided by NASA Ames, and QLP refers to the Quiclook Pipeline in use by the mission team at MIT.

We can download the first data product by specifying its index number in rectangular brackets:

[3]:
lc = search_result[0].download()

2. Plotting a light curve

Before loading the light curve data into Excel, it can be useful to have a quick look at the data using Lightkurve’s plot function:

[4]:
lc.plot();
../../_images/tutorials_1-getting-started_how-to-open-a-lightcurve-in-excel_10_0.png

3. Download the light curve as an Excel spreadsheet

If you are new to Python, it is likely that you feel more comfortable inspecting and analyzing a light curve in Excel than in Python. That is fine! We can save the light curve data as an Excel spreadsheet named “V1357Cyg.xlsx” as follows:

[5]:
lc.to_excel("V1357Cyg.xlsx")

This file will be available on your local drive. If you run this notebook in a Google Colab environment, you can download the file as follows:

[ ]:
from google.colab import files
files.download("V1357Cyg.xlsx")