search_targetpixelfile, radius=None, cadence='long', mission='Kepler', 'K2', 'TESS', quarter=None, month=None, campaign=None, sector=None, limit=None)

Searches the public data archive at MAST for a Kepler or TESS TargetPixelFile.

This function fetches a data table that lists the Target Pixel Files (TPFs) that fall within a region of sky centered around the position of target and within a cone of a given radius. If no value is provided for radius, only a single target will be returned.

targetstr, int, or astropy.coordinates.SkyCoord object

Target around which to search. Valid inputs include:

  • The name of the object as a string, e.g. “Kepler-10”.

  • The KIC or EPIC identifier as an integer, e.g. 11904151.

  • A coordinate string in decimal format, e.g. “285.67942179 +50.24130576”.

  • A coordinate string in sexagesimal format, e.g. “19:02:43.1 +50:14:28.7”.

  • An astropy.coordinates.SkyCoord object.

radiusfloat or astropy.units.Quantity object

Conesearch radius. If a float is given it will be assumed to be in units of arcseconds. If None then we default to 0.0001 arcsec.


‘long’ or ‘short’.

missionstr, list of str

‘Kepler’, ‘K2’, or ‘TESS’. By default, all will be returned.

quarter, campaign, sectorint, list of ints

Kepler Quarter, K2 Campaign, or TESS Sector number. By default all quarters/campaigns/sectors will be returned.

month1, 2, 3, 4 or list of int

For Kepler’s prime mission, there are three short-cadence TargetPixelFiles for each quarter, each covering one month. Hence, if cadence=’short’ you can specify month=1, 2, 3, or 4. By default all months will be returned.


Maximum number of products to return.

resultSearchResult object

Object detailing the data products found.


This example demonstrates how to use the search_targetpixelfile() function to query and download data. Before instantiating a KeplerTargetPixelFile object or downloading any science products, we can identify potential desired targets with search_targetpixelfile():

>>> search_result = search_targetpixelfile('Kepler-10')  
>>> print(search_result)  

The above code will query mast for Target Pixel Files (TPFs) available for the known planet system Kepler-10, and display a table containing the available science products. Because Kepler-10 was observed during 15 Quarters, the table will have 15 entries. To obtain a TargetPixelFileCollection object containing all 15 observations, use:

>>> search_result.download_all()  

or we can download a single product by limiting our search:

>>> tpf = search_targetpixelfile('Kepler-10', quarter=2).download()  

The above line of code will only download Quarter 2 and create a single KeplerTargetPixelFile object called tpf.

We can also pass a radius into search_targetpixelfile to perform a cone search:

>>> search_targetpixelfile('Kepler-10', radius=100).targets  

This will display a table containing all targets within 100 arcseconds of Kepler-10. We can download a TargetPixelFileCollection object containing all available products for these targets in Quarter 4 with:

>>> search_targetpixelfile('Kepler-10', radius=100, quarter=4).download_all()