Skip to content

Using tesswcs to find observable targets

tesswcs has some convenience functions to help you find out which targets are observable with TESS. The get_pixel_locations functon will accept sky coordinates, and return a table of which sector, camera, CCD, row, and column those targets fall on (if any).

Let's take a look at how to use it.

Example 1: Finding where transiting planets fall on TESS pixels

from tesswcs.locate import get_pixel_locations
import numpy as np
import matplotlib.pyplot as plt
import astropy.units as u
from astropy.table import Table

First, we need a target list to check the observability of. For this purpose, I will use the list of confirmed exoplanets. Below I use astroquery to get the coordinates of all the confirmed, transiting exoplanets from the Exoplanet Archive.

from astroquery.ipac.nexsci.nasa_exoplanet_archive import NasaExoplanetArchive
confirmed_exoplanets_table = NasaExoplanetArchive.query_criteria(table="ps", select="pl_name,ra,dec,sy_tmag", where="default_flag=1 AND tran_flag=1")
confirmed_exoplanets_table.sort('sy_tmag')
confirmed_exoplanets_table
QTable masked=True length=4176
pl_nameradecsy_tmagsky_coord
degdegmagdeg,deg
str19float64float64float64SkyCoord
HD 219134 c348.337202657.16962554.6278348.3372026,57.1696255
HD 219134 b348.337202657.16962554.6278348.3372026,57.1696255
HD 136352 b230.4401147-48.31881745.0494230.4401147,-48.3188174
HD 136352 c230.4401147-48.31881745.0494230.4401147,-48.3188174
HD 136352 d230.4401147-48.31881745.0494230.4401147,-48.3188174
pi Men c84.2992798-80.46460415.105484.2992798,-80.4646041
...............
WD 1856+534 b284.41567553.509024416.338284.415675,53.5090244
Lupus-TR-3 b232.5774696-42.979946117.7596232.5774696,-42.9799461
HAT-P-63 b279.7967696-20.024268419.2571279.7967696,-20.0242684
OGLE-TR-56 b269.1479583-29.5392222nan269.1479583,-29.5392222
SWEEPS-11 b269.7583333-29.1981944nan269.7583333,-29.1981944
SWEEPS-4 b269.7246667-29.1890556nan269.7246667,-29.1890556
confirmed_exoplanets_table['sky_coord']
<SkyCoord (ICRS): (ra, dec) in deg
    [(348.3372026,  57.1696255), (348.3372026,  57.1696255),
     (230.4401147, -48.3188174), ..., (269.1479583, -29.5392222),
     (269.7583333, -29.1981944), (269.7246667, -29.1890556)]>

I can now pass these SkyCoords to get_pixel_location to get a table of the regions those targets fall on. Any targets that do not fall on a pixel will be omitted.

observable = get_pixel_locations(confirmed_exoplanets_table['sky_coord'])

We can use pandas to learn more about this table. For example, how many planets are observable for the first time during cycle 7?

g = observable.to_pandas().groupby('Target Index').min()
g
Sector Camera CCD Row Column
Target Index
0 17 2 1 384.5 105.2
1 17 2 1 384.5 105.2
2 12 1 1 204.0 107.7
3 12 1 1 204.0 107.7
4 12 1 1 204.0 107.7
... ... ... ... ... ...
4171 12 1 1 147.9 1114.4
4172 92 1 2 418.6 1154.5
4173 39 1 1 356.6 27.1
4174 65 1 1 1057.1 1334.6
4175 65 1 1 1055.5 1339.7

4169 rows × 5 columns

This groupby operation takes the min across all the columns for cases of the same 'Target Index'

cycle7_mask = (g['Sector'] >= 84) & (g['Sector'] <= 96)
target_index = list(g[cycle7_mask].index)
print(len(target_index))
92

There are 92 confirmed transiting planets that will be observed for the first time in Cycle 7!

confirmed_exoplanets_table[target_index]
QTable masked=True length=92
pl_nameradecsy_tmagsky_coord
degdegmagdeg,deg
str19float64float64float64SkyCoord
HD 106315 c183.4724742-0.39343578.56338183.4724742,-0.3934357
HD 106315 b183.4724742-0.39343578.56338183.4724742,-0.3934357
Wolf 503 b206.8461979-6.13933699.2493206.8461979,-6.1393369
HD 137496 b231.7420543-16.50900149.29961231.7420543,-16.5090014
K2-292 b205.3758786-9.94607049.31975205.3758786,-9.9460704
K2-233 b230.4799011-20.23179759.8125230.4799011,-20.2317975
...............
K2-316 c233.6247336-23.259466314.2731233.6247336,-23.2594663
K2-316 b233.6247336-23.259466314.2731233.6247336,-23.2594663
K2-52 b246.6114157-24.969946214.2904246.6114157,-24.9699462
K2-315 b228.0210932-20.108163414.3273228.0210932,-20.1081634
K2-378 b205.1596569-11.117233214.8943205.1596569,-11.1172332
HAT-P-63 b279.7967696-20.024268419.2571279.7967696,-20.0242684

Example 2: Finding whether a transient will be observable with TESS

Sometimes we might find an interesting transient, and we want to know whether it will fall on a TESS pixel so that we can recover the optical time-series when the data is downlinked. For example, GRB 231106A occured in November 2023 and happened to be observable during the TESS survey.

Here we show how we would find out if a transient has been (or will be) observable with TESS.

To do this we will need two things, the coordinate of the object, and the time at which we would like to observe it. Here we'll use the location and detection time of GRB 231106A.

from astropy.time import Time
from astropy.coordinates import SkyCoord

t = Time('2023-11-06T18:13:23Z')
c = SkyCoord(113.4482, 29.2245, unit='degree')
get_pixel_locations(coords=c, time=t)
Table length=1
Target IndexSectorCameraCCDRowColumn
int64int64int64int64float64float64
07141764.61451.4

We can see that this returned a hit, we are able to detect the target during Sector 71, on Camera 4, CCD 1!

In instances where the time passed is recent (or in the future!) and there is no archival TESS WCS to use, tesswcs will predict the WCS for future TESS pointings.