{ "cells": [ { "cell_type": "markdown", "id": "8362de11", "metadata": {}, "source": [ "# Tutorial" ] }, { "cell_type": "code", "execution_count": 1, "id": "9f07ac77", "metadata": {}, "outputs": [], "source": [ "from lksearch import MASTSearch, KeplerSearch, K2Search, TESSSearch" ] }, { "cell_type": "markdown", "id": "5fa70bc4", "metadata": {}, "source": [ "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. \n", "\n", "The result of the search is a MASTSearch object, which contains among other things a full list of results stored in a pandas dataframe.\n", "\n", "*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.*\n" ] }, { "cell_type": "markdown", "id": "5b7aff9d", "metadata": {}, "source": [ "## Basic Searches\n", "\n", "\n", "### Data Exploration\n", "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.\n", "\n", "In addition, you can specify \n", "\n", "- search_radius: a search radius (assumes arcsec by default, but you can specify anything by using astropy units)\n", "- exptime: the exposure time of the observation. Either a number or a range in the form of a tuple\n", "- mission: the mission - only Kepler, K2, and TESS are directly supported\n", "- pipline: the pipeline(s) used to create the product, eg. Kepler, K2, SPOC, QLP, KBONUS-BKG, etc\n", "\n", "and in the case of mission-specific searches\n", "\n", "- a sequence number*\n", " - sector for TESS\n", " - quarter/month for Kepler\n", " - campaign for K2\n", " \n", "**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. \n", "\n", "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. " ] }, { "cell_type": "code", "execution_count": 2, "id": "a11826c6", "metadata": {}, "outputs": [ { "data": { "text/html": [ "MASTSearch object containing 244 data products \n", "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
target_namepipelinemissionexptimedistanceyeardescription
0158324245SPOCTESS120.00.02019full data validation report
1158324245SPOCTESS120.00.02019Light curves
2158324245SPOCTESS120.00.02019TCE summary report
3158324245SPOCTESS120.00.02019Data validation mini report
4158324245SPOCTESS120.00.02019Target pixel files
........................
239kplr009941662KeplerKepler60.00.02012Lightcurve Short Cadence (CSC) - Q14
240kplr009941662KeplerKepler60.00.02012Target Pixel Short Cadence (TPS) - Q14
241kplr009941662KeplerKepler60.00.02013Lightcurve Short Cadence (CSC) - Q17
242kplr009941662KeplerKepler60.00.02011Target Pixel Short Cadence (TPS) - Q11
243kplr009941662KeplerKepler60.00.02009Target Pixel Short Cadence (TPS) - Q2
\n", "

244 rows × 7 columns

\n", "
" ], "text/plain": [ "MASTSearch object containing 244 data products \n", " target_name pipeline mission exptime distance year \\\n", "0 158324245 SPOC TESS 120.0 0.0 2019 \n", "1 158324245 SPOC TESS 120.0 0.0 2019 \n", "2 158324245 SPOC TESS 120.0 0.0 2019 \n", "3 158324245 SPOC TESS 120.0 0.0 2019 \n", "4 158324245 SPOC TESS 120.0 0.0 2019 \n", ".. ... ... ... ... ... ... \n", "239 kplr009941662 Kepler Kepler 60.0 0.0 2012 \n", "240 kplr009941662 Kepler Kepler 60.0 0.0 2012 \n", "241 kplr009941662 Kepler Kepler 60.0 0.0 2013 \n", "242 kplr009941662 Kepler Kepler 60.0 0.0 2011 \n", "243 kplr009941662 Kepler Kepler 60.0 0.0 2009 \n", "\n", " description \n", "0 full data validation report \n", "1 Light curves \n", "2 TCE summary report \n", "3 Data validation mini report \n", "4 Target pixel files \n", ".. ... \n", "239 Lightcurve Short Cadence (CSC) - Q14 \n", "240 Target Pixel Short Cadence (TPS) - Q14 \n", "241 Lightcurve Short Cadence (CSC) - Q17 \n", "242 Target Pixel Short Cadence (TPS) - Q11 \n", "243 Target Pixel Short Cadence (TPS) - Q2 \n", "\n", "[244 rows x 7 columns]" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# First, we can check what data is available by any mission (TESS, Kepler, or K2)\n", "# TOI-1161 is the same as Kepler-13. You can search using either name to get the same results\n", "search_result = MASTSearch(\"TOI 1161\")\n", "search_result" ] }, { "cell_type": "markdown", "id": "ccb2974d", "metadata": {}, "source": [ "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. \n", "\n", "The returned MASTSearch object has several properties to easily access specific observation characteristics. These include \n", "\n", "- target name (target_name)\n", "- right ascension (ra)\n", "- declination (dec)\n", "- exposure time (exptime)\n", "- mission\n", "- obsrvation year (year)\n", "- reduction pipeline (pipeline)\n", "- data location URI (uris)\n", "- data location in cloud storage (cloud_uris)\n", "\n" ] }, { "cell_type": "code", "execution_count": 3, "id": "d00e075a", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "['TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS'\n", " 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS'\n", " 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS'\n", " 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS'\n", " 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS'\n", " 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'Kepler'\n", " 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler'\n", " 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler'\n", " 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler'\n", " 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler'\n", " 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'TESS'\n", " 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS'\n", " 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS'\n", " 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS'\n", " 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS'\n", " 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS'\n", " 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS'\n", " 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'TESS' 'Kepler' 'Kepler'\n", " 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler'\n", " 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler'\n", " 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler'\n", " 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler'\n", " 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler'\n", " 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler'\n", " 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler'\n", " 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler'\n", " 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler' 'Kepler'\n", " 'Kepler' 'Kepler']\n" ] } ], "source": [ "# Let's use this to check what mission(s) have observed this target\n", "print(search_result.mission)" ] }, { "cell_type": "code", "execution_count": 4, "id": "40019699", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "There are 128 observations by TESS and 116 by Kepler\n" ] } ], "source": [ "print(\n", " f\"There are {sum(search_result.mission == 'TESS')} observations by TESS and {sum(search_result.mission == 'Kepler')} by Kepler\"\n", ")" ] }, { "cell_type": "markdown", "id": "f4609447", "metadata": {}, "source": [ "### Accessing the full result table" ] }, { "cell_type": "markdown", "id": "2817c1fb", "metadata": {}, "source": [ "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*. " ] }, { "cell_type": "code", "execution_count": 5, "id": "6f0ba5f1", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
intentTypeobs_collection_obsprovenance_nameinstrument_nameproject_obsfilters_obswavelength_regiontarget_nametarget_classificationobs_id...sizeparent_obsiddataRightscalib_level_prodfilters_prodpipelinemissionyearstart_timeend_time
0scienceTESSSPOCPhotometerTESSTESSOptical158324245NaNtess2019198215352-s0014-0000000158324245-0150-s...1642625127448285PUBLIC3TESSSPOCTESS20192019-07-18 20:30:33.6242019-08-14 16:56:23.634
1scienceTESSSPOCPhotometerTESSTESSOptical158324245NaNtess2019198215352-s0014-0000000158324245-0150-s...196416027448285PUBLIC3TESSSPOCTESS20192019-07-18 20:30:33.6242019-08-14 16:56:23.634
2scienceTESSSPOCPhotometerTESSTESSOptical158324245NaNtess2019198215352-s0014-0000000158324245-0150-s...132268927448285PUBLIC3TESSSPOCTESS20192019-07-18 20:30:33.6242019-08-14 16:56:23.634
3scienceTESSSPOCPhotometerTESSTESSOptical158324245NaNtess2019198215352-s0014-0000000158324245-0150-s...508260427448285PUBLIC3TESSSPOCTESS20192019-07-18 20:30:33.6242019-08-14 16:56:23.634
4scienceTESSSPOCPhotometerTESSTESSOptical158324245NaNtess2019198215352-s0014-0000000158324245-0150-s...4737600027448285PUBLIC2TESSSPOCTESS20192019-07-18 20:30:33.6242019-08-14 16:56:23.634
..................................................................
239scienceKeplerKeplerKeplerKeplerKEPLEROPTICALkplr009941662NaNkplr009941662_sc_Q003300033333333332...5045760599738PUBLIC2KEPLERKeplerKepler20122009-05-02 00:54:00.0002013-05-11 12:15:00.000
240scienceKeplerKeplerKeplerKeplerKEPLEROPTICALkplr009941662NaNkplr009941662_sc_Q003300033333333332...76302956599738PUBLIC2KEPLERKeplerKepler20122009-05-02 00:54:00.0002013-05-11 12:15:00.000
241scienceKeplerKeplerKeplerKeplerKEPLEROPTICALkplr009941662NaNkplr009941662_sc_Q003300033333333332...648000599738PUBLIC2KEPLERKeplerKepler20132009-05-02 00:54:00.0002013-05-11 12:15:00.000
242scienceKeplerKeplerKeplerKeplerKEPLEROPTICALkplr009941662NaNkplr009941662_sc_Q003300033333333332...130764115599738PUBLIC2KEPLERKeplerKepler20112009-05-02 00:54:00.0002013-05-11 12:15:00.000
243scienceKeplerKeplerKeplerKeplerKEPLEROPTICALkplr009941662NaNkplr009941662_sc_Q003300033333333332...64708791599738PUBLIC2KEPLERKeplerKepler20092009-05-02 00:54:00.0002013-05-11 12:15:00.000
\n", "

244 rows × 59 columns

\n", "
" ], "text/plain": [ " intentType obs_collection_obs provenance_name instrument_name project_obs \\\n", "0 science TESS SPOC Photometer TESS \n", "1 science TESS SPOC Photometer TESS \n", "2 science TESS SPOC Photometer TESS \n", "3 science TESS SPOC Photometer TESS \n", "4 science TESS SPOC Photometer TESS \n", ".. ... ... ... ... ... \n", "239 science Kepler Kepler Kepler Kepler \n", "240 science Kepler Kepler Kepler Kepler \n", "241 science Kepler Kepler Kepler Kepler \n", "242 science Kepler Kepler Kepler Kepler \n", "243 science Kepler Kepler Kepler Kepler \n", "\n", " filters_obs wavelength_region target_name target_classification \\\n", "0 TESS Optical 158324245 NaN \n", "1 TESS Optical 158324245 NaN \n", "2 TESS Optical 158324245 NaN \n", "3 TESS Optical 158324245 NaN \n", "4 TESS Optical 158324245 NaN \n", ".. ... ... ... ... \n", "239 KEPLER OPTICAL kplr009941662 NaN \n", "240 KEPLER OPTICAL kplr009941662 NaN \n", "241 KEPLER OPTICAL kplr009941662 NaN \n", "242 KEPLER OPTICAL kplr009941662 NaN \n", "243 KEPLER OPTICAL kplr009941662 NaN \n", "\n", " obs_id ... size \\\n", "0 tess2019198215352-s0014-0000000158324245-0150-s ... 16426251 \n", "1 tess2019198215352-s0014-0000000158324245-0150-s ... 1964160 \n", "2 tess2019198215352-s0014-0000000158324245-0150-s ... 1322689 \n", "3 tess2019198215352-s0014-0000000158324245-0150-s ... 5082604 \n", "4 tess2019198215352-s0014-0000000158324245-0150-s ... 47376000 \n", ".. ... ... ... \n", "239 kplr009941662_sc_Q003300033333333332 ... 5045760 \n", "240 kplr009941662_sc_Q003300033333333332 ... 76302956 \n", "241 kplr009941662_sc_Q003300033333333332 ... 648000 \n", "242 kplr009941662_sc_Q003300033333333332 ... 130764115 \n", "243 kplr009941662_sc_Q003300033333333332 ... 64708791 \n", "\n", " parent_obsid dataRights calib_level_prod filters_prod pipeline \\\n", "0 27448285 PUBLIC 3 TESS SPOC \n", "1 27448285 PUBLIC 3 TESS SPOC \n", "2 27448285 PUBLIC 3 TESS SPOC \n", "3 27448285 PUBLIC 3 TESS SPOC \n", "4 27448285 PUBLIC 2 TESS SPOC \n", ".. ... ... ... ... ... \n", "239 599738 PUBLIC 2 KEPLER Kepler \n", "240 599738 PUBLIC 2 KEPLER Kepler \n", "241 599738 PUBLIC 2 KEPLER Kepler \n", "242 599738 PUBLIC 2 KEPLER Kepler \n", "243 599738 PUBLIC 2 KEPLER Kepler \n", "\n", " mission year start_time end_time \n", "0 TESS 2019 2019-07-18 20:30:33.624 2019-08-14 16:56:23.634 \n", "1 TESS 2019 2019-07-18 20:30:33.624 2019-08-14 16:56:23.634 \n", "2 TESS 2019 2019-07-18 20:30:33.624 2019-08-14 16:56:23.634 \n", "3 TESS 2019 2019-07-18 20:30:33.624 2019-08-14 16:56:23.634 \n", "4 TESS 2019 2019-07-18 20:30:33.624 2019-08-14 16:56:23.634 \n", ".. ... ... ... ... \n", "239 Kepler 2012 2009-05-02 00:54:00.000 2013-05-11 12:15:00.000 \n", "240 Kepler 2012 2009-05-02 00:54:00.000 2013-05-11 12:15:00.000 \n", "241 Kepler 2013 2009-05-02 00:54:00.000 2013-05-11 12:15:00.000 \n", "242 Kepler 2011 2009-05-02 00:54:00.000 2013-05-11 12:15:00.000 \n", "243 Kepler 2009 2009-05-02 00:54:00.000 2013-05-11 12:15:00.000 \n", "\n", "[244 rows x 59 columns]" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "search_result.table" ] }, { "cell_type": "markdown", "id": "aec0846f", "metadata": {}, "source": [ "\n", "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. " ] }, { "cell_type": "markdown", "id": "dc2310c7", "metadata": {}, "source": [ "## TESS search" ] }, { "cell_type": "code", "execution_count": 6, "id": "fe421e01", "metadata": {}, "outputs": [ { "data": { "text/html": [ "TESSSearch object containing 236 data products \n", "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
target_namepipelinemissionsectorexptimedistanceyeardescription
0158324245SPOCTESS14120.00.02019Target pixel files
1158324245SPOCTESS14120.00.02019full data validation report
2158324245SPOCTESS14120.00.02019Data validation mini report
3158324245SPOCTESS14120.00.02019TCE summary report
4158324245SPOCTESS14120.00.02019Light curves
...........................
2311717079071QLPHLSP55600.00.02022FITS
2321717079066QLPHLSP55600.00.02022FITS
233158324245QLPHLSP74200.00.02024FITS
2341717079066QLPHLSP74200.00.02024FITS
2351717079071QLPHLSP74200.00.02024FITS
\n", "

236 rows × 8 columns

\n", "
" ], "text/plain": [ "TESSSearch object containing 236 data products \n", " target_name pipeline mission sector exptime distance year \\\n", "0 158324245 SPOC TESS 14 120.0 0.0 2019 \n", "1 158324245 SPOC TESS 14 120.0 0.0 2019 \n", "2 158324245 SPOC TESS 14 120.0 0.0 2019 \n", "3 158324245 SPOC TESS 14 120.0 0.0 2019 \n", "4 158324245 SPOC TESS 14 120.0 0.0 2019 \n", ".. ... ... ... ... ... ... ... \n", "231 1717079071 QLP HLSP 55 600.0 0.0 2022 \n", "232 1717079066 QLP HLSP 55 600.0 0.0 2022 \n", "233 158324245 QLP HLSP 74 200.0 0.0 2024 \n", "234 1717079066 QLP HLSP 74 200.0 0.0 2024 \n", "235 1717079071 QLP HLSP 74 200.0 0.0 2024 \n", "\n", " description \n", "0 Target pixel files \n", "1 full data validation report \n", "2 Data validation mini report \n", "3 TCE summary report \n", "4 Light curves \n", ".. ... \n", "231 FITS \n", "232 FITS \n", "233 FITS \n", "234 FITS \n", "235 FITS \n", "\n", "[236 rows x 8 columns]" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Search for TESS data only. This by default includes both HLSPs and FFI cutouts.\n", "toi = TESSSearch(\"TOI 1161\")\n", "toi" ] }, { "cell_type": "markdown", "id": "6d95e55d", "metadata": {}, "source": [ "There are 200+ TESS data products available for this target. Note that this is more than were returned by our first MASTsearch. These 'extra' data products come from non-mission sources. The 'pipeline' column shows what pipeline was used to generate the data product. The 'mission' column simply reports if the data is a mission product or HLSP. Another addition for the TESSSearch is the 'sector' column. This column is only populated in the TESSSearch call, so is not available when using MASTSearch. \n", "\n", "Now that we know that TESS has observed this target, we may want to restrict our search to match our needs. Below we demonstrate some common filtering examples. " ] }, { "cell_type": "code", "execution_count": 7, "id": "1f2280c5", "metadata": {}, "outputs": [ { "data": { "text/html": [ "TESSSearch object containing 86 data products \n", "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
target_namepipelinemissionsectorexptimedistanceyeardescription
0158324245SPOCTESS14120.00.02019Light curves
1158324245SPOCTESS15120.00.02019Light curves
2158324245SPOCTESS26120.00.02020Light curves
31717079071SPOCTESS26120.00.02020Light curves
41717079066SPOCTESS40120.00.02021Light curves
...........................
811717079071QLPHLSP55600.00.02022FITS
821717079066QLPHLSP55600.00.02022FITS
83158324245QLPHLSP74200.00.02024FITS
841717079066QLPHLSP74200.00.02024FITS
851717079071QLPHLSP74200.00.02024FITS
\n", "

86 rows × 8 columns

\n", "
" ], "text/plain": [ "TESSSearch object containing 86 data products \n", " target_name pipeline mission sector exptime distance year description\n", "0 158324245 SPOC TESS 14 120.0 0.0 2019 Light curves\n", "1 158324245 SPOC TESS 15 120.0 0.0 2019 Light curves\n", "2 158324245 SPOC TESS 26 120.0 0.0 2020 Light curves\n", "3 1717079071 SPOC TESS 26 120.0 0.0 2020 Light curves\n", "4 1717079066 SPOC TESS 40 120.0 0.0 2021 Light curves\n", ".. ... ... ... ... ... ... ... ...\n", "81 1717079071 QLP HLSP 55 600.0 0.0 2022 FITS\n", "82 1717079066 QLP HLSP 55 600.0 0.0 2022 FITS\n", "83 158324245 QLP HLSP 74 200.0 0.0 2024 FITS\n", "84 1717079066 QLP HLSP 74 200.0 0.0 2024 FITS\n", "85 1717079071 QLP HLSP 74 200.0 0.0 2024 FITS\n", "\n", "[86 rows x 8 columns]" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Only return timeseries (lightcurve) products\n", "toi_lc = toi.timeseries\n", "toi_lc" ] }, { "cell_type": "code", "execution_count": 8, "id": "25a156f7", "metadata": {}, "outputs": [ { "data": { "text/html": [ "TESSSearch object containing 46 data products \n", "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
target_namepipelinemissionsectorexptimedistanceyeardescription
0158324245SPOCTESS14120.00.02019Target pixel files
1158324245SPOCTESS15120.00.02019Target pixel files
2158324245SPOCTESS26120.00.02020Target pixel files
31717079071SPOCTESS26120.00.02020Target pixel files
41717079066SPOCTESS40120.00.02021Target pixel files
...........................
41TOI 1161TESScutTESS Sector 5353600.00.02022TESS FFI Cutout (sector 53)
42TOI 1161TESScutTESS Sector 5454600.00.02022TESS FFI Cutout (sector 54)
43TOI 1161TESScutTESS Sector 5555600.00.02022TESS FFI Cutout (sector 55)
44TOI 1161TESScutTESS Sector 7474200.00.02024TESS FFI Cutout (sector 74)
45TOI 1161TESScutTESS Sector 7575200.00.02024TESS FFI Cutout (sector 75)
\n", "

46 rows × 8 columns

\n", "
" ], "text/plain": [ "TESSSearch object containing 46 data products \n", " target_name pipeline mission sector exptime distance year \\\n", "0 158324245 SPOC TESS 14 120.0 0.0 2019 \n", "1 158324245 SPOC TESS 15 120.0 0.0 2019 \n", "2 158324245 SPOC TESS 26 120.0 0.0 2020 \n", "3 1717079071 SPOC TESS 26 120.0 0.0 2020 \n", "4 1717079066 SPOC TESS 40 120.0 0.0 2021 \n", ".. ... ... ... ... ... ... ... \n", "41 TOI 1161 TESScut TESS Sector 53 53 600.0 0.0 2022 \n", "42 TOI 1161 TESScut TESS Sector 54 54 600.0 0.0 2022 \n", "43 TOI 1161 TESScut TESS Sector 55 55 600.0 0.0 2022 \n", "44 TOI 1161 TESScut TESS Sector 74 74 200.0 0.0 2024 \n", "45 TOI 1161 TESScut TESS Sector 75 75 200.0 0.0 2024 \n", "\n", " description \n", "0 Target pixel files \n", "1 Target pixel files \n", "2 Target pixel files \n", "3 Target pixel files \n", "4 Target pixel files \n", ".. ... \n", "41 TESS FFI Cutout (sector 53) \n", "42 TESS FFI Cutout (sector 54) \n", "43 TESS FFI Cutout (sector 55) \n", "44 TESS FFI Cutout (sector 74) \n", "45 TESS FFI Cutout (sector 75) \n", "\n", "[46 rows x 8 columns]" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Only return cubedata (TPF) products\n", "# NOTE: Only TESS provides FFI cutouts\n", "toi_cube = toi.cubedata\n", "toi_cube" ] }, { "cell_type": "code", "execution_count": 9, "id": "ce754446", "metadata": {}, "outputs": [ { "data": { "text/html": [ "TESSSearch object containing 104 data products \n", "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
target_namepipelinemissionsectorexptimedistanceyeardescription
0158324245SPOCTESS14120.00.02019full data validation report
1158324245SPOCTESS14120.00.02019Data validation mini report
2158324245SPOCTESS14120.00.02019TCE summary report
3158324245SPOCTESS14120.00.02019full data validation report
4158324245SPOCTESS14120.00.02019TCE summary report
...........................
991717079066TESS-SPOCHLSP54600.00.02022Informational PDF
100158324245TESS-SPOCHLSP55600.00.02022Informational PDF
101158324245TESS-SPOCHLSP55600.00.02022PDF
1021717079066TESS-SPOCHLSP55600.00.02022PDF
1031717079066TESS-SPOCHLSP55600.00.02022Informational PDF
\n", "

104 rows × 8 columns

\n", "
" ], "text/plain": [ "TESSSearch object containing 104 data products \n", " target_name pipeline mission sector exptime distance year \\\n", "0 158324245 SPOC TESS 14 120.0 0.0 2019 \n", "1 158324245 SPOC TESS 14 120.0 0.0 2019 \n", "2 158324245 SPOC TESS 14 120.0 0.0 2019 \n", "3 158324245 SPOC TESS 14 120.0 0.0 2019 \n", "4 158324245 SPOC TESS 14 120.0 0.0 2019 \n", ".. ... ... ... ... ... ... ... \n", "99 1717079066 TESS-SPOC HLSP 54 600.0 0.0 2022 \n", "100 158324245 TESS-SPOC HLSP 55 600.0 0.0 2022 \n", "101 158324245 TESS-SPOC HLSP 55 600.0 0.0 2022 \n", "102 1717079066 TESS-SPOC HLSP 55 600.0 0.0 2022 \n", "103 1717079066 TESS-SPOC HLSP 55 600.0 0.0 2022 \n", "\n", " description \n", "0 full data validation report \n", "1 Data validation mini report \n", "2 TCE summary report \n", "3 full data validation report \n", "4 TCE summary report \n", ".. ... \n", "99 Informational PDF \n", "100 Informational PDF \n", "101 PDF \n", "102 PDF \n", "103 Informational PDF \n", "\n", "[104 rows x 8 columns]" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Only return data validation products. These are PDFs generated automatically during transit searches.\n", "toi_dv = toi.dvreports\n", "toi_dv" ] }, { "cell_type": "code", "execution_count": 10, "id": "23666237", "metadata": {}, "outputs": [ { "data": { "text/html": [ "TESSSearch object containing 108 data products \n", "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
target_namepipelinemissionsectorexptimedistanceyeardescription
0158324245TESS-SPOCHLSP141800.00.02019FITS
1158324245TESS-SPOCHLSP141800.00.02019FITS
2158324245TESS-SPOCHLSP151800.00.02019FITS
3158324245TESS-SPOCHLSP151800.00.02019FITS
41717079071TESS-SPOCHLSP261800.00.02020FITS
...........................
1031717079071QLPHLSP55600.00.02022FITS
1041717079066QLPHLSP55600.00.02022FITS
105158324245QLPHLSP74200.00.02024FITS
1061717079066QLPHLSP74200.00.02024FITS
1071717079071QLPHLSP74200.00.02024FITS
\n", "

108 rows × 8 columns

\n", "
" ], "text/plain": [ "TESSSearch object containing 108 data products \n", " target_name pipeline mission sector exptime distance year \\\n", "0 158324245 TESS-SPOC HLSP 14 1800.0 0.0 2019 \n", "1 158324245 TESS-SPOC HLSP 14 1800.0 0.0 2019 \n", "2 158324245 TESS-SPOC HLSP 15 1800.0 0.0 2019 \n", "3 158324245 TESS-SPOC HLSP 15 1800.0 0.0 2019 \n", "4 1717079071 TESS-SPOC HLSP 26 1800.0 0.0 2020 \n", ".. ... ... ... ... ... ... ... \n", "103 1717079071 QLP HLSP 55 600.0 0.0 2022 \n", "104 1717079066 QLP HLSP 55 600.0 0.0 2022 \n", "105 158324245 QLP HLSP 74 200.0 0.0 2024 \n", "106 1717079066 QLP HLSP 74 200.0 0.0 2024 \n", "107 1717079071 QLP HLSP 74 200.0 0.0 2024 \n", "\n", " description \n", "0 FITS \n", "1 FITS \n", "2 FITS \n", "3 FITS \n", "4 FITS \n", ".. ... \n", "103 FITS \n", "104 FITS \n", "105 FITS \n", "106 FITS \n", "107 FITS \n", "\n", "[108 rows x 8 columns]" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Only return High Level Science Products\n", "toi_hlsp = toi.HLSPs\n", "toi_hlsp" ] }, { "cell_type": "code", "execution_count": 11, "id": "80947c03", "metadata": {}, "outputs": [ { "data": { "text/html": [ "TESSSearch object containing 128 data products \n", "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
target_namepipelinemissionsectorexptimedistanceyeardescription
0158324245SPOCTESS14120.00.02019Target pixel files
1158324245SPOCTESS14120.00.02019full data validation report
2158324245SPOCTESS14120.00.02019Data validation mini report
3158324245SPOCTESS14120.00.02019TCE summary report
4158324245SPOCTESS14120.00.02019Light curves
...........................
123158324245SPOCTESS75120.00.02024TCE summary report
124158324245SPOCTESS75120.00.02024Data validation mini report
125158324245SPOCTESS75120.00.02024full data validation report
126158324245SPOCTESS75120.00.02024Light curves
127158324245SPOCTESS75120.00.02024Target pixel files
\n", "

128 rows × 8 columns

\n", "
" ], "text/plain": [ "TESSSearch object containing 128 data products \n", " target_name pipeline mission sector exptime distance year \\\n", "0 158324245 SPOC TESS 14 120.0 0.0 2019 \n", "1 158324245 SPOC TESS 14 120.0 0.0 2019 \n", "2 158324245 SPOC TESS 14 120.0 0.0 2019 \n", "3 158324245 SPOC TESS 14 120.0 0.0 2019 \n", "4 158324245 SPOC TESS 14 120.0 0.0 2019 \n", ".. ... ... ... ... ... ... ... \n", "123 158324245 SPOC TESS 75 120.0 0.0 2024 \n", "124 158324245 SPOC TESS 75 120.0 0.0 2024 \n", "125 158324245 SPOC TESS 75 120.0 0.0 2024 \n", "126 158324245 SPOC TESS 75 120.0 0.0 2024 \n", "127 158324245 SPOC TESS 75 120.0 0.0 2024 \n", "\n", " description \n", "0 Target pixel files \n", "1 full data validation report \n", "2 Data validation mini report \n", "3 TCE summary report \n", "4 Light curves \n", ".. ... \n", "123 TCE summary report \n", "124 Data validation mini report \n", "125 full data validation report \n", "126 Light curves \n", "127 Target pixel files \n", "\n", "[128 rows x 8 columns]" ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Only return official mission products\n", "toi_mission = toi.mission_products\n", "toi_mission" ] }, { "cell_type": "markdown", "id": "e130c23c", "metadata": {}, "source": [ "Even after limiting results by data type, there are a lot of results for this target. The filter_table function allows you to filter by several additional parameters. These are:\n", "- exposure time (exptime)\n", "- the data pipline (pipeline)\n", "- the total number of results (limit). \n", "\n", "In addition, KeplerSearch objects can be filtered by quarter/month, TESSSearch objects by sector, and K2Search objects by campaign. " ] }, { "cell_type": "code", "execution_count": 12, "id": "c9daaef4", "metadata": {}, "outputs": [ { "data": { "text/html": [ "TESSSearch object containing 8 data products \n", "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
target_namepipelinemissionsectorexptimedistanceyeardescription
0158324245SPOCTESS7420.00.02024Target pixel files
1158324245SPOCTESS7420.00.02024Light curves
21717079066SPOCTESS7420.00.02024Light curves
31717079066SPOCTESS7420.00.02024Target pixel files
41717079066SPOCTESS7520.00.02024Light curves
51717079066SPOCTESS7520.00.02024Target pixel files
6158324245SPOCTESS7520.00.02024Target pixel files
7158324245SPOCTESS7520.00.02024Light curves
\n", "
" ], "text/plain": [ "TESSSearch object containing 8 data products \n", " target_name pipeline mission sector exptime distance year \\\n", "0 158324245 SPOC TESS 74 20.0 0.0 2024 \n", "1 158324245 SPOC TESS 74 20.0 0.0 2024 \n", "2 1717079066 SPOC TESS 74 20.0 0.0 2024 \n", "3 1717079066 SPOC TESS 74 20.0 0.0 2024 \n", "4 1717079066 SPOC TESS 75 20.0 0.0 2024 \n", "5 1717079066 SPOC TESS 75 20.0 0.0 2024 \n", "6 158324245 SPOC TESS 75 20.0 0.0 2024 \n", "7 158324245 SPOC TESS 75 20.0 0.0 2024 \n", "\n", " description \n", "0 Target pixel files \n", "1 Light curves \n", "2 Light curves \n", "3 Target pixel files \n", "4 Light curves \n", "5 Target pixel files \n", "6 Target pixel files \n", "7 Light curves " ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Keep any data type, but only the shortest cadence available, which in this case is 2-minute data\n", "\n", "toi_shortest = toi.filter_table(exptime=\"shortest\")\n", "toi_shortest" ] }, { "cell_type": "code", "execution_count": 13, "id": "6221e588", "metadata": {}, "outputs": [ { "data": { "text/html": [ "TESSSearch object containing 128 data products \n", "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
target_namepipelinemissionsectorexptimedistanceyeardescription
0158324245SPOCTESS14120.00.02019Target pixel files
1158324245SPOCTESS14120.00.02019full data validation report
2158324245SPOCTESS14120.00.02019Data validation mini report
3158324245SPOCTESS14120.00.02019TCE summary report
4158324245SPOCTESS14120.00.02019Light curves
...........................
123158324245TASOCHLSP15120.00.02019FITS
124158324245TASOCHLSP26120.00.02020FITS
125158324245QLPHLSP74200.00.02024FITS
1261717079066QLPHLSP74200.00.02024FITS
1271717079071QLPHLSP74200.00.02024FITS
\n", "

128 rows × 8 columns

\n", "
" ], "text/plain": [ "TESSSearch object containing 128 data products \n", " target_name pipeline mission sector exptime distance year \\\n", "0 158324245 SPOC TESS 14 120.0 0.0 2019 \n", "1 158324245 SPOC TESS 14 120.0 0.0 2019 \n", "2 158324245 SPOC TESS 14 120.0 0.0 2019 \n", "3 158324245 SPOC TESS 14 120.0 0.0 2019 \n", "4 158324245 SPOC TESS 14 120.0 0.0 2019 \n", ".. ... ... ... ... ... ... ... \n", "123 158324245 TASOC HLSP 15 120.0 0.0 2019 \n", "124 158324245 TASOC HLSP 26 120.0 0.0 2020 \n", "125 158324245 QLP HLSP 74 200.0 0.0 2024 \n", "126 1717079066 QLP HLSP 74 200.0 0.0 2024 \n", "127 1717079071 QLP HLSP 74 200.0 0.0 2024 \n", "\n", " description \n", "0 Target pixel files \n", "1 full data validation report \n", "2 Data validation mini report \n", "3 TCE summary report \n", "4 Light curves \n", ".. ... \n", "123 FITS \n", "124 FITS \n", "125 FITS \n", "126 FITS \n", "127 FITS \n", "\n", "[128 rows x 8 columns]" ] }, "execution_count": 13, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# You could also specify an exact exposure time or range in the form of a tuple (eg, (100,500))\n", "toi_trange = toi.filter_table(exptime=(100, 500))\n", "toi_trange" ] }, { "cell_type": "code", "execution_count": 14, "id": "9573bd82", "metadata": {}, "outputs": [ { "data": { "text/html": [ "TESSSearch object containing 2 data products \n", "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
target_namepipelinemissionsectorexptimedistanceyeardescription
0158324245SPOCTESS14120.00.02019Target pixel files
1158324245SPOCTESS14120.00.02019full data validation report
\n", "
" ], "text/plain": [ "TESSSearch object containing 2 data products \n", " target_name pipeline mission sector exptime distance year \\\n", "0 158324245 SPOC TESS 14 120.0 0.0 2019 \n", "1 158324245 SPOC TESS 14 120.0 0.0 2019 \n", "\n", " description \n", "0 Target pixel files \n", "1 full data validation report " ] }, "execution_count": 14, "metadata": {}, "output_type": "execute_result" } ], "source": [ "toi_lim = toi.filter_table(limit=2)\n", "toi_lim" ] }, { "cell_type": "markdown", "id": "a06a6c71", "metadata": {}, "source": [ "Keep in mind, you can chain these commands" ] }, { "cell_type": "code", "execution_count": 15, "id": "7771c710", "metadata": {}, "outputs": [ { "data": { "text/html": [ "TESSSearch object containing 2 data products \n", "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
target_namepipelinemissionsectorexptimedistanceyeardescription
0158324245SPOCTESS14120.00.02019Light curves
1158324245TASOCHLSP14120.00.02019FITS
\n", "
" ], "text/plain": [ "TESSSearch object containing 2 data products \n", " target_name pipeline mission sector exptime distance year description\n", "0 158324245 SPOC TESS 14 120.0 0.0 2019 Light curves\n", "1 158324245 TASOC HLSP 14 120.0 0.0 2019 FITS" ] }, "execution_count": 15, "metadata": {}, "output_type": "execute_result" } ], "source": [ "toi_short_lcs = toi.timeseries.filter_table(exptime=120, sector=14)\n", "toi_short_lcs" ] }, { "cell_type": "markdown", "id": "0e5e9e42", "metadata": {}, "source": [ "Once your search result contains the files you want, you can download the files directly to your machine. " ] }, { "cell_type": "code", "execution_count": 16, "id": "adae2b43", "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "pipeline products: 100%|████████████████████████████████████████████| 2/2 [00:00<00:00, 4.27it/s]\n" ] }, { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Local PathStatusMessageURL
0/Users/tapritc2/.lksearch/cache/mastDownload/T...COMPLETENoneNone
1/Users/tapritc2/.lksearch/cache/mastDownload/H...COMPLETENoneNone
\n", "
" ], "text/plain": [ " Local Path Status Message URL\n", "0 /Users/tapritc2/.lksearch/cache/mastDownload/T... COMPLETE None None\n", "1 /Users/tapritc2/.lksearch/cache/mastDownload/H... COMPLETE None None" ] }, "execution_count": 16, "metadata": {}, "output_type": "execute_result" } ], "source": [ "toi_short_lcs.download()" ] }, { "cell_type": "markdown", "id": "32fa37cf-09c3-4c90-b0ad-bef4ae0a9b54", "metadata": {}, "source": [ "You can also query the pandas Dataframe back end to perform more complicated searches. For example, the above could also be perfomed via:" ] }, { "cell_type": "code", "execution_count": 17, "id": "5173e574-4a1f-4fd7-9071-52fae2c86a24", "metadata": {}, "outputs": [ { "data": { "text/html": [ "TESSSearch object containing 2 data products \n", "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
target_namepipelinemissionsectorexptimedistanceyeardescription
0158324245SPOCTESS14120.00.02019Light curves
1158324245TASOCHLSP14120.00.02019FITS
\n", "
" ], "text/plain": [ "TESSSearch object containing 2 data products \n", " target_name pipeline mission sector exptime distance year description\n", "0 158324245 SPOC TESS 14 120.0 0.0 2019 Light curves\n", "1 158324245 TASOC HLSP 14 120.0 0.0 2019 FITS" ] }, "execution_count": 17, "metadata": {}, "output_type": "execute_result" } ], "source": [ "toi_short_lcs = toi.timeseries.query_table(\"sector == 14 & exptime == 120\")\n", "toi_short_lcs" ] }, { "cell_type": "markdown", "id": "b97fca26", "metadata": {}, "source": [ "### TESScut FFI Cutouts\n", "\n", "In addition to lightcurves and target pixel files, TESS provides Full Frame Image (FFI) data. This data was taken at a cadence of 30 minutes during the primary mission, 10 minutes during the first extension, and 200-seconds beginning in the second mission extension. \n", "\n", "lksearch allows users to download entire FFIs, or make smaller cutouts around a target of interest using TESScut. All of this functionality if available with the TESSSearch object. " ] }, { "cell_type": "markdown", "id": "99af94f5", "metadata": {}, "source": [ "#### Find and download TESScut TPFs" ] }, { "cell_type": "code", "execution_count": 18, "id": "d2cfa795", "metadata": {}, "outputs": [ { "data": { "text/html": [ "TESSSearch object containing 6 data products \n", "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
target_namepipelinemissionsectorexptimedistanceyeardescription
0TOI 270TESScutTESS Sector 0331800.00.02018TESS FFI Cutout (sector 3)
1TOI 270TESScutTESS Sector 0441800.00.02018TESS FFI Cutout (sector 4)
2TOI 270TESScutTESS Sector 0551800.00.02018TESS FFI Cutout (sector 5)
3TOI 270TESScutTESS Sector 3030600.00.02020TESS FFI Cutout (sector 30)
4TOI 270TESScutTESS Sector 3131600.00.02020TESS FFI Cutout (sector 31)
5TOI 270TESScutTESS Sector 3232600.00.02020TESS FFI Cutout (sector 32)
\n", "
" ], "text/plain": [ "TESSSearch object containing 6 data products \n", " target_name pipeline mission sector exptime distance year \\\n", "0 TOI 270 TESScut TESS Sector 03 3 1800.0 0.0 2018 \n", "1 TOI 270 TESScut TESS Sector 04 4 1800.0 0.0 2018 \n", "2 TOI 270 TESScut TESS Sector 05 5 1800.0 0.0 2018 \n", "3 TOI 270 TESScut TESS Sector 30 30 600.0 0.0 2020 \n", "4 TOI 270 TESScut TESS Sector 31 31 600.0 0.0 2020 \n", "5 TOI 270 TESScut TESS Sector 32 32 600.0 0.0 2020 \n", "\n", " description \n", "0 TESS FFI Cutout (sector 3) \n", "1 TESS FFI Cutout (sector 4) \n", "2 TESS FFI Cutout (sector 5) \n", "3 TESS FFI Cutout (sector 30) \n", "4 TESS FFI Cutout (sector 31) \n", "5 TESS FFI Cutout (sector 32) " ] }, "execution_count": 18, "metadata": {}, "output_type": "execute_result" } ], "source": [ "search_result = TESSSearch(\"TOI 270\", hlsp=False)\n", "\n", "# You can filter two different ways to get the same result.\n", "# search_result.filter_table(pipeline='TESScut')\n", "search_result.tesscut" ] }, { "cell_type": "markdown", "id": "058639cf", "metadata": {}, "source": [ "For TESScut images, you can specify how large you want the cutout to be in pixels when you download the data using the TESScut_size keyword. By default, it will download a 10-pixel square image. If you use set this keyword when downloading non-TESScut data, it will be ignored. " ] }, { "cell_type": "code", "execution_count": 19, "id": "0988e2c9", "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "TESScut : 100%|████████████████████████████████████████████| 1/1 [00:08<00:00, 8.03s/it]\n" ] }, { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Local PathStatus
0/Users/tapritc2/.lksearch/cache/mastDownload/T...COMPLETE
\n", "
" ], "text/plain": [ " Local Path Status\n", "0 /Users/tapritc2/.lksearch/cache/mastDownload/T... COMPLETE" ] }, "execution_count": 19, "metadata": {}, "output_type": "execute_result" } ], "source": [ "search_result.tesscut.filter_table(sector=3).download(TESScut_size=20)" ] }, { "cell_type": "markdown", "id": "0fd9ffe2-43aa-496c-aa56-beb5ee814653", "metadata": {}, "source": [ "### Find and download full frame images\n", "\n", "In some cases, users may want to access an FFI, for example to see if any artifacts exist on a CCD level. TESSSearch objects use the location of the target to find what camera/ccd the target was observed and access the FFIs. \n", "\n", "Note that FFI files are large, so downloading a full sector to your hard drive is not recommended. The FFI search therefore allows you to limit the search by providing a start and stop time. Times can be provided as astropy Time objects. If a number is provided with no units, it assume MJD. " ] }, { "cell_type": "code", "execution_count": 20, "id": "d7bac166-9110-4ed2-8341-0ced027b9b16", "metadata": {}, "outputs": [ { "data": { "text/html": [ "TESSSearch object containing 162 data products \n", "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
target_namepipelinemissionsectorexptimedistanceyeardescription
0299096355SPOCTESS14120.00.02019full data validation report
1299096355SPOCTESS14120.00.02019full data validation report
2299096355SPOCTESS14120.00.02019Data validation mini report
3299096355SPOCTESS14120.00.02019Data validation mini report
4299096355SPOCTESS14120.00.02019TCE summary report
...........................
157299096355CDIPSHLSP551800.00.02022FITS
158299096355QLPHLSP55600.00.02022FITS
159299096355QLPHLSP56200.00.02022FITS
160299096355QLPHLSP73200.00.02023FITS
161299096355QLPHLSP74200.00.02024FITS
\n", "

162 rows × 8 columns

\n", "
" ], "text/plain": [ "TESSSearch object containing 162 data products \n", " target_name pipeline mission sector exptime distance year \\\n", "0 299096355 SPOC TESS 14 120.0 0.0 2019 \n", "1 299096355 SPOC TESS 14 120.0 0.0 2019 \n", "2 299096355 SPOC TESS 14 120.0 0.0 2019 \n", "3 299096355 SPOC TESS 14 120.0 0.0 2019 \n", "4 299096355 SPOC TESS 14 120.0 0.0 2019 \n", ".. ... ... ... ... ... ... ... \n", "157 299096355 CDIPS HLSP 55 1800.0 0.0 2022 \n", "158 299096355 QLP HLSP 55 600.0 0.0 2022 \n", "159 299096355 QLP HLSP 56 200.0 0.0 2022 \n", "160 299096355 QLP HLSP 73 200.0 0.0 2023 \n", "161 299096355 QLP HLSP 74 200.0 0.0 2024 \n", "\n", " description \n", "0 full data validation report \n", "1 full data validation report \n", "2 Data validation mini report \n", "3 Data validation mini report \n", "4 TCE summary report \n", ".. ... \n", "157 FITS \n", "158 FITS \n", "159 FITS \n", "160 FITS \n", "161 FITS \n", "\n", "[162 rows x 8 columns]" ] }, "execution_count": 20, "metadata": {}, "output_type": "execute_result" } ], "source": [ "search_result = TESSSearch(\"Kepler 16b\")\n", "search_result" ] }, { "cell_type": "code", "execution_count": 21, "id": "a41178f6-2d5b-4e7c-808e-21d19eb7ff79", "metadata": {}, "outputs": [ { "data": { "text/html": [ "TESSSearch object containing 1241 data products \n", "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
target_namepipelinemissionsectorexptimedistanceyeardescription
0tess2019220045929-s0014-2-4-0150-sSPOCTESS141800NaN2019Calibrated full frame image
1tess2019200195929-s0014-2-4-0150-sSPOCTESS141800NaN2019Calibrated full frame image
2tess2019219202929-s0014-2-4-0150-sSPOCTESS141800NaN2019Calibrated full frame image
3tess2019220002929-s0014-2-4-0150-sSPOCTESS141800NaN2019Calibrated full frame image
4tess2019201155929-s0014-2-4-0150-sSPOCTESS141800NaN2019Calibrated full frame image
...........................
1236tess2019220162929-s0014-2-4-0150-sSPOCTESS141800NaN2019Calibrated full frame image
1237tess2019205002929-s0014-2-4-0150-sSPOCTESS141800NaN2019Calibrated full frame image
1238tess2019205125929-s0014-2-4-0150-sSPOCTESS141800NaN2019Calibrated full frame image
1239tess2019222162929-s0014-2-4-0150-sSPOCTESS141800NaN2019Calibrated full frame image
1240tess2019216132929-s0014-2-4-0150-sSPOCTESS141800NaN2019Calibrated full frame image
\n", "

1241 rows × 8 columns

\n", "
" ], "text/plain": [ "TESSSearch object containing 1241 data products \n", " target_name pipeline mission sector exptime \\\n", "0 tess2019220045929-s0014-2-4-0150-s SPOC TESS 14 1800 \n", "1 tess2019200195929-s0014-2-4-0150-s SPOC TESS 14 1800 \n", "2 tess2019219202929-s0014-2-4-0150-s SPOC TESS 14 1800 \n", "3 tess2019220002929-s0014-2-4-0150-s SPOC TESS 14 1800 \n", "4 tess2019201155929-s0014-2-4-0150-s SPOC TESS 14 1800 \n", "... ... ... ... ... ... \n", "1236 tess2019220162929-s0014-2-4-0150-s SPOC TESS 14 1800 \n", "1237 tess2019205002929-s0014-2-4-0150-s SPOC TESS 14 1800 \n", "1238 tess2019205125929-s0014-2-4-0150-s SPOC TESS 14 1800 \n", "1239 tess2019222162929-s0014-2-4-0150-s SPOC TESS 14 1800 \n", "1240 tess2019216132929-s0014-2-4-0150-s SPOC TESS 14 1800 \n", "\n", " distance year description \n", "0 NaN 2019 Calibrated full frame image \n", "1 NaN 2019 Calibrated full frame image \n", "2 NaN 2019 Calibrated full frame image \n", "3 NaN 2019 Calibrated full frame image \n", "4 NaN 2019 Calibrated full frame image \n", "... ... ... ... \n", "1236 NaN 2019 Calibrated full frame image \n", "1237 NaN 2019 Calibrated full frame image \n", "1238 NaN 2019 Calibrated full frame image \n", "1239 NaN 2019 Calibrated full frame image \n", "1240 NaN 2019 Calibrated full frame image \n", "\n", "[1241 rows x 8 columns]" ] }, "execution_count": 21, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Search for a list of FFIs in Sector 14\n", "ffis = search_result.search_sector_ffis(14)\n", "ffis" ] }, { "cell_type": "markdown", "id": "36fca07d", "metadata": {}, "source": [ "This produces more than 1000 FFI files, which likely we don't want. Let's limit it to just one. " ] }, { "cell_type": "code", "execution_count": 22, "id": "a84e244e", "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "pipeline products: 100%|████████████████████████████████████████████| 1/1 [00:00<00:00, 2.76it/s]\n" ] }, { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Local PathStatusMessageURL
0/Users/tapritc2/.lksearch/cache/mastDownload/T...COMPLETENoneNone
\n", "
" ], "text/plain": [ " Local Path Status Message URL\n", "0 /Users/tapritc2/.lksearch/cache/mastDownload/T... COMPLETE None None" ] }, "execution_count": 22, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ffis.filter_table(limit=1).download()" ] }, { "cell_type": "markdown", "id": "a0935d18", "metadata": {}, "source": [ "## Kepler Search\n" ] }, { "cell_type": "markdown", "id": "feb3dd84", "metadata": {}, "source": [ "The call to KeplerSearch saves all availabe data products for the target as a table. Like with the other search objects, there are several convenient functions to limit the results to timeseries (lighcurve), cubedata (target pixel files and, in the case of TESS only, full frame image cutouts), dvreports (PDF data validation reports generated by the data pipelines), mission_products, and HLSPs. Calling these functions returns a new search object. " ] }, { "cell_type": "code", "execution_count": 23, "id": "ace8aad4", "metadata": {}, "outputs": [ { "data": { "text/html": [ "KeplerSearch object containing 82 data products \n", "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
target_namepipelinemissionquarterexptimedistanceyeardescription
0kplr007419318KeplerKepler01800.0000.02009Lightcurve Long Cadence (CLC) - Q0
1kplr007419318KeplerKepler01800.0000.02009Target Pixel Long Cadence (TPL) - Q0
2kplr007419318KeplerKepler11800.0000.02009Lightcurve Long Cadence (CLC) - Q1
3kplr007419318KeplerKepler11800.0000.02009Target Pixel Long Cadence (TPL) - Q1
4kplr007419318KeplerKepler21800.0000.02009Lightcurve Long Cadence (CLC) - Q2
...........................
77kplr007419318KeplerKepler171800.0000.02013Target Pixel Long Cadence (TPL) - Q17
78kplr007419318KeplerKepler991800.0000.02009Data Validation full report
79kplr007419318KeplerKepler991800.0000.02009Data Validation summary report
80kplr007419318KeplerKepler991800.0000.02009Data Validation summary report
81Gaia DR3 2104847370214740352KBONUS-BKGHLSP991765.4640.02009FITS
\n", "

82 rows × 8 columns

\n", "
" ], "text/plain": [ "KeplerSearch object containing 82 data products \n", " target_name pipeline mission quarter exptime \\\n", "0 kplr007419318 Kepler Kepler 0 1800.000 \n", "1 kplr007419318 Kepler Kepler 0 1800.000 \n", "2 kplr007419318 Kepler Kepler 1 1800.000 \n", "3 kplr007419318 Kepler Kepler 1 1800.000 \n", "4 kplr007419318 Kepler Kepler 2 1800.000 \n", ".. ... ... ... ... ... \n", "77 kplr007419318 Kepler Kepler 17 1800.000 \n", "78 kplr007419318 Kepler Kepler 99 1800.000 \n", "79 kplr007419318 Kepler Kepler 99 1800.000 \n", "80 kplr007419318 Kepler Kepler 99 1800.000 \n", "81 Gaia DR3 2104847370214740352 KBONUS-BKG HLSP 99 1765.464 \n", "\n", " distance year description \n", "0 0.0 2009 Lightcurve Long Cadence (CLC) - Q0 \n", "1 0.0 2009 Target Pixel Long Cadence (TPL) - Q0 \n", "2 0.0 2009 Lightcurve Long Cadence (CLC) - Q1 \n", "3 0.0 2009 Target Pixel Long Cadence (TPL) - Q1 \n", "4 0.0 2009 Lightcurve Long Cadence (CLC) - Q2 \n", ".. ... ... ... \n", "77 0.0 2013 Target Pixel Long Cadence (TPL) - Q17 \n", "78 0.0 2009 Data Validation full report \n", "79 0.0 2009 Data Validation summary report \n", "80 0.0 2009 Data Validation summary report \n", "81 0.0 2009 FITS \n", "\n", "[82 rows x 8 columns]" ] }, "execution_count": 23, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# What timeseries data is available?\n", "kep = KeplerSearch(\"Kepler 137\")\n", "kep" ] }, { "cell_type": "code", "execution_count": 24, "id": "ed6138b3", "metadata": {}, "outputs": [ { "data": { "text/html": [ "KeplerSearch object containing 40 data products \n", "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
target_namepipelinemissionquarterexptimedistanceyeardescription
0kplr007419318KeplerKepler01800.0000.02009Lightcurve Long Cadence (CLC) - Q0
1kplr007419318KeplerKepler11800.0000.02009Lightcurve Long Cadence (CLC) - Q1
2kplr007419318KeplerKepler21800.0000.02009Lightcurve Long Cadence (CLC) - Q2
3kplr007419318KeplerKepler31800.0000.02009Lightcurve Long Cadence (CLC) - Q3
4kplr007419318KeplerKepler41800.0000.02010Lightcurve Long Cadence (CLC) - Q4
...........................
35kplr007419318KeplerKepler141800.0000.02012Lightcurve Long Cadence (CLC) - Q14
36kplr007419318KeplerKepler151800.0000.02013Lightcurve Long Cadence (CLC) - Q15
37kplr007419318KeplerKepler161800.0000.02013Lightcurve Long Cadence (CLC) - Q16
38kplr007419318KeplerKepler171800.0000.02013Lightcurve Long Cadence (CLC) - Q17
39Gaia DR3 2104847370214740352KBONUS-BKGHLSP991765.4640.02009FITS
\n", "

40 rows × 8 columns

\n", "
" ], "text/plain": [ "KeplerSearch object containing 40 data products \n", " target_name pipeline mission quarter exptime \\\n", "0 kplr007419318 Kepler Kepler 0 1800.000 \n", "1 kplr007419318 Kepler Kepler 1 1800.000 \n", "2 kplr007419318 Kepler Kepler 2 1800.000 \n", "3 kplr007419318 Kepler Kepler 3 1800.000 \n", "4 kplr007419318 Kepler Kepler 4 1800.000 \n", ".. ... ... ... ... ... \n", "35 kplr007419318 Kepler Kepler 14 1800.000 \n", "36 kplr007419318 Kepler Kepler 15 1800.000 \n", "37 kplr007419318 Kepler Kepler 16 1800.000 \n", "38 kplr007419318 Kepler Kepler 17 1800.000 \n", "39 Gaia DR3 2104847370214740352 KBONUS-BKG HLSP 99 1765.464 \n", "\n", " distance year description \n", "0 0.0 2009 Lightcurve Long Cadence (CLC) - Q0 \n", "1 0.0 2009 Lightcurve Long Cadence (CLC) - Q1 \n", "2 0.0 2009 Lightcurve Long Cadence (CLC) - Q2 \n", "3 0.0 2009 Lightcurve Long Cadence (CLC) - Q3 \n", "4 0.0 2010 Lightcurve Long Cadence (CLC) - Q4 \n", ".. ... ... ... \n", "35 0.0 2012 Lightcurve Long Cadence (CLC) - Q14 \n", "36 0.0 2013 Lightcurve Long Cadence (CLC) - Q15 \n", "37 0.0 2013 Lightcurve Long Cadence (CLC) - Q16 \n", "38 0.0 2013 Lightcurve Long Cadence (CLC) - Q17 \n", "39 0.0 2009 FITS \n", "\n", "[40 rows x 8 columns]" ] }, "execution_count": 24, "metadata": {}, "output_type": "execute_result" } ], "source": [ "kep_lc = kep.timeseries\n", "kep_lc" ] }, { "cell_type": "code", "execution_count": 25, "id": "cbedbf2a", "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "pipeline products: 100%|████████████████████████████████████████████| 2/2 [00:00<00:00, 3.32it/s]\n" ] }, { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Local PathStatusMessageURL
0/Users/tapritc2/.lksearch/cache/mastDownload/K...COMPLETENoneNone
1/Users/tapritc2/.lksearch/cache/mastDownload/K...COMPLETENoneNone
\n", "
" ], "text/plain": [ " Local Path Status Message URL\n", "0 /Users/tapritc2/.lksearch/cache/mastDownload/K... COMPLETE None None\n", "1 /Users/tapritc2/.lksearch/cache/mastDownload/K... COMPLETE None None" ] }, "execution_count": 25, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# You can download a subsection of results directly\n", "kep_lc[:2].download()" ] }, { "cell_type": "markdown", "id": "3eab9b82", "metadata": {}, "source": [ "Notice that when downloading, a table is printed out showing the status of the download. You can save this table and explore it in more detail, if desired." ] }, { "cell_type": "code", "execution_count": 26, "id": "0890bbc6", "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "pipeline products: 100%|████████████████████████████████████████████| 2/2 [00:00<00:00, 3.98it/s]" ] }, { "name": "stdout", "output_type": "stream", "text": [ "['/Users/tapritc2/.lksearch/cache/mastDownload/Kepler/kplr007419318_lc_Q111111111111111111/kplr007419318-2009131105131_llc.fits'\n", " '/Users/tapritc2/.lksearch/cache/mastDownload/Kepler/kplr007419318_lc_Q111111111111111111/kplr007419318-2009131105131_lpd-targ.fits.gz']\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "\n" ] } ], "source": [ "# You can download a subsection of results directly\n", "manifest = kep[:2].download()\n", "print(manifest[\"Local Path\"].values)" ] }, { "cell_type": "code", "execution_count": 27, "id": "502fee80", "metadata": {}, "outputs": [ { "data": { "text/html": [ "KeplerSearch object containing 10 data products \n", "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
target_namepipelinemissionquarterexptimedistanceyeardescription
0kplr007419318KeplerKepler760.00.02010Lightcurve Short Cadence (CSC) - Q7
1kplr007419318KeplerKepler760.00.02010Lightcurve Short Cadence (CSC) - Q7
2kplr007419318KeplerKepler760.00.02010Target Pixel Short Cadence (TPS) - Q7
3kplr007419318KeplerKepler760.00.02010Target Pixel Short Cadence (TPS) - Q7
4kplr007419318KeplerKepler760.00.02010Target Pixel Short Cadence (TPS) - Q7
5kplr007419318KeplerKepler760.00.02010Lightcurve Short Cadence (CSC) - Q7
6kplr007419318KeplerKepler71800.00.02010Target Pixel Long Cadence (TPL) - Q7
7kplr007419318KeplerKepler71800.00.02010Lightcurve Long Cadence (CLC) - Q7
8kplr007419318KeplerKepler171800.00.02013Lightcurve Long Cadence (CLC) - Q17
9kplr007419318KeplerKepler171800.00.02013Target Pixel Long Cadence (TPL) - Q17
\n", "
" ], "text/plain": [ "KeplerSearch object containing 10 data products \n", " target_name pipeline mission quarter exptime distance year \\\n", "0 kplr007419318 Kepler Kepler 7 60.0 0.0 2010 \n", "1 kplr007419318 Kepler Kepler 7 60.0 0.0 2010 \n", "2 kplr007419318 Kepler Kepler 7 60.0 0.0 2010 \n", "3 kplr007419318 Kepler Kepler 7 60.0 0.0 2010 \n", "4 kplr007419318 Kepler Kepler 7 60.0 0.0 2010 \n", "5 kplr007419318 Kepler Kepler 7 60.0 0.0 2010 \n", "6 kplr007419318 Kepler Kepler 7 1800.0 0.0 2010 \n", "7 kplr007419318 Kepler Kepler 7 1800.0 0.0 2010 \n", "8 kplr007419318 Kepler Kepler 17 1800.0 0.0 2013 \n", "9 kplr007419318 Kepler Kepler 17 1800.0 0.0 2013 \n", "\n", " description \n", "0 Lightcurve Short Cadence (CSC) - Q7 \n", "1 Lightcurve Short Cadence (CSC) - Q7 \n", "2 Target Pixel Short Cadence (TPS) - Q7 \n", "3 Target Pixel Short Cadence (TPS) - Q7 \n", "4 Target Pixel Short Cadence (TPS) - Q7 \n", "5 Lightcurve Short Cadence (CSC) - Q7 \n", "6 Target Pixel Long Cadence (TPL) - Q7 \n", "7 Lightcurve Long Cadence (CLC) - Q7 \n", "8 Lightcurve Long Cadence (CLC) - Q17 \n", "9 Target Pixel Long Cadence (TPL) - Q17 " ] }, "execution_count": 27, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# we can also filter the results by observing quarter\n", "kep_quarters = kep.filter_table(quarter=[7, 17])\n", "kep_quarters" ] }, { "cell_type": "markdown", "id": "0d4b9e69", "metadata": {}, "source": [ "## K2 Search\n", "\n", "K2Search behaves in much the same way as Kepler. As with Kepler, both mission products and HLSPs are returned by default. Note that instead of quarters, the K2 mission was separated by campaign. " ] }, { "cell_type": "code", "execution_count": 28, "id": "a775a2f7", "metadata": {}, "outputs": [ { "data": { "text/html": [ "K2Search object containing 6 data products \n", "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
target_namepipelinemissioncampaignexptimedistanceyeardescription
0ktwo201912552K2K211800.00.02014Target Pixel Long Cadence (KTL) - C01
1ktwo201912552K2K211800.00.02014Lightcurve Long Cadence (KLC) - C01
2ktwo201912552EVERESTHLSP11800.00.02014FITS
3ktwo201912552EVERESTHLSP11800.00.02014PDF
4ktwo201912552K2SFFHLSP11800.00.02014FITS
5ktwo201912552K2VARCATHLSP11800.00.02014FITS
\n", "
" ], "text/plain": [ "K2Search object containing 6 data products \n", " target_name pipeline mission campaign exptime distance year \\\n", "0 ktwo201912552 K2 K2 1 1800.0 0.0 2014 \n", "1 ktwo201912552 K2 K2 1 1800.0 0.0 2014 \n", "2 ktwo201912552 EVEREST HLSP 1 1800.0 0.0 2014 \n", "3 ktwo201912552 EVEREST HLSP 1 1800.0 0.0 2014 \n", "4 ktwo201912552 K2SFF HLSP 1 1800.0 0.0 2014 \n", "5 ktwo201912552 K2VARCAT HLSP 1 1800.0 0.0 2014 \n", "\n", " description \n", "0 Target Pixel Long Cadence (KTL) - C01 \n", "1 Lightcurve Long Cadence (KLC) - C01 \n", "2 FITS \n", "3 PDF \n", "4 FITS \n", "5 FITS " ] }, "execution_count": 28, "metadata": {}, "output_type": "execute_result" } ], "source": [ "K2 = K2Search(\"K2-18\")\n", "K2" ] }, { "cell_type": "code", "execution_count": 29, "id": "7d27bf57", "metadata": {}, "outputs": [ { "data": { "text/html": [ "K2Search object containing 4 data products \n", "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
target_namepipelinemissioncampaignexptimedistanceyeardescription
0ktwo201912552EVERESTHLSP11800.00.02014FITS
1ktwo201912552EVERESTHLSP11800.00.02014PDF
2ktwo201912552K2SFFHLSP11800.00.02014FITS
3ktwo201912552K2VARCATHLSP11800.00.02014FITS
\n", "
" ], "text/plain": [ "K2Search object containing 4 data products \n", " target_name pipeline mission campaign exptime distance year \\\n", "0 ktwo201912552 EVEREST HLSP 1 1800.0 0.0 2014 \n", "1 ktwo201912552 EVEREST HLSP 1 1800.0 0.0 2014 \n", "2 ktwo201912552 K2SFF HLSP 1 1800.0 0.0 2014 \n", "3 ktwo201912552 K2VARCAT HLSP 1 1800.0 0.0 2014 \n", "\n", " description \n", "0 FITS \n", "1 PDF \n", "2 FITS \n", "3 FITS " ] }, "execution_count": 29, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Download all lightcurves produced by HLSPs\n", "K2_HLSPs = K2.HLSPs\n", "K2_HLSPs" ] }, { "cell_type": "code", "execution_count": 30, "id": "c2cd7ee3", "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "pipeline products: 100%|████████████████████████████████████████████| 3/3 [00:01<00:00, 2.02it/s]\n" ] }, { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Local PathStatusMessageURL
0/Users/tapritc2/.lksearch/cache/mastDownload/H...COMPLETENoneNone
1/Users/tapritc2/.lksearch/cache/mastDownload/H...COMPLETENoneNone
2/Users/tapritc2/.lksearch/cache/mastDownload/H...COMPLETENoneNone
\n", "
" ], "text/plain": [ " Local Path Status Message URL\n", "0 /Users/tapritc2/.lksearch/cache/mastDownload/H... COMPLETE None None\n", "1 /Users/tapritc2/.lksearch/cache/mastDownload/H... COMPLETE None None\n", "2 /Users/tapritc2/.lksearch/cache/mastDownload/H... COMPLETE None None" ] }, "execution_count": 30, "metadata": {}, "output_type": "execute_result" } ], "source": [ "manifest = K2_HLSPs.timeseries.download()\n", "manifest" ] }, { "cell_type": "markdown", "id": "a42fd1bd-f70a-4db9-b483-3a39f4787d4c", "metadata": {}, "source": [ "## Configuration and Caching\n", "\n", "`lksearch` has a default file download location that serves as the file cache, and an optional configuration file that can be created and used to overwrite the default values" ] }, { "cell_type": "markdown", "id": "03f52bd0-c5d3-4974-9b3a-dfd0c3d1a248", "metadata": {}, "source": [ "### lksearch File Download and Cache\n", "The `lksearch` file cache is a directory where files are downloaded to. This directory also serves as a cache directory, and if a file matching the name of the file to be downloaded exists we treat this as a cached file and by default do not overwrite the current file on disk. \n", "\n", "The default file download and cache directory is located at:\n", "`~/.lksearch/cache`\n", "\n", "This can be verified using the get_cache_dir convenience function in the config sub-module, e.g.:" ] }, { "cell_type": "code", "execution_count": 31, "id": "5ebda13a-0051-48c7-8272-e6aa3040f4b2", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'/Users/tapritc2/.lksearch/cache'" ] }, "execution_count": 31, "metadata": {}, "output_type": "execute_result" } ], "source": [ "from lksearch import config as lkconfig\n", "\n", "lkconfig.get_cache_dir()" ] }, { "cell_type": "markdown", "id": "e70e062e-d0f8-45e0-b01a-06cec8da54e5", "metadata": {}, "source": [ "#### Clearing the Cache & Corrupted Files\n", "If you wish to delete an individual file that you downloaded (for example, if you are concerned that a previously downloaded file is corrupted), the easiest way to do that is using the `Local Path` information in the manifest returned by the `.download()` function." ] }, { "cell_type": "code", "execution_count": 32, "id": "6e6625e2-c1c2-40fb-8fd2-fa3633cf3722", "metadata": {}, "outputs": [], "source": [ "import os\n", "\n", "# The manifest returned by download() is a pandas DataFrame\n", "# We will access the first local path using iloc as so\n", "os.remove(manifest.iloc[0][\"Local Path\"])" ] }, { "cell_type": "markdown", "id": "7ffa2d24-eba6-48fd-9f59-12a348dcb08d", "metadata": {}, "source": [ "If you want to clear *everything* from your cache, you can use the `config.clearcache()` function to completely empty your cache of downloaded files. by default this will run in \"test\" mode and print what you will be deleting. To confirm deletion, run with `test=False` optional parameter. " ] }, { "cell_type": "code", "execution_count": 33, "id": "1345bf88-74be-4aea-96c9-512ab31b349b", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Running in test mode, rerun with test=False to clear cache\n", "removing /Users/tapritc2/.lksearch/cache/mastDownload/TESS\n", "removing /Users/tapritc2/.lksearch/cache/mastDownload/K2\n", "removing /Users/tapritc2/.lksearch/cache/mastDownload/Kepler\n", "removing /Users/tapritc2/.lksearch/cache/mastDownload/TESSCut\n", "removing /Users/tapritc2/.lksearch/cache/mastDownload/HLSP\n" ] } ], "source": [ "lkconfig.clearcache()" ] }, { "cell_type": "markdown", "id": "6291a748-1e67-41b1-8049-57aabe2b744b", "metadata": {}, "source": [ "**Passing `test=False` will then fully delete the above directories** \n", "\n", "e.g. `lkconfig.clearcache(test=False)`" ] }, { "cell_type": "markdown", "id": "9adc419e-91b3-41bc-bc40-d37b5c628ebe", "metadata": {}, "source": [ "### lksearch Configuration and Configuration File\n", "lksearch has a number of configuration parameters, these are contained in the `~lksearch.Conf` [class](https://lightkurve.github.io/lksearch/apidoc.html#lksearch.Conf). One can modify these parameters for a given python session by updating the values in the Conf class. To modify these configuration parameters default values, lksearch also has an optional configuration file that is built on-top of `~astropy.config` using `~astropy.config.ConfigNamespace`. This file does not exist by default, but a default version can be created using the `config.create_config_file` helper function. Modifications to the values in this file will then update the default `~lksearch.Conf` values. " ] }, { "cell_type": "code", "execution_count": 34, "id": "345bb5e5-7b13-4ee8-9a08-c85de036ace4", "metadata": {}, "outputs": [], "source": [ "lkconfig.create_config_file(overwrite=True)" ] }, { "cell_type": "markdown", "id": "1561451f-d3c0-4df9-bdb9-343b63e0f136", "metadata": {}, "source": [ "This file can be found in the below location. To edit this, please see the astropy.config documentation. " ] }, { "cell_type": "code", "execution_count": 35, "id": "be7bc33c-eb6c-4ce7-81f8-d98076581cc4", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'/Users/tapritc2/.lksearch/config'" ] }, "execution_count": 35, "metadata": {}, "output_type": "execute_result" } ], "source": [ "lkconfig.get_config_dir()" ] }, { "cell_type": "code", "execution_count": 36, "id": "341857e6-aa78-4cc6-b68d-79fca23f7e63", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'/Users/tapritc2/.lksearch/config/lksearch.cfg'" ] }, "execution_count": 36, "metadata": {}, "output_type": "execute_result" } ], "source": [ "lkconfig.get_config_file()" ] }, { "cell_type": "markdown", "id": "edd120c1-cb63-462a-b997-f83f3da3c3ea", "metadata": {}, "source": [ "#### lksearch Cloud Configuration\n", "lksearch has three configuration parameters that are particularly relevant to cloud-based science platforms. These are:\n", " - CLOUD_ONLY: Only Download cloud based data. If False, will download all data. If True, will only download data located on a cloud (Amazon S3) bucket\n", " - PREFER_CLOUD: Prefer Cloud-based data product retrieval where available\n", " - DDOWNLOAD_CLOUD: Download cloud based data.If False, download() will return a pointer to the cloud based datainstead of downloading it - intended usage for cloud-based science platforms (e.g. TIKE)\n", "\n", "CLOUD_ONLY governs whether or not non-cloud based data will be possible to be downloaded. Many science files have both a cloud-based location (typically on Amazon S3) and a MAST archive location. By default this is False, and all products will be downloaded regardless of whether the file is available via cloud-hosting or MAST archive hosting. If CLOUD_ONLY is True, only files available for download on a cloud-based platform will be retrieved. This configuration parameter is passed through to the `~astroquery.mast` parameter of the same name. \n", "\n", "PREFER_CLOUD governs the default download behaviour in the event that a data product is available from both a cloud-based location and a MAST-hosted archive location. If True (default), then lksearch will preferentially download files from the cloud-host rather than the MAST-hosted Archive. This configuration parameter is passed through to the `~astroquery.mast` parameter of the same name. \n", "\n", "DOWNLOAD_CLOUD governs whether files that are hosted on the cloud are downloaded locally. If this value is True (default), cloud-hosted files are downloaded normally. If False, then files hosted on a cloud based platform are not downloaded, and a URI containing the path to the desired file on the cloud-host is returned instead of the local path to the file. This path can then be used to read the file remotely (see `~astropy.io.fits` [working with remote and cloud hosted files](https://docs.astropy.org/en/stable/io/fits/#working-with-remote-and-cloud-hosted-files:~:text=with%20large%20files-,Working%20with%20remote%20and%20cloud%2Dhosted%20files,-Unsigned%20integers) for more information). This ability may be most relevant when using lksearch on a cloud-based science platform where the remote read is very rapid and short-term local storage comparatively expensive. \n", "\n", "Using this DOWNLOAD_CLOUD functionality, we can find a cloud-hosted file and read it directly into memory like so:" ] }, { "cell_type": "code", "execution_count": 37, "id": "745b341d-2c8a-4de4-8050-02c039f4e1ee", "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "pipeline products: 100%|███████████████████████████████████████████| 1/1 [00:00<00:00, 395.88it/s]\n" ] }, { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Local PathStatusMessageURL
0s3://stpubdata/tess/public/tid/s0014/0000/0001...COMPLETELink to S3 bucket for remote readNone
\n", "
" ], "text/plain": [ " Local Path Status \\\n", "0 s3://stpubdata/tess/public/tid/s0014/0000/0001... COMPLETE \n", "\n", " Message URL \n", "0 Link to S3 bucket for remote read None " ] }, "execution_count": 37, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# First, lets update our configuration to not download a cloud-hosted file\n", "from lksearch import Conf\n", "\n", "Conf.DOWNLOAD_CLOUD = False\n", "\n", "# Now, lets find some data. We use this target earlier in the tutorial.\n", "toi = TESSSearch(\"TOI 1161\")\n", "\n", "# What happens when we try to download it in our updated configuration?\n", "cloud_result = toi.timeseries.mission_products[0].download()\n", "cloud_result" ] }, { "cell_type": "markdown", "id": "7027025a-7883-4c05-9659-ceda59ed79b4", "metadata": {}, "source": [ "As we can see above, instead of downloading the above file we have instead returned an amazon S3 URI for its cloud hosted location. If we want to access the file, we can do it using the remote-read capabilities of `~astropy.io.fits`. " ] }, { "cell_type": "code", "execution_count": 38, "id": "244ccba1-3d75-427d-ae06-93abbbb5c12d", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "{'file': >, 'filemode': 'readonly', 'hdrLoc': 0, 'datLoc': 5760, 'datSpan': 0}\n", "{'file': >, 'filemode': 'readonly', 'hdrLoc': 5760, 'datLoc': 20160, 'datSpan': 1935360}\n", "{'file': >, 'filemode': 'readonly', 'hdrLoc': 1955520, 'datLoc': 1961280, 'datSpan': 2880}\n" ] } ], "source": [ "import astropy.io.fits as fits\n", "\n", "with fits.open(\n", " cloud_result[\"Local Path\"].values[0], use_fsspec=True, fsspec_kwargs={\"anon\": True}\n", ") as hdu:\n", " for item in hdu:\n", " print(item.fileinfo())" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "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.12.3" } }, "nbformat": 4, "nbformat_minor": 5 }