From 74df6dd31a0d2a4717b081395a80389ee080b5b6 Mon Sep 17 00:00:00 2001 From: Nschanche Date: Tue, 30 Apr 2024 14:47:21 -0400 Subject: [PATCH] Updated example notebook --- docs/tutorials/Example_searches.ipynb | 3044 +++++++++++++------------ 1 file changed, 1644 insertions(+), 1400 deletions(-) diff --git a/docs/tutorials/Example_searches.ipynb b/docs/tutorials/Example_searches.ipynb index 51ae9ea..247ed8e 100644 --- a/docs/tutorials/Example_searches.ipynb +++ b/docs/tutorials/Example_searches.ipynb @@ -1,13 +1,21 @@ { "cells": [ + { + "cell_type": "markdown", + "id": "a3cd42a1", + "metadata": {}, + "source": [ + "# lksearch tutorial" + ] + }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 37, "id": "9f07ac77", "metadata": {}, "outputs": [], "source": [ - "from tssc import *" + "from tssc import MASTSearch, KeplerSearch, K2Search, TESSSearch" ] }, { @@ -15,7 +23,7 @@ "id": "5fa70bc4", "metadata": {}, "source": [ - "Welcome to the new search module 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", + "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", @@ -27,9 +35,11 @@ "id": "5b7aff9d", "metadata": {}, "source": [ - "# Basic Searches\n", + "## Basic Searches\n", "\n", - "This search package provides a user-friendly wrapper to search the MAST data archive. By default, you are only required to provide a target (either a name, id, or ra/dec coordinate).\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", @@ -45,19 +55,19 @@ " - quarter/month for Kepler\n", " - campaign for K2\n", " \n", - "**NOTE* only a single sequence can be passed. You can modify the table later if you want to limit to a list of sequences using search_result.limit_table()" + "**NOTE* only a single sequence can be passed on initialization. If you want to specify a list of values, you can modify the table after initialization using search_result.limit_table()" ] }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 6, "id": "a11826c6", "metadata": {}, "outputs": [ { "data": { "text/html": [ - "MASTSearch object containing 102 data products
\n", + "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", @@ -660,52 +1088,52 @@ " \n", " \n", " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", " \n", " \n", " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", " \n", @@ -716,47 +1144,47 @@ " \n", " \n", "
target_namepipelinemissionsectorexptimedistanceyeardescription
0158324245SPOCTESS14120.00.02019Light curves
1158324245SPOCTESS15120.00.02019Light curves
2268159861158324245SPOCTESS5526120.00.020222020Light curves
32681598611717079071SPOCTESS7426120.00.020242020Light curves
42681598611717079066SPOCTESS7540120.00.020242021Light curves
...
15268159861QLP781717079066CDIPSHLSP41600.0551800.00.020212022FITS
1626815986179158324245CDIPSHLSP54551800.00.02022FITS
1726815986180158324245QLPHLSP5455600.00.02022FITS
18268159861CDIPS811717079066QLPHLSP551800.0600.00.02022FITS
19268159861821717079071QLPHLSP55
\n", - "

20 rows × 8 columns

\n", + "

83 rows × 8 columns

\n", "
" ], "text/plain": [ - "TESSSearch object containing 20 data products target_name pipeline mission sector exptime distance year description\n", - "0 268159861 SPOC TESS 41 120.0 0.0 2021 Light curves\n", - "1 268159861 SPOC TESS 54 120.0 0.0 2022 Light curves\n", - "2 268159861 SPOC TESS 55 120.0 0.0 2022 Light curves\n", - "3 268159861 SPOC TESS 74 120.0 0.0 2024 Light curves\n", - "4 268159861 SPOC TESS 75 120.0 0.0 2024 Light curves\n", + "TESSSearch object containing 83 data products 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", - "15 268159861 QLP HLSP 41 600.0 0.0 2021 FITS\n", - "16 268159861 CDIPS HLSP 54 1800.0 0.0 2022 FITS\n", - "17 268159861 QLP HLSP 54 600.0 0.0 2022 FITS\n", - "18 268159861 CDIPS HLSP 55 1800.0 0.0 2022 FITS\n", - "19 268159861 QLP HLSP 55 600.0 0.0 2022 FITS\n", + "78 1717079066 CDIPS HLSP 55 1800.0 0.0 2022 FITS\n", + "79 158324245 CDIPS HLSP 55 1800.0 0.0 2022 FITS\n", + "80 158324245 QLP HLSP 55 600.0 0.0 2022 FITS\n", + "81 1717079066 QLP HLSP 55 600.0 0.0 2022 FITS\n", + "82 1717079071 QLP HLSP 55 600.0 0.0 2022 FITS\n", "\n", - "[20 rows x 8 columns]" + "[83 rows x 8 columns]" ] }, - "execution_count": 7, + "execution_count": 17, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Only return timeseries (lightcurve) products\n", - "Kep186_TESSlc = Kep186.timeseries\n", - "Kep186_TESSlc" + "toi_lc = toi.timeseries\n", + "toi_lc" ] }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 19, "id": "25a156f7", "metadata": {}, "outputs": [ { "data": { "text/html": [ - "TESSSearch object containing 17 data products
\n", + "TESSSearch object containing 48 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", @@ -1145,17 +1730,15 @@ "" ], "text/plain": [ - "TESSSearch object containing 10 data products target_name pipeline mission sector exptime distance year \\\n", - "0 268159861 SPOC TESS 41 120.0 0.0 2021 \n", - "1 268159861 SPOC TESS 41 120.0 0.0 2021 \n", - "2 268159861 SPOC TESS 54 120.0 0.0 2022 \n", - "3 268159861 SPOC TESS 54 120.0 0.0 2022 \n", - "4 268159861 SPOC TESS 55 120.0 0.0 2022 \n", - "5 268159861 SPOC TESS 55 120.0 0.0 2022 \n", - "6 268159861 SPOC TESS 74 120.0 0.0 2024 \n", - "7 268159861 SPOC TESS 74 120.0 0.0 2024 \n", - "8 268159861 SPOC TESS 75 120.0 0.0 2024 \n", - "9 268159861 SPOC TESS 75 120.0 0.0 2024 \n", + "TESSSearch object containing 8 data products 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 Light curves \n", @@ -1165,12 +1748,10 @@ "4 Light curves \n", "5 Target pixel files \n", "6 Light curves \n", - "7 Target pixel files \n", - "8 Light curves \n", - "9 Target pixel files " + "7 Target pixel files " ] }, - "execution_count": 10, + "execution_count": 21, "metadata": {}, "output_type": "execute_result" } @@ -1178,20 +1759,20 @@ "source": [ "# Keep any data type, but only the shortest cadence available, which in this case is 2-minute data\n", "\n", - "Kep186_shortest = Kep186.filter_table(exptime='shortest')\n", - "Kep186_shortest" + "toi_shortest = toi.filter_table(exptime='shortest')\n", + "toi_shortest" ] }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 22, "id": "6221e588", "metadata": {}, "outputs": [ { "data": { "text/html": [ - "TESSSearch object containing 14 data products
\n", + "TESSSearch object containing 127 data products
\n", "\n", + "
target_namepipelinemissionsectorexptimedistanceyeardescription
0158324245SPOCTESS7420.00.02024Light curves
52681598611158324245SPOCTESS55120.07420.00.020222024Target pixel files
626815986121717079066SPOCTESS74120.020.00.02024Light curves
726815986131717079066SPOCTESS74120.020.00.02024Target pixel files
826815986141717079066SPOCTESS75120.020.00.02024Light curves
926815986151717079066SPOCTESS75120.020.00.02024Target pixel files
6158324245SPOCTESS7520.00.02024Light curves
7158324245SPOCTESS7520.00.02024Target pixel files
\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \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 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": 28, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "Kep186_lim = Kep186.filter_table(limit=2)\n", - "Kep186_lim" + "toi_short_lcs = toi.timeseries.filter_table(exptime=120, sector=14)\n", + "toi_short_lcs" ] }, { @@ -1476,12 +2145,12 @@ "id": "0e5e9e42", "metadata": {}, "source": [ - "You can also download the files directly to your machine. " + "Once your search result contains the files you want, you can download the files directly to your machine. " ] }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 29, "id": "adae2b43", "metadata": {}, "outputs": [ @@ -1515,14 +2184,14 @@ " \n", " \n", " 0\n", - " /Users/tapritc2/.tssc/cache/mastDownload/TESS/...\n", + " /Users/nthom/.tssc/cache/mastDownload/TESS/tes...\n", " COMPLETE\n", " None\n", " None\n", " \n", " \n", " 0\n", - " /Users/tapritc2/.tssc/cache/mastDownload/TESS/...\n", + " /Users/nthom/.tssc/cache/mastDownload/HLSP/hls...\n", " COMPLETE\n", " None\n", " None\n", @@ -1533,17 +2202,17 @@ ], "text/plain": [ " Local Path Status Message URL\n", - "0 /Users/tapritc2/.tssc/cache/mastDownload/TESS/... COMPLETE None None\n", - "0 /Users/tapritc2/.tssc/cache/mastDownload/TESS/... COMPLETE None None" + "0 /Users/nthom/.tssc/cache/mastDownload/TESS/tes... COMPLETE None None\n", + "0 /Users/nthom/.tssc/cache/mastDownload/HLSP/hls... COMPLETE None None" ] }, - "execution_count": 13, + "execution_count": 29, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "Kep186_lim.download()" + "toi_short_lcs.download()" ] }, { @@ -1551,7 +2220,7 @@ "id": "a0935d18", "metadata": {}, "source": [ - "# Kepler Search\n" + "## Kepler Search\n" ] }, { @@ -1559,12 +2228,12 @@ "id": "feb3dd84", "metadata": {}, "source": [ - "The call to KeplerSearch saves all availabe data products for the target as a table. This can be useful for data exploration, but in some cases, the user may only want to access specific data types. Search has several convenient functions to limit the results to timeseries (lighcurve), cubedata (target pixel files and, in the case of TESS, full frame image cutouts), and dvreports (PDF data validation reports generated by the data pipelines). Calling these functions returns a new search object. " + "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), and dvreports (PDF data validation reports generated by the data pipelines). Calling these functions returns a new search object. " ] }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 30, "id": "ace8aad4", "metadata": {}, "outputs": [ @@ -1756,20 +2425,20 @@ "[82 rows x 8 columns]" ] }, - "execution_count": 14, + "execution_count": 30, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# What timeseries data is available?\n", - "kep137 = KeplerSearch('Kepler 137')\n", - "kep137" + "kep = KeplerSearch('Kepler 137')\n", + "kep" ] }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 31, "id": "ed6138b3", "metadata": {}, "outputs": [ @@ -1961,19 +2630,19 @@ "[40 rows x 8 columns]" ] }, - "execution_count": 15, + "execution_count": 31, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "kep137_lcs = kep137.timeseries\n", - "kep137_lcs" + "kep_lc = kep.timeseries\n", + "kep_lc" ] }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 32, "id": "cbedbf2a", "metadata": {}, "outputs": [ @@ -2007,14 +2676,14 @@ " \n", " \n", " 0\n", - " /Users/tapritc2/.tssc/cache/mastDownload/Keple...\n", + " /Users/nthom/.tssc/cache/mastDownload/Kepler/k...\n", " COMPLETE\n", " None\n", " None\n", " \n", " \n", " 0\n", - " /Users/tapritc2/.tssc/cache/mastDownload/Keple...\n", + " /Users/nthom/.tssc/cache/mastDownload/Kepler/k...\n", " COMPLETE\n", " None\n", " None\n", @@ -2025,18 +2694,18 @@ ], "text/plain": [ " Local Path Status Message URL\n", - "0 /Users/tapritc2/.tssc/cache/mastDownload/Keple... COMPLETE None None\n", - "0 /Users/tapritc2/.tssc/cache/mastDownload/Keple... COMPLETE None None" + "0 /Users/nthom/.tssc/cache/mastDownload/Kepler/k... COMPLETE None None\n", + "0 /Users/nthom/.tssc/cache/mastDownload/Kepler/k... COMPLETE None None" ] }, - "execution_count": 16, + "execution_count": 32, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# You can download a subsection of results directly\n", - "kep137[:2].download()" + "kep_lc[:2].download()" ] }, { @@ -2049,32 +2718,28 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 34, "id": "0890bbc6", "metadata": {}, "outputs": [ { - "data": { - "text/plain": [ - "array(['/Users/tapritc2/.tssc/cache/mastDownload/Kepler/kplr007419318_lc_Q111111111111111111/kplr007419318-2009131105131_llc.fits',\n", - " '/Users/tapritc2/.tssc/cache/mastDownload/Kepler/kplr007419318_lc_Q111111111111111111/kplr007419318-2009131105131_lpd-targ.fits.gz'],\n", - " dtype=object)" - ] - }, - "execution_count": 17, - "metadata": {}, - "output_type": "execute_result" + "name": "stdout", + "output_type": "stream", + "text": [ + "['/Users/nthom/.tssc/cache/mastDownload/Kepler/kplr007419318_lc_Q111111111111111111/kplr007419318-2009131105131_llc.fits'\n", + " '/Users/nthom/.tssc/cache/mastDownload/Kepler/kplr007419318_lc_Q111111111111111111/kplr007419318-2009131105131_lpd-targ.fits.gz']\n" + ] } ], "source": [ "# You can download a subsection of results directly\n", - "manifest = kep137[:2].download()\n", - "manifest['Local Path'].values" + "manifest = kep[:2].download()\n", + "print(manifest['Local Path'].values)" ] }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 35, "id": "502fee80", "metadata": {}, "outputs": [ @@ -2250,15 +2915,15 @@ "9 Target Pixel Long Cadence (TPL) - Q17 " ] }, - "execution_count": 18, + "execution_count": 35, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# we can also filter the results by observing quarter\n", - "kep137_quarters = kep137.filter_table(quarter=[7,17])\n", - "kep137_quarters" + "kep_quarters = kep.filter_table(quarter=[7,17])\n", + "kep_quarters" ] }, { @@ -2266,12 +2931,14 @@ "id": "0d4b9e69", "metadata": {}, "source": [ - "# K2 Search" + "## 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": 19, + "execution_count": 36, "id": "a775a2f7", "metadata": {}, "outputs": [ @@ -2395,34 +3062,26 @@ "5 FITS " ] }, - "execution_count": 19, + "execution_count": 36, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "K2_18 = K2Search(\"K2-18\")\n", - "K2_18" + "K2 = K2Search(\"K2-18\")\n", + "K2" ] }, { "cell_type": "code", - "execution_count": 20, - "id": "d2cfa795", + "execution_count": 46, + "id": "6207b0fa", "metadata": {}, "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "11\n", - "3\n" - ] - }, { "data": { "text/html": [ - "
\n", + "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", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \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
...........................
152299096355CDIPSHLSP541800.00.02022FITS
153299096355QLPHLSP54600.00.02022FITS
154299096355CDIPSHLSP551800.00.02022FITS
155299096355QLPHLSP55600.00.02022FITS
156299096355QLPHLSP56200.00.02022FITS
\n", + "

157 rows × 8 columns

\n", + "
" + ], + "text/plain": [ + "TESSSearch object containing 157 data products 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", + "152 299096355 CDIPS HLSP 54 1800.0 0.0 2022 \n", + "153 299096355 QLP HLSP 54 600.0 0.0 2022 \n", + "154 299096355 CDIPS HLSP 55 1800.0 0.0 2022 \n", + "155 299096355 QLP HLSP 55 600.0 0.0 2022 \n", + "156 299096355 QLP HLSP 56 200.0 0.0 2022 \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", + "152 FITS \n", + "153 FITS \n", + "154 FITS \n", + "155 FITS \n", + "156 FITS \n", + "\n", + "[157 rows x 8 columns]" + ] + }, + "execution_count": 57, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "results = TESSSearch(\"Kepler 16b\")" + "search_result = TESSSearch(\"Kepler 16b\")\n", + "search_result" ] }, { "cell_type": "code", - "execution_count": 26, + "execution_count": 58, "id": "a41178f6-2d5b-4e7c-808e-21d19eb7ff79", "metadata": {}, "outputs": [ @@ -2984,29 +3891,29 @@ "[1241 rows x 8 columns]" ] }, - "execution_count": 26, + "execution_count": 58, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "#tstart, tstop in mjd\n", - "ffi_res = results.search_individual_ffi(58682,58710, sector=14)\n", - "ffi_res" + "# tstart, tstop in mjd\n", + "ffis = search_result.search_individual_ffi(58682,58710, sector=14)\n", + "ffis" ] }, { "cell_type": "markdown", - "id": "19dea707-aa7e-4aa2-9e85-62e1afcf613a", + "id": "b5162fac", "metadata": {}, "source": [ - "# Can we download a FFI?" + "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": 27, - "id": "36dfae6c-58ef-4da5-a403-0e9b5fc8646d", + "execution_count": 60, + "id": "95f4fdfe", "metadata": {}, "outputs": [ { @@ -3039,7 +3946,7 @@ " \n", " \n", " 0\n", - " /Users/tapritc2/.tssc/cache/mastDownload/TESS/...\n", + " /Users/nthom/.tssc/cache/mastDownload/TESS/tes...\n", " COMPLETE\n", " None\n", " None\n", @@ -3050,679 +3957,16 @@ ], "text/plain": [ " Local Path Status Message URL\n", - "0 /Users/tapritc2/.tssc/cache/mastDownload/TESS/... COMPLETE None None" - ] - }, - "execution_count": 27, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "ffi_res[0].download()" - ] - }, - { - "cell_type": "markdown", - "id": "0b5ce6a1-e194-44eb-a59e-73c9a10a1ef6", - "metadata": {}, - "source": [ - "# Can we Index these objects like pandas?" - ] - }, - { - "cell_type": "code", - "execution_count": 28, - "id": "d49d963a-0b5b-4ff1-87f7-569117603b02", - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "TESSSearch object containing 37 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", - "
target_namepipelinemissionsectorexptimedistanceyeardescription
0268159861SPOCTESS41120.00.02021Light curves
1268159861SPOCTESS41120.00.02021Target pixel files
2268159861SPOCTESS54120.00.02022Light curves
3268159861SPOCTESS54120.00.02022Target pixel files
4268159861SPOCTESS55120.00.02022Light curves
...........................
32268159861QLPHLSP41600.00.02021FITS
33268159861CDIPSHLSP541800.00.02022FITS
34268159861QLPHLSP54600.00.02022FITS
35268159861CDIPSHLSP551800.00.02022FITS
36268159861QLPHLSP55600.00.02022FITS
\n", - "

37 rows × 8 columns

\n", - "
" - ], - "text/plain": [ - "TESSSearch object containing 37 data products target_name pipeline mission sector exptime distance year \\\n", - "0 268159861 SPOC TESS 41 120.0 0.0 2021 \n", - "1 268159861 SPOC TESS 41 120.0 0.0 2021 \n", - "2 268159861 SPOC TESS 54 120.0 0.0 2022 \n", - "3 268159861 SPOC TESS 54 120.0 0.0 2022 \n", - "4 268159861 SPOC TESS 55 120.0 0.0 2022 \n", - ".. ... ... ... ... ... ... ... \n", - "32 268159861 QLP HLSP 41 600.0 0.0 2021 \n", - "33 268159861 CDIPS HLSP 54 1800.0 0.0 2022 \n", - "34 268159861 QLP HLSP 54 600.0 0.0 2022 \n", - "35 268159861 CDIPS HLSP 55 1800.0 0.0 2022 \n", - "36 268159861 QLP HLSP 55 600.0 0.0 2022 \n", - "\n", - " description \n", - "0 Light curves \n", - "1 Target pixel files \n", - "2 Light curves \n", - "3 Target pixel files \n", - "4 Light curves \n", - ".. ... \n", - "32 FITS \n", - "33 FITS \n", - "34 FITS \n", - "35 FITS \n", - "36 FITS \n", - "\n", - "[37 rows x 8 columns]" - ] - }, - "execution_count": 28, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "Kep186 = TESSSearch('Kepler 186')\n", - "Kep186" - ] - }, - { - "cell_type": "code", - "execution_count": 29, - "id": "17d66f34-97c8-4c1e-ba78-5a8830e6e167", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "0 SPOC\n", - "1 SPOC\n", - "2 SPOC\n", - "3 SPOC\n", - "4 SPOC\n", - " ... \n", - "32 QLP\n", - "33 CDIPS\n", - "34 QLP\n", - "35 CDIPS\n", - "36 QLP\n", - "Name: pipeline, Length: 37, dtype: object" - ] - }, - "execution_count": 29, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "# We can take a column name and pass a column\n", - "Kep186[\"pipeline\"]" - ] - }, - { - "cell_type": "code", - "execution_count": 30, - "id": "348ed0b9-1192-4a06-83c4-a19fc73f93b1", - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "TESSSearch object containing 5 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", - "
target_namepipelinemissionsectorexptimedistanceyeardescription
0268159861SPOCTESS41120.00.02021Light curves
1268159861SPOCTESS41120.00.02021Target pixel files
2268159861SPOCTESS54120.00.02022Light curves
3268159861SPOCTESS54120.00.02022Target pixel files
4268159861SPOCTESS55120.00.02022Light curves
\n", - "
" - ], - "text/plain": [ - "TESSSearch object containing 5 data products target_name pipeline mission sector exptime distance year \\\n", - "0 268159861 SPOC TESS 41 120.0 0.0 2021 \n", - "1 268159861 SPOC TESS 41 120.0 0.0 2021 \n", - "2 268159861 SPOC TESS 54 120.0 0.0 2022 \n", - "3 268159861 SPOC TESS 54 120.0 0.0 2022 \n", - "4 268159861 SPOC TESS 55 120.0 0.0 2022 \n", - "\n", - " description \n", - "0 Light curves \n", - "1 Target pixel files \n", - "2 Light curves \n", - "3 Target pixel files \n", - "4 Light curves " - ] - }, - "execution_count": 30, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "# we can take slices\n", - "Kep186[0:5]" - ] - }, - { - "cell_type": "code", - "execution_count": 31, - "id": "582f5783-e0d2-4de7-ac43-5de142e47835", - "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", - "
target_namepipelinemissionsectorexptimedistanceyeardescription
0268159861SPOCTESS41120.00.02021Target pixel files
1268159861SPOCTESS55120.00.02022Light curves
\n", - "
" - ], - "text/plain": [ - "TESSSearch object containing 2 data products target_name pipeline mission sector exptime distance year \\\n", - "0 268159861 SPOC TESS 41 120.0 0.0 2021 \n", - "1 268159861 SPOC TESS 55 120.0 0.0 2022 \n", - "\n", - " description \n", - "0 Target pixel files \n", - "1 Light curves " - ] - }, - "execution_count": 31, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "# We can take boolean arrays\n", - "import numpy as np\n", - "mask = np.zeros(len(Kep186)).astype(bool)\n", - "mask[1]=True\n", - "mask[4]=True\n", - "Kep186[mask]\n", - "# This resets the index, unlike pandas" - ] - }, - { - "cell_type": "code", - "execution_count": 32, - "id": "87b1da09-6113-4945-904e-8c2b84fa2b56", - "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", - "
target_namepipelinemissionsectorexptimedistanceyeardescription
0268159861SPOCTESS41120.00.02021Target pixel files
1268159861SPOCTESS55120.00.02022Light curves
\n", - "
" - ], - "text/plain": [ - "TESSSearch object containing 2 data products target_name pipeline mission sector exptime distance year \\\n", - "0 268159861 SPOC TESS 41 120.0 0.0 2021 \n", - "1 268159861 SPOC TESS 55 120.0 0.0 2022 \n", - "\n", - " description \n", - "0 Target pixel files \n", - "1 Light curves " - ] - }, - "execution_count": 32, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "# We can take integer lists\n", - "# We're re-indexing here unlike pandas\n", - "Kep186[[1,4]]" - ] - }, - { - "cell_type": "code", - "execution_count": 33, - "id": "4b386e9a-c1f1-43be-8ad2-cfa6783be243", - "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", - "
missionsector
0TESS41
1TESS41
2TESS54
3TESS54
4TESS55
.........
32HLSP41
33HLSP54
34HLSP54
35HLSP55
36HLSP55
\n", - "

37 rows × 2 columns

\n", - "
" - ], - "text/plain": [ - " mission sector\n", - "0 TESS 41\n", - "1 TESS 41\n", - "2 TESS 54\n", - "3 TESS 54\n", - "4 TESS 55\n", - ".. ... ...\n", - "32 HLSP 41\n", - "33 HLSP 54\n", - "34 HLSP 54\n", - "35 HLSP 55\n", - "36 HLSP 55\n", - "\n", - "[37 rows x 2 columns]" + "0 /Users/nthom/.tssc/cache/mastDownload/TESS/tes... COMPLETE None None" ] }, - "execution_count": 33, + "execution_count": 60, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "# We can return a dataframe from a list of columns\n", - "# This is returns a pandas data frame, not a search object \n", - "# This is since we are missing required columns \n", - "Kep186[[\"mission\", \"sector\"]]" + "ffis.filter_table(limit=1).download()" ] } ], @@ -3742,7 +3986,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.12.2" + "version": "3.9.13" } }, "nbformat": 4,