Plotting a Catalog over a Kepler Full Frame Image File#


This tutorial demonstrates how to access the WCS (World Coordinate System) from a full frame image file and use this data to plot a catalog of objects over the FFI.
ffi_tic_plot

Table of Contents#

Introduction
Imports
Getting the Data
File Information
Displaying Image Data
Overplotting Objects
Additional Resources
About this Notebook


Introduction#

Full Frame Image file background: A Full Frame Image (FFI) contains values for every pixel in each of the 84 channels. Standard calibrations, such as flat fields, blacks, and smears have been applied to the calibrated FFIs. These files also contain a World Coordinate System (WCS) that attaches RA and Dec coordinates to pixel x and y values.

Some notes about the file: kplr2009170043915_ffi-cal.fits
The filename contains phrases for identification, where

  • kplr = Kepler

  • 2009170043915 = year 2009, day 170, time 04:39:15

  • ffi-cal = calibrated FFI image

Defining some terms:

  • HDU: Header Data Unit; a FITS file is made up of Header or Data units that contain information, data, and metadata relating to the file. The first HDU is called the primary, and anything that follows is considered an extension.

  • TIC: TESS Input Catalog; a catalog of luminous sources on the sky to be used by the TESS mission. We will use the TIC in this notebook to query a catalog of objects that we will then plot over an image from Kepler.

  • WCS: World Coordinate System; coordinates attached to each pixel of an N-dimensional image of a FITS file. For example, a specified celestial RA and Dec associated with pixel location in the image.

For more information about the Kepler mission and collected data, visit the Kepler archive page. To read more details about light curves and important data terms, look in the Kepler archive manual.

Top of Page


Imports#

Let’s start by importing some libraries to the environment:

  • numpy to handle array functions

  • astropy.io fits for accessing fits files

  • astropy.wcs WCS to project the World Coordinate System on the plot

  • astropy.table Table for creating tidy tables of the data

  • matplotlib.pyplot for plotting data

%matplotlib inline
import numpy as np
from astropy.io import fits
from astropy.wcs import WCS
from astropy.table import Table
import matplotlib.pyplot as plt

Top of Page


Getting the Data#

Start by importing libraries from Astroquery. For a longer, more detailed description using of Astroquery, please visit this tutorial or read the Astroquery documentation.

from astroquery.mast import Mast
from astroquery.mast import Observations


Next, we need to find the data file. This is similar to searching for the data using the MAST Portal in that we will be using certain keywords to find the file. The object we are looking for is kplr2009170043915, collected by the Kepler spacecraft. We are searching for an FFI file of this object:

kplrObs = Observations.query_criteria(obs_id="kplr2009170043915_84", obs_collection="KeplerFFI")
kplrProds = Observations.get_product_list(kplrObs[0])
yourProd = Observations.filter_products(kplrProds, extension='kplr2009170043915_ffi-cal.fits', 
                                        mrp_only=False)
yourProd
Table masked=True length=1
obsIDobs_collectiondataproduct_typeobs_iddescriptiontypedataURIproductTypeproductGroupDescriptionproductSubGroupDescriptionproductDocumentationURLprojectprvversionproposal_idproductFilenamesizeparent_obsiddataRightscalib_levelfilters
str6str9str5str20str22str1str106str7str28str1str1str6str1str1str37int64str6str6int64str6
385623KeplerFFIimagekplr2009170043915_84Full Frame Image (FFI)Cmast:KEPLERFFI/url/missions/kepler/ffi/kplr2009170043915_ffi-cal.fitsSCIENCEMinimum Recommended Products----Kepler----kplr2009170043915_ffi-cal.fits407882880385623PUBLIC1KEPLER


Now that we’ve found the data file, we can download it using the reults shown in the table above:

Observations.download_products(yourProd, mrp_only=False, cache=False)
Downloading URL https://mast.stsci.edu/api/v0.1/Download/file?uri=mast:KEPLERFFI/url/missions/kepler/ffi/kplr2009170043915_ffi-cal.fits to ./mastDownload/KeplerFFI/kplr2009170043915_84/kplr2009170043915_ffi-cal.fits ...
 [Done]
Table length=1
Local PathStatusMessageURL
str76str8objectobject
./mastDownload/KeplerFFI/kplr2009170043915_84/kplr2009170043915_ffi-cal.fitsCOMPLETENoneNone

Top of Page


Reading FITS Extensions#


Now that we have the file, we can start working with the data. We will begin by assigning a shorter name to the file to make it easier to use. Then, using the info function from astropy.io.fits, we can see some information about the FITS Header Data Units:

filename = "./mastDownload/KeplerFFI/kplr2009170043915_84/kplr2009170043915_ffi-cal.fits"
fits.info(filename)
Filename: ./mastDownload/KeplerFFI/kplr2009170043915_84/kplr2009170043915_ffi-cal.fits
No.    Name      Ver    Type      Cards   Dimensions   Format
  0  PRIMARY       1 PrimaryHDU      57   ()      
  1  MOD.OUT 2.1    1 ImageHDU       100   (1132, 1070)   float32   
  2  MOD.OUT 2.2    1 ImageHDU       100   (1132, 1070)   float32   
  3  MOD.OUT 2.3    1 ImageHDU       100   (1132, 1070)   float32   
  4  MOD.OUT 2.4    1 ImageHDU       100   (1132, 1070)   float32   
  5  MOD.OUT 3.1    1 ImageHDU       100   (1132, 1070)   float32   
  6  MOD.OUT 3.2    1 ImageHDU       100   (1132, 1070)   float32   
  7  MOD.OUT 3.3    1 ImageHDU       100   (1132, 1070)   float32   
  8  MOD.OUT 3.4    1 ImageHDU       100   (1132, 1070)   float32   
  9  MOD.OUT 4.1    1 ImageHDU       100   (1132, 1070)   float32   
 10  MOD.OUT 4.2    1 ImageHDU       100   (1132, 1070)   float32   
 11  MOD.OUT 4.3    1 ImageHDU       100   (1132, 1070)   float32   
 12  MOD.OUT 4.4    1 ImageHDU       100   (1132, 1070)   float32   
 13  MOD.OUT 6.1    1 ImageHDU       100   (1132, 1070)   float32   
 14  MOD.OUT 6.2    1 ImageHDU       100   (1132, 1070)   float32   
 15  MOD.OUT 6.3    1 ImageHDU       100   (1132, 1070)   float32   
 16  MOD.OUT 6.4    1 ImageHDU       100   (1132, 1070)   float32   
 17  MOD.OUT 7.1    1 ImageHDU       100   (1132, 1070)   float32   
 18  MOD.OUT 7.2    1 ImageHDU       100   (1132, 1070)   float32   
 19  MOD.OUT 7.3    1 ImageHDU       100   (1132, 1070)   float32   
 20  MOD.OUT 7.4    1 ImageHDU       100   (1132, 1070)   float32   
 21  MOD.OUT 8.1    1 ImageHDU       100   (1132, 1070)   float32   
 22  MOD.OUT 8.2    1 ImageHDU       100   (1132, 1070)   float32   
 23  MOD.OUT 8.3    1 ImageHDU       100   (1132, 1070)   float32   
 24  MOD.OUT 8.4    1 ImageHDU       100   (1132, 1070)   float32   
 25  MOD.OUT 9.1    1 ImageHDU       100   (1132, 1070)   float32   
 26  MOD.OUT 9.2    1 ImageHDU       100   (1132, 1070)   float32   
 27  MOD.OUT 9.3    1 ImageHDU       100   (1132, 1070)   float32   
 28  MOD.OUT 9.4    1 ImageHDU       100   (1132, 1070)   float32   
 29  MOD.OUT 10.1    1 ImageHDU       100   (1132, 1070)   float32   
 30  MOD.OUT 10.2    1 ImageHDU       100   (1132, 1070)   float32   
 31  MOD.OUT 10.3    1 ImageHDU       100   (1132, 1070)   float32   
 32  MOD.OUT 10.4    1 ImageHDU       100   (1132, 1070)   float32   
 33  MOD.OUT 11.1    1 ImageHDU       100   (1132, 1070)   float32   
 34  MOD.OUT 11.2    1 ImageHDU       100   (1132, 1070)   float32   
 35  MOD.OUT 11.3    1 ImageHDU       100   (1132, 1070)   float32   
 36  MOD.OUT 11.4    1 ImageHDU       100   (1132, 1070)   float32   
 37  MOD.OUT 12.1    1 ImageHDU       100   (1132, 1070)   float32   
 38  MOD.OUT 12.2    1 ImageHDU       100   (1132, 1070)   float32   
 39  MOD.OUT 12.3    1 ImageHDU       100   (1132, 1070)   float32   
 40  MOD.OUT 12.4    1 ImageHDU       100   (1132, 1070)   float32   
 41  MOD.OUT 13.1    1 ImageHDU       100   (1132, 1070)   float32   
 42  MOD.OUT 13.2    1 ImageHDU       100   (1132, 1070)   float32   
 43  MOD.OUT 13.3    1 ImageHDU       100   (1132, 1070)   float32   
 44  MOD.OUT 13.4    1 ImageHDU       100   (1132, 1070)   float32   
 45  MOD.OUT 14.1    1 ImageHDU       100   (1132, 1070)   float32   
 46  MOD.OUT 14.2    1 ImageHDU       100   (1132, 1070)   float32   
 47  MOD.OUT 14.3    1 ImageHDU       100   (1132, 1070)   float32   
 48  MOD.OUT 14.4    1 ImageHDU       100   (1132, 1070)   float32   
 49  MOD.OUT 15.1    1 ImageHDU       100   (1132, 1070)   float32   
 50  MOD.OUT 15.2    1 ImageHDU       100   (1132, 1070)   float32   
 51  MOD.OUT 15.3    1 ImageHDU       100   (1132, 1070)   float32   
 52  MOD.OUT 15.4    1 ImageHDU       100   (1132, 1070)   float32   
 53  MOD.OUT 16.1    1 ImageHDU       100   (1132, 1070)   float32   
 54  MOD.OUT 16.2    1 ImageHDU       100   (1132, 1070)   float32   
 55  MOD.OUT 16.3    1 ImageHDU       100   (1132, 1070)   float32   
 56  MOD.OUT 16.4    1 ImageHDU       100   (1132, 1070)   float32   
 57  MOD.OUT 17.1    1 ImageHDU       100   (1132, 1070)   float32   
 58  MOD.OUT 17.2    1 ImageHDU       100   (1132, 1070)   float32   
 59  MOD.OUT 17.3    1 ImageHDU       100   (1132, 1070)   float32   
 60  MOD.OUT 17.4    1 ImageHDU       100   (1132, 1070)   float32   
 61  MOD.OUT 18.1    1 ImageHDU       100   (1132, 1070)   float32   
 62  MOD.OUT 18.2    1 ImageHDU       100   (1132, 1070)   float32   
 63  MOD.OUT 18.3    1 ImageHDU       100   (1132, 1070)   float32   
 64  MOD.OUT 18.4    1 ImageHDU       100   (1132, 1070)   float32   
 65  MOD.OUT 19.1    1 ImageHDU       100   (1132, 1070)   float32   
 66  MOD.OUT 19.2    1 ImageHDU       100   (1132, 1070)   float32   
 67  MOD.OUT 19.3    1 ImageHDU       100   (1132, 1070)   float32   
 68  MOD.OUT 19.4    1 ImageHDU       100   (1132, 1070)   float32   
 69  MOD.OUT 20.1    1 ImageHDU       100   (1132, 1070)   float32   
 70  MOD.OUT 20.2    1 ImageHDU       100   (1132, 1070)   float32   
 71  MOD.OUT 20.3    1 ImageHDU       100   (1132, 1070)   float32   
 72  MOD.OUT 20.4    1 ImageHDU       100   (1132, 1070)   float32   
 73  MOD.OUT 22.1    1 ImageHDU       100   (1132, 1070)   float32   
 74  MOD.OUT 22.2    1 ImageHDU       100   (1132, 1070)   float32   
 75  MOD.OUT 22.3    1 ImageHDU       100   (1132, 1070)   float32   
 76  MOD.OUT 22.4    1 ImageHDU       100   (1132, 1070)   float32   
 77  MOD.OUT 23.1    1 ImageHDU       100   (1132, 1070)   float32   
 78  MOD.OUT 23.2    1 ImageHDU       100   (1132, 1070)   float32   
 79  MOD.OUT 23.3    1 ImageHDU       100   (1132, 1070)   float32   
 80  MOD.OUT 23.4    1 ImageHDU       100   (1132, 1070)   float32   
 81  MOD.OUT 24.1    1 ImageHDU       100   (1132, 1070)   float32   
 82  MOD.OUT 24.2    1 ImageHDU       100   (1132, 1070)   float32   
 83  MOD.OUT 24.3    1 ImageHDU       100   (1132, 1070)   float32   
 84  MOD.OUT 24.4    1 ImageHDU       100   (1132, 1070)   float32   
  • **No. 0 (Primary): **
    This HDU contains meta-data related to the entire file.

  • **No. 1-84 (Image): **
    Each of the 84 image extensions contains an array that can be plotted as an image. We will plot one in this tutorial along with catalog data.


Let’s say we wanted to see more information about the header and extensions than what the fits.info command gave us. For example, we can access information stored in the header of any of the Image extensions (No.1 - 84, MOD.OUT). The following line opens the FITS file, writes the first HDU extension into header1, and then closes the file. Only 24 rows of data are displayed here but you can view them all by adjusting the range:

with fits.open(filename) as hdulist: 
    header1 = hdulist[1].header
  
print(repr(header1[1:25]))
BITPIX  =                  -32 / array data type                                
NAXIS   =                    2 / NAXIS                                          
NAXIS1  =                 1132 / length of first array dimension                
NAXIS2  =                 1070 / length of second array dimension               
PCOUNT  =                    0 / group parameter count (not used)               
GCOUNT  =                    1 / group count (not used)                         
INHERIT =                    T / inherit the primary header                     
EXTNAME = 'MOD.OUT 2.1'        / name of extension                              
EXTVER  =                    1 / extension version number (not format version)  
TELESCOP= 'Kepler  '           / telescope                                      
INSTRUME= 'Kepler Photometer'  / detector type                                  
CHANNEL =                    1 / CCD channel                                    
SKYGROUP=                   81 / roll-independent location of channel           
MODULE  =                    2 / CCD module                                     
OUTPUT  =                    1 / CCD output                                     
TIMEREF = 'SOLARSYSTEM'        / barycentric correction applied to times        
TASSIGN = 'SPACECRAFT'         / where time is assigned                         
TIMESYS = 'TDB     '           / time system is barycentric JD                  
MJDSTART=       55001.17349214 / [d] start of observation in spacecraft MJD     
MJDEND  =        55001.1939257 / [d] end of observation in spacecraft MJD       
BJDREFI =              2454833 / integer part of BJD reference date             
BJDREFF =           0.00000000 / fraction of the day in BJD reference date      
TIMEUNIT= 'd       '           / time unit for TIME, TSTART and TSTOP           
TSTART  =         168.67667104 / observation start time in BJD-BJDREF           

Top of Page


Displaying Image Data#


First, let’s find the WCS information associated with the FITS file we are using. One way to do this is to access the header and print the rows containing the relevant data (54 - 65). This gives us the reference coordinates (CRVAL1, CRVAL2) that correspond to the reference pixels:

with fits.open(filename) as hdulist: 
    header1 = hdulist[1].header
  
print(repr(header1[54:61]))
WCSAXES =                    2 / number of WCS axes                             
CTYPE1  = 'RA---TAN-SIP'       / Gnomonic projection + SIP distortions          
CTYPE2  = 'DEC--TAN-SIP'       / Gnomonic projection + SIP distortions          
CRVAL1  =    290.4620065226813 / RA at CRPIX1, CRPIX2                           
CRVAL2  =    38.32946356799192 / DEC at CRPIX1, CRPIX2                          
CRPIX1  =                533.0 / X reference pixel                              
CRPIX2  =                521.0 / Y reference pixel                              


Let’s pick an image HDU and display its array. We can also choose to print the length of the array to get an idea of the dimensions of the image:

with fits.open(filename) as hdulist:
    imgdata = hdulist[1].data
    
print(len(imgdata))
print(imgdata)
1070
[[ 2.8926212e+01  5.7084761e+00  2.8518679e+00 ...  2.3335369e-02
   3.8872162e-01  2.4866710e+00]
 [ 2.5392172e+01  4.9826989e+00  2.3192320e+00 ... -3.5835370e-01
   9.4126135e-01  1.4343496e-01]
 [ 2.7359493e+01  5.5186005e+00  1.1480473e+00 ...  5.8914202e-01
  -2.0753877e+00  2.3046710e-01]
 ...
 [-3.8266034e+02 -9.6860485e+00  1.7396482e+01 ...  1.3947951e+00
  -8.3887035e-01  9.5944041e-01]
 [-3.8286859e+02 -5.6933088e+00  2.0129442e+01 ... -7.7534288e-01
   1.5140564e+00  1.3752979e+00]
 [-3.8489960e+02 -3.4747849e+00  1.5189555e+00 ...  1.0207459e+00
   6.7454106e-01 -2.0665376e-02]]

We can now plot this array as an image:

fig = plt.figure(figsize=(16,8))
plt.imshow(imgdata, cmap=plt.cm.gray)
plt.colorbar()
plt.clim(0,20000)
../../../_images/e85ee41755f46243598f95e52916d0f6070c1be9e500eb239868802efbbbf786.png

Now that we’ve seen the image and the WCS information, we can plot FFI with a WCS projection. To do this, first we will access the file header and assign a WCS object. Then we will plot the image with the projection, and add labels and a grid for usability:

hdu = fits.open(filename)[1]
wcs = WCS(hdu.header)

fig = plt.figure(figsize=(16,8))
ax = plt.subplot(projection=wcs) 
im = ax.imshow(hdu.data, cmap=plt.cm.gray, origin='lower', clim=(0,20000))
fig.colorbar(im)

plt.title('FFI with WCS Projection')
ax.set_xlabel('RA [deg]')
ax.set_ylabel('Dec [deg]')
ax.grid(color='white', ls='solid')
WARNING: FITSFixedWarning: 'datfix' made the change 'Set MJD-OBS to 55001.173492 from DATE-OBS.
Set MJD-END to 55001.193926 from DATE-END'. [astropy.wcs.wcs]
../../../_images/b7f4d2ef9fe8a7a825bdb21b702e1aedc156229f0b6ef62f172aec3933e05763.png

Top of Page


Getting the Catalog Data#

Now that we have an image, we can use astroquery to retrieve a catalog of objects and overlay it onto the image. First, we will start with importing catalog data from astroquery:

from astroquery.mast import Catalogs

We will query a catalog of objects from TIC (TESS Input Catalog). For more information about TIC, follow this link. Our search will be centered on the same RA and Declination listed in the header of the FFI image and will list objects within a 1 degree radius of that location. It might take a couple seconds longer than usual for this cell to run:

why tic??? explain…

catalogData = Catalogs.query_region("290.4620065226813  38.32946356799192", radius="0.2 deg", catalog="TIC")
dattab = Table(catalogData)
dattab
WARNING: InputWarning: Coordinate string is being interpreted as an ICRS coordinate provided in degrees. [astroquery.utils.commons]
Table length=7955
IDradecpmRApmDECTmagobjTypetypeSrcversionHIPTYCUCACTWOMASSSDSSALLWISEGAIAAPASSKICPOSflage_pmRAe_pmDECPMflagplxe_plxPARflaggallonggallateclongeclatBmage_BmagVmage_Vmagumage_umaggmage_gmagrmage_rmagimage_imagzmage_zmagJmage_JmagHmage_HmagKmage_KmagTWOMflagproxw1mage_w1magw2mage_w2magw3mage_w3magw4mage_w4magGAIAmage_GAIAmage_TmagTESSflagSPFlagTeffe_Tefflogge_loggMHe_MHrade_radmasse_massrhoe_rholumclasslume_lumde_debve_ebvnumcontcontratiodispositionduplicate_idpriorityeneg_EBVepos_EBVEBVflageneg_Massepos_Masseneg_Radepos_Radeneg_rhoepos_rhoeneg_loggepos_loggeneg_lumepos_lumeneg_distepos_distdistflageneg_Teffepos_TeffTeffFlaggaiabpe_gaiabpgaiarpe_gaiarpgaiaqflagstarchareFlagVmagFlagBmagFlagsplistse_RAe_DecRA_origDec_orige_RA_orige_Dec_origraddflagwdflagdstArcSec
str11float64float64float64float64float64str8str7str8str1str12str10str16str19str19str19str8str7str8float64float64str6float64float64str5float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64str19float64float64float64float64float64float64float64float64float64float64float64float64str5str5float64float64float64float64float64float64float64float64float64float64float64float64str5float64float64float64float64float64float64int64float64str9str11float64float64float64str9float64float64float64float64float64float64float64float64float64float64float64float64str6float64float64str5float64float64float64float64int64str1str8str8str13float64float64float64float64float64float64int64int64float64
1877313283290.46066428261238.3304513142701-5.59848-4.2389419.8414STARgaia220190415--------1237668681001865025--2052812123437410304----gaia21.443521.32282gaia21.039850.761685gaia270.554345558281510.9790727152229302.67088260494659.4705457723064nannan20.87870.082330.050.021.79640.064697920.51540.031357420.01530.033953919.66380.0813132nannannannannannan--nannannannannannannannannan20.5250.0089830.0199gbprpgaia2nannannannannannannannannannannannan--nannan1841.431612.40.1006190.0172583--nan----nan0.02274740.0117692panstarrsnannannannannannannannannannan1032.032192.77bj2018nannan--21.00820.11712819.63490.0773340--gaia2----23.69689038189320.5150830759397290.46063355450538.33043306328230.6632919840107970.683015262352577105.1973452543848815
122451116290.4584967152338.33068497829718.65012-24.038418.0347STARtmgaia220190415------19215005+38195051237668681001865024J192150.05+381950.12052812123437282560--3231494tmgaia23.033213.033hsoynannan--70.553799551826910.9807031882853302.66778906256659.4712359243081nannan20.23610.099130.050.021.17590.040733919.5010.015428218.31250.010429917.59370.016828516.240.10115.5020.12415.50.211ABC-222-111-000-0-0nan15.3090.03415.8260.10812.987nan9.346nan19.11340.0042960.0246gbprp--nannannannannannannannannannannannanDWARFnannannannannannan--nan----nannannan--nannannannannannannannannannannannan--nannan--20.35820.09887217.8520.0166580--gaia2----49.776823995442647.0131691137537290.45854419287938.33058147963920.3586182864002110.3961538443636931010.843322241046469
1877313284290.46345086818838.333894607665nannan20.1338STARgaia220190415--------1237668681001862738--2052812123443670144----gaia2nannan--nannan--70.558468728712810.9786191998283302.67688930071359.473258555749nannan21.57380.392925.3883.5087322.69530.2931721.21430.080494420.37580.06297720.54790.175296nannannannannannan--nannannannannannannannannan20.98360.0227960.1572gbprp--nannannannannannannannannannannannan--nannannannannannan--nan----nannannan--nannannannannannannannannannannannan--nannan--21.99990.5951420.20140.1680951--gaia2----1.799155363085681.98266655600732290.46345086818838.3338946076651.799155363085681.98266655600732-1-116.46494779932391
1877313237290.46577963043638.333369456095-5.74985-0.8327719.7778STARgaia220190415--------1237668681001862736--2052811921572733440----gaia21.538131.47151gaia20.02702280.849165gaia270.558810085682510.9767472865578302.68005292214359.4722538983176nannan20.82060.096230.050.023.53580.28885921.95360.10212720.41760.048509519.62740.0786104nannannannannannan--nannannannannannannannannan20.46950.0087170.0122reredgaia24745.0353.0nannannannannannannannannannanDWARFnannan2649.231783.950.1054960.0105728749--nan----nan0.01258590.00855985panstarrsnannannannannannannannannannan1320.972246.94bj2018nannandered21.04760.14030119.67970.1044861--gaia2----25.250389030526722.8191964347898290.46574807024138.33336587056170.7104659041113460.7017031320277081017.642262557602834
1877313233290.46005929664138.3239464856420.69567-6.7209319.2073STARgaia220190415--------1237668681001862442--2052811917278847104----gaia20.9305960.898581gaia20.5483710.511675gaia270.548179173142710.9766452416167302.66647960211659.4644192265324nannan20.21360.068826.03616.4666420.99670.035280719.79630.018759319.39350.02141930.050.0nannannannannannan--nannannannannannannannannan19.88070.0058770.0099reredgaia24779.0246.0nannannannannannannannannannanDWARFnannan2186.931596.620.08964770.008969205--nan----nan0.008778620.00915979panstarrsnannannannannannannannannannan1053.722139.53bj2018nannandered20.36770.09758919.03820.0485181--gaia2----15.275612989810813.9359218112201290.46006311458938.32391754830430.4008416587128680.4696589405201991020.608759910082256
1877313288290.46481255539638.3350609165607-2.07606-4.3313719.6691STARgaia220190415--------1237668681001862733--2052812127731164032----gaia21.21.11597gaia20.008328570.642526gaia270.560019318926710.9781711049033302.67952834747259.4740884238905nannan20.44480.053622.79960.50248923.83370.37838822.66540.19030622.19760.22128219.61880.0868425nannannannannannan--nannannannannannannannannan20.22050.0085810.0108gbprpgaia2nannannannannannannannannannannannan--nannan2784.961765.610.105660.0101418449--nan----nan0.01161670.00866699panstarrsnannannannannannannannannannan1305.112226.11bj2018nannan--20.47380.05216419.40110.0460160--gaia2----19.69963662205617.3070866361833290.46480115990138.33504226760740.5568048888861730.5749180429688031021.65251951894165
122451103290.46025640249538.3354503381626-7.71635-14.463517.8999STARtmgaia220190415------19215044+38200771237668681001862726--2052812123437286656--3231500tmgaia20.4591840.395206gaia20.2674640.239827gaia270.558778562882210.9815534458876302.67297088693759.475441429227nannan19.21780.051922.79660.34466720.16620.019729818.79870.01006718.24310.0099530317.86030.019737316.5590.12515.631nan15.55nanBUU-200-100-c00-0-0nannannannannannannannannan18.71290.0030060.0085reredgaia24299.0137.04.19359nannannan1.08461nan0.67nan0.525108nanDWARF0.3620055nan2848.511511.220.1057350.00982053--nan----nan0.01092630.00871476panstarrsnannannannannannannannannannan1049.761972.69bj2018nannandered19.49270.03793617.83510.0165821--gaia2----7.538565570503626.12930469396434290.46021404722738.33538806478390.228885184424530.2103836999492291022.111767965456053
1877313234290.47075295151738.3284015295922-3.25061-5.8587219.1856STARgaia220190415--------1237668681001865671--2052811917285285376----gaia21.020750.944207gaia20.7241410.555167gaia270.556006618200510.9710617190306302.68476136958559.4664076030791nannan20.61490.093130.050.021.56860.053509420.10430.022906919.36440.020372518.99340.0463009nannannannannannan--nannannannannannannannannan20.04090.0074750.0107reredgaia24096.0193.04.91751nannannan0.460646nan0.64nan6.54752nanDWARF0.05381086nan1955.321571.550.08859770.00949764--nan----nan0.008981280.010014panstarrsnannannannannannannannannannan982.842160.26bj2018nannandered20.80530.12597619.03270.0320351--gaia2----16.756701743761514.6437721287164290.47073511055638.32837630454890.4758964950760730.500733780865161024.99466042108615
1877313132290.45675055942538.3231172512084nannan20.8515STARgaia220190415------------2052811539328075136----gaia2nannan--nannan--70.546254407029910.9786140404958302.66113108037759.4643314025219nannannannannannannannannannannannannannannannannannannannan--nannannannannannannannannan21.28150.0306030.6goffs--nannannannannannannannannannannannan--nannannannannannan--nan----nannannan--nannannannannannannannannannannannan--nannan--nan0.0nan0.0-1--------3.044321837961344.611955940743290.45675055942538.32311725120843.044321837961344.611955940743-1-127.24536859073852
.......................................................................................................................................................................................................................................................................................................................................................................................
1877319614290.67453275741138.4399754631347-2.3685-5.9692918.754STARgaia220190415--------1237672005296982778--2052836725017523328----gaia20.7503590.944905gaia21.158020.470795gaia270.729582892977610.876629178994303.04783714983859.5296783572259nannan20.92330.132625.13154.353122.1620.097574720.49730.034254819.08220.016737918.31790.0260112nannannannannannan--nannannannannannannannannan19.83950.0049870.0105reredgaia23610.0154.04.89861nannannan0.420256nan0.51nan6.87114nanDWARF0.0270240847nan1093.041093.040.07194750.01776365--nan----nan0.01869420.0168331panstarrsnannannannannannannannannannan465.971776.1bj2018nannandered21.08810.14325418.62670.0201581--gaia2----12.32167614656114.6537280294955290.67451973783938.43994976202560.3339429036940820.47499855964452310719.6874218032051
1877317595290.32045430454538.49581185620428.032613.3871520.52STARgaia220190415------------2052828689126928256----gaia23.069012.2946gaia20.5463541.49501gaia270.656804561616211.1502524131301302.55159160505759.6596546528924nannannannannannannannannannannannannannannannannannannannan--nannannannannannannannannan20.950.0134050.6goffsgaia2nannannannannannannannannannannannan--nannan2345.81762.230.1208430.01094166--nan----nan0.01285340.00902992panstarrsnannannannannannannannannannan1311.552212.92bj2018nannan--nan0.0nan0.0-1--------50.399428132015335.5869611966175290.32049849375538.49582643977441.099984937791431.21248155431815-1-1719.763031675889
1877255867290.69064932459938.24131544260165.1443-2.8186419.7398STARgaia220190415--------1237668681001992562--2052620499181217536----gaia21.496791.71446gaia2-0.6016180.878141gaia270.553687390995410.7777448206853302.96380923518559.3352573523546nannan20.56330.073322.57050.33669520.81450.041226220.24640.033646219.94030.035737119.73270.0995314nannannannannannan--nannannannannannannannannan20.31710.0088860.0108gbprpgaia2nannannannannannannannannannannannan--nannan3017.741894.540.07907970.00794531--nan----nan0.008939630.00695099panstarrsnannannannannannannannannannan1433.152355.93bj2018nannan--20.43050.09864419.30120.1018210--gaia2----24.564329994497726.5892894344107290.69067752521838.24130330679380.6679173285701580.8977345765677510719.8145223244367
1877319610290.68017536784238.4330661994198-4.28144-2.4105518.821STARgaia220190415--------1237672005296983420--2052836725011084672----gaia20.632080.73089gaia2-0.2337790.36305gaia270.7252478940110.8696185159168303.0524381635559.5218152707511nannan19.69060.078722.19680.2945220.0670.019288419.3530.014728119.08630.016718218.93950.0417332nannannannannannan--nannannannannannannannannan19.42520.0041160.0081reredgaia25103.0388.04.79031nannannan0.618198nan0.86nan3.64013nanDWARF0.233480945nan3707.911880.630.08646420.006040835--nan----nan0.006495410.00558626panstarrsnannannannannannannannannannan1444.412316.85bj2018nannandered19.88680.14244418.71020.0584461--gaia2----10.379151303535611.3353854783329290.6801518351538.43305582066510.2803514740505840.38648129369490110719.8373023083551
1877312348290.70131493943838.26085029267951.71342-2.2008519.2002STARgaia220190415--------1237668681001996362--2052808554324628864----gaia20.8715441.13265gaia20.09098010.540606gaia270.575294974584410.7788422265921302.99016189137159.3517258661638nannan20.62250.115730.050.021.51940.050716220.06350.022409119.46870.021764418.99680.0489906nannannannannannan--nannannannannannannannannan20.05190.0060630.0093reredgaia24087.0221.04.59271nannannan0.669525nan0.64nan2.13246nanDWARF0.112679869nan2871.351825.780.07870780.00766278--nan----nan0.008844860.0064807panstarrsnannannannannannannannannannan1331.052320.5bj2018nannandered20.89810.16673219.1310.0394771--gaia2----14.304788878569917.5662787448409290.70132433478738.26084081679790.4189055477448450.59864809013529710719.8438090671667
1877317199290.43769890695538.5285115536941-3.94429-8.4247717.9681STARgaia220190415------------2052827207372833536----gaia20.2651130.268678gaia20.243110.157253gaia270.727677261466111.0820654194778302.74401639512259.6659411014337nannan18.75010.0469nannannannannannannannannannannannannannannannan--nannannannannannannannannan18.5250.002040.0083reredgaia25410.0141.04.72071nannannan0.700236nan0.94nan2.73775nanDWARF0.378418863nan3135.971375.850.1003940.008626605--nan----nan0.01116260.00609061panstarrsnannannannannannannannannannan980.911770.8bj2018nannandered18.96870.02214717.89390.0132361--gaia2----4.354726030685754.16719445061939290.43767719866538.52847528038440.1229669656187770.14958067452727910719.8442858333631
1877318737290.71098897332238.3726444555553-6.09969-5.3348918.7186STARgaia220190415--------1237672005296981714--2052833323396903936----gaia20.5713320.655261gaia20.1699790.349997gaia270.680852520716110.8213202909548303.06518838253959.4570697363525nannan19.69340.054424.40592.1572120.32550.022946719.32410.01468918.89840.015080418.68950.0345477nannannannannannan--nannannannannannannannannan19.37530.0036310.0082reredgaia24757.0173.04.7803nannannan0.587886nan0.76nan3.74054nanDWARF0.159445867nan2983.241720.790.05676180.007484475--nan----nan0.007111930.00785702panstarrsnannannannannannannannannannan1237.592203.98bj2018nannandered19.89110.04916918.59350.0406491--gaia2----9.3800854697729410.1627497079745290.71095547473638.37262148589460.2600164296245370.35505652136725510719.91209109786
122375841290.29404468864238.1791346652085-5.54057-10.23316.4301STARtmgaia220190415------19211057+38104481237672004760046022J192110.57+381044.72052803533502968448--2984866tmgaia20.1340570.142674gaia21.176760.0755498gaia270.357372810462811.030370430656302.34248548354359.360560845599619.3370.07517.71290.047621.15310.13486118.50510.0075723917.21570.0049072816.69140.0045676116.3880.0087624415.2870.04814.5540.05514.4470.09AAA-222-111-000-0-0nan14.3480.0314.3580.04512.183nan9.434nan17.22830.0011580.0077reredgaia24342.0126.04.70483nannannan0.606556nan0.68nan3.04716nanDWARF0.117813841nan833.65754.04350.1012330.008881215--nan----nan0.01336640.00439603panstarrsnannannannannannannannannannan50.61557.472bj2018nannandered17.96220.02099416.33990.0074821--gaia2bpbj--2.199626086514252.21265088283893290.29401434164238.17909060646260.06032560568332470.072980103582337310719.9564429288008
122304912290.2070729786538.3312949679405-1.49676-0.57778716.5435STARtmgaia220190415------19204970+38195281237668681001796625J192049.67+381952.52052821267427655936--3230590tmgaia20.139890.141261gaia20.2431840.0721069gaia270.466410338898911.1583081770647302.29422393159759.525530575482718.0270.09417.29230.04619.23590.02539517.66540.005283717.03870.0047876816.80650.0051301716.67610.0094481815.8380.06915.4540.11415.4710.196ABC-222-111-000-0-0nan15.4740.04215.6180.09812.582nan8.733nan17.08160.0013640.0078reredgaia25478.0126.04.10346nannannan1.44025nan0.96nan0.321332nanDWARF1.68290937nan3462.37908.5950.08966340.007645795--nan----nan0.009244380.00604721panstarrsnannannannannannannannannannan711.461105.73bj2018nannandered17.52240.00892516.4860.005381--gaia2bpbj--2.296353571377932.19060786987543290.2070647633638.33129248024670.06154889728275350.068215416072191910719.9652228173765
1877310317290.44649675714738.129843849126nannan20.6153STARgaia220190415--------1237672004760111473--2052800750370159616----gaia2nannan--nannan--70.36577988462710.901015643259302.54241797905159.280587519731nannannannan30.050.023.48980.31008921.4650.079988720.2520.039362719.68790.0946505nannannannannannan--nannannannannannannannannan21.04530.0207840.6goffs--nannannannannannannannannannannannan--nannannannannannan--nan----nannannan--nannannannannannannannannannannannan--nannan--nan0.0nan0.0-1--------1.761448915215123.97435701866458290.44649675714738.1298438491261.761448915215123.97435701866458-1-1719.9682218284545


Let’s isolate the RA and Dec columns into a separate table for creating a plot. We will can also filter our results to include only sources brigther than 15 magnitudes in B, which will give us a more managable amount of sources for plotting:

radec = (catalogData['ra','dec','Bmag'])
mask = radec['Bmag'] < 15.0
mag_radec = radec[mask]
print(mag_radec)
       ra              dec         Bmag 
---------------- ---------------- ------
290.458960889796 38.3207432262466 14.795
      290.460477        38.341217  12.29
290.461502454307 38.3419735004403 12.282
290.432230727723 38.3148097580226 10.681
290.494195116716 38.2920041448032 13.699
290.496059793679 38.2919210910981 14.087
290.443098867166 38.2822568081951 14.969
290.521274498376 38.3494190597979 14.955
290.504480006636  38.285889095025 14.606
290.532642166954 38.3355127573579 14.949
             ...              ...    ...
290.639097732469 38.4553582786213 14.398
290.278293543156  38.208641997725 14.841
290.522060193556 38.5159651830843 13.833
290.551537246867 38.5090628454079 10.836
290.481412465678 38.1368775068458 14.623
290.480069981463 38.1366995602234 14.908
290.526845626658 38.1428874761665 13.564
 290.44065267106 38.5235618801004 13.479
290.354450995223 38.5073622260303 12.796
 290.47123419526 38.5285590704884 13.923
Length = 99 rows


We can plot this table to get an idea of what the catalog looks like visually:

fig = plt.figure(figsize=(8,8))
ax = fig.add_subplot(111)
plt.scatter(mag_radec['ra'], mag_radec['dec'], facecolors='none', edgecolors='k', linewidths=0.5)
<matplotlib.collections.PathCollection at 0x7f7dcdf854d0>
../../../_images/6456277ce5622450039c133006407a58cb38adfbf66a48688c0df00c31d6d78b.png

Top of Page


Overplotting Objects#

Now that we have a way to display an FFI file and a catalog of objects, we can put the two pieces of data on the same plot. To do this, we will project the World Coordinate System (WCS) as a grid in units of degrees, minutes, and seconds onto the image. Then, we will create a scatter plot of the catalog, similar to the one above, although here we will transform its coordinate values into ICRS (International Celestial Reference System) to be compatible with the WCS projection:

hdu = fits.open(filename)[1]
wcs = WCS(hdu.header)

fig = plt.figure(figsize=(20,10))
ax = plt.subplot(projection=wcs) 
im = ax.imshow(hdu.data, cmap=plt.cm.gray, origin='lower', clim=(0,20000))
fig.colorbar(im)

plt.title('FFI with TIC Catalog Objects')
ax.set_xlabel('RA [deg]')
ax.set_ylabel('Dec [deg]')
ax.grid(color='white', ls='solid')
ax.autoscale(False)

ax.scatter(mag_radec['ra'], mag_radec['dec'],
           facecolors='none', edgecolors='c', linewidths=0.5,
           transform=ax.get_transform('icrs')) # This is needed when projecting onto axes with WCS info
WARNING: FITSFixedWarning: 'datfix' made the change 'Set MJD-OBS to 55001.173492 from DATE-OBS.
Set MJD-END to 55001.193926 from DATE-END'. [astropy.wcs.wcs]
<matplotlib.collections.PathCollection at 0x7f7d94dfd4d0>
../../../_images/de3567db44e06ba5f4423f6eee897e391214254a30dda1ed2b06371fb65fe895.png

The catalog is displayed here as blue circles that highlight certain objects common in both the Kepler FFI and the TIC search. The image remains in x, y pixel values while the grid is projected in degrees based on the WCS. The projection works off of WCS data in the FFI header to create an accurate grid displaying RA and Dec coordinates that correspond to the original pixel values. The catalog data is transformed into ICRS coordinates in order to work compatibly with the other plotted data.

Top of Page


Aditional Resources#

For more information about the MAST archive and details about mission data:

MAST API
Kepler Archive Page (MAST)
Kepler Archive Manual
Exo.MAST website
TESS Archive Page (MAST)


About this Notebook#

Author: Josie Bunnell, STScI SASP Intern
Updated On: 08/13/2018


Top of Page STScI logo