How to Search for TESS/Kepler/K2 Mission Data with lksearch#

[1]:
from lksearch import MASTSearch, KeplerSearch, K2Search, TESSSearch

Welcome to the new lksearch module! This package allows users to peruse available data products for the TESS, Kepler, and K2 missions. This notebook will guide you through several examples of how to use search functions.

The result of the search is a MASTSearch object, which contains among other things a full list of results stored in a pandas dataframe.

NOTE: While MASTSearch is a usable class, it does not have all of the functionality or nicities of the mission-specific searches (TESSSearch/KeplerSearch/K2Search). It is therefore recommended you as the user interact with these instead.

Basic Searches#

Data Exploration#

The lksearch package provides a user-friendly wrapper to search the MAST data archive. The most generic search is to use MASTsearch, which checks for mission products from three missions (Kepler, K2, and TESS). This search can be useful for data exploration, but does not have full functionality, as discussed below.

In addition, you can specify

  • search_radius: a search radius (assumes arcsec by default, but you can specify anything by using astropy units)

  • exptime: the exposure time of the observation. Either a number or a range in the form of a tuple

  • mission: the mission - only Kepler, K2, and TESS are directly supported

  • pipline: the pipeline(s) used to create the product, eg. Kepler, K2, SPOC, QLP, KBONUS-BKG, etc

and in the case of mission-specific searches

  • a sequence number*

    • sector for TESS

    • quarter/month for Kepler

    • campaign for K2

**NOTE* MASTSearch allows a sequence number, but it will result in selecting the same sequence for all mission. For example, if you provide sequence = 5, it will return only data from TESS sector 5, K2 campaign 5, or Kepler quarter 5.

For data exploration, it is suggested users search with the default setting (ie, providing only the target). You can use the provided class functions to extract the data products you want to download, as demonstrated throughout this tutorial.

[2]:
# First, we can check what data is available by any mission (TESS, Kepler, or K2)
# TOI-1161 is the same as Kepler-13. You can search using either name to get the same results
search_result = MASTSearch("TOI 1161")
search_result
[2]:
MASTSearch object containing 244 data products
target_name pipeline mission exptime distance year description
0 158324245 SPOC TESS 120.0 0.0 2019 full data validation report
1 158324245 SPOC TESS 120.0 0.0 2019 Light curves
2 158324245 SPOC TESS 120.0 0.0 2019 TCE summary report
3 158324245 SPOC TESS 120.0 0.0 2019 Data validation mini report
4 158324245 SPOC TESS 120.0 0.0 2019 Target pixel files
... ... ... ... ... ... ... ...
239 kplr009941662 Kepler Kepler 60.0 0.0 2012 Lightcurve Short Cadence (CSC) - Q14
240 kplr009941662 Kepler Kepler 60.0 0.0 2012 Target Pixel Short Cadence (TPS) - Q14
241 kplr009941662 Kepler Kepler 60.0 0.0 2013 Lightcurve Short Cadence (CSC) - Q17
242 kplr009941662 Kepler Kepler 60.0 0.0 2011 Target Pixel Short Cadence (TPS) - Q11
243 kplr009941662 Kepler Kepler 60.0 0.0 2009 Target Pixel Short Cadence (TPS) - Q2

244 rows × 7 columns

Note that search_result is a MASTSearch object. When calling the object, a summary of the contents (MASTSearch object containing X data products) is printed to the screen along with a subset of the observation table.

The returned MASTSearch object has several properties to easily access specific observation characteristics. These include

  • target name (target_name)

  • right ascension (ra)

  • declination (dec)

  • exposure time (exptime)

  • mission

  • obsrvation year (year)

  • reduction pipeline (pipeline)

  • data location URI (uris)

  • data location in cloud storage (cloud_uris)

[3]:
# Let's use this to check what mission(s) have observed this target
print(search_result.mission)
['TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS'
 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS'
 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS'
 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS'
 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS'
 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'Kepler'
 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler'
 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler'
 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler'
 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler'
 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'TESS'
 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS'
 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS'
 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS'
 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS'
 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS'
 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS'
 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'Kepler' 'Kepler'
 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler'
 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler'
 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler'
 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler'
 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler'
 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler'
 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler'
 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler'
 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler'
 'Kepler' 'Kepler']
[4]:
print(
    f"There are {sum(search_result.mission == 'TESS')} observations by TESS and {sum(search_result.mission == 'Kepler')} by Kepler"
)
There are 128 observations by TESS and 116 by Kepler

Accessing the full result table#

To view all of the results, you can access the ‘table’ variable. This table is a pandas dataframe that contains the full results of the MAST search as well as a few added parameters such as year, start_time, and end_time.

[5]:
search_result.table
[5]:
intentType obs_collection_obs provenance_name instrument_name project_obs filters_obs wavelength_region target_name target_classification obs_id ... size parent_obsid dataRights calib_level_prod filters_prod pipeline mission year start_time end_time
0 science TESS SPOC Photometer TESS TESS Optical 158324245 NaN tess2019198215352-s0014-0000000158324245-0150-s ... 16426251 27448285 PUBLIC 3 TESS SPOC TESS 2019 2019-07-18 20:30:33.624 2019-08-14 16:56:23.634
1 science TESS SPOC Photometer TESS TESS Optical 158324245 NaN tess2019198215352-s0014-0000000158324245-0150-s ... 1964160 27448285 PUBLIC 3 TESS SPOC TESS 2019 2019-07-18 20:30:33.624 2019-08-14 16:56:23.634
2 science TESS SPOC Photometer TESS TESS Optical 158324245 NaN tess2019198215352-s0014-0000000158324245-0150-s ... 1322689 27448285 PUBLIC 3 TESS SPOC TESS 2019 2019-07-18 20:30:33.624 2019-08-14 16:56:23.634
3 science TESS SPOC Photometer TESS TESS Optical 158324245 NaN tess2019198215352-s0014-0000000158324245-0150-s ... 5082604 27448285 PUBLIC 3 TESS SPOC TESS 2019 2019-07-18 20:30:33.624 2019-08-14 16:56:23.634
4 science TESS SPOC Photometer TESS TESS Optical 158324245 NaN tess2019198215352-s0014-0000000158324245-0150-s ... 47376000 27448285 PUBLIC 2 TESS SPOC TESS 2019 2019-07-18 20:30:33.624 2019-08-14 16:56:23.634
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
239 science Kepler Kepler Kepler Kepler KEPLER OPTICAL kplr009941662 NaN kplr009941662_sc_Q003300033333333332 ... 5045760 599738 PUBLIC 2 KEPLER Kepler Kepler 2012 2009-05-02 00:54:00.000 2013-05-11 12:15:00.000
240 science Kepler Kepler Kepler Kepler KEPLER OPTICAL kplr009941662 NaN kplr009941662_sc_Q003300033333333332 ... 76302956 599738 PUBLIC 2 KEPLER Kepler Kepler 2012 2009-05-02 00:54:00.000 2013-05-11 12:15:00.000
241 science Kepler Kepler Kepler Kepler KEPLER OPTICAL kplr009941662 NaN kplr009941662_sc_Q003300033333333332 ... 648000 599738 PUBLIC 2 KEPLER Kepler Kepler 2013 2009-05-02 00:54:00.000 2013-05-11 12:15:00.000
242 science Kepler Kepler Kepler Kepler KEPLER OPTICAL kplr009941662 NaN kplr009941662_sc_Q003300033333333332 ... 130764115 599738 PUBLIC 2 KEPLER Kepler Kepler 2011 2009-05-02 00:54:00.000 2013-05-11 12:15:00.000
243 science Kepler Kepler Kepler Kepler KEPLER OPTICAL kplr009941662 NaN kplr009941662_sc_Q003300033333333332 ... 64708791 599738 PUBLIC 2 KEPLER Kepler Kepler 2009 2009-05-02 00:54:00.000 2013-05-11 12:15:00.000

244 rows × 59 columns

By default, MASTSearch returns any available data provided by an official mission pipeline. This means that any available High Level Science Products (HLSPs) are NOT returned. Additonally, TESS full frame images (FFIs) are not returned by MASTSearch. To search for these data types, we recommend using the mission-specific searches.