This notebook tutorial demonstrates how to load and display a TESS full frame image (FFI). We will display the image with the world coordinate system (WCS) overlayed on top.
%matplotlib inline from astropy.io import fits from astropy.wcs import WCS import matplotlib.pyplot as plt import numpy as np
TESS periodically reads out the entire frame of all four cameras, nominally every 30 minutes, and stores them as full frame images. Each camera covers ~24x24 degrees on the sky. These images can be used to construct light curves at 30-minute cadence for any object within the camera's field of view, in contrast to the subset of targets chosen by the mission to be read-out at shorter cadence (nominally two minutes) that receive mission-produced light curves.
This tutorial will refer to a couple TESS-related terms that we define here.
We will read the full frame image from Sector 1 using the MAST URL location. So that we can get started with understanding the file contents without reviewing how to automatically search for and retrieve TESS files, we won't show how to search and retrieve TESS FFIs in this tutorial. Consult other TESS tutorials in the TESS Archive Handbook for much more information on how to search for TESS data using MAST services.
# For the purposes of this tutorial, we just know the MAST URL location of the file we want to examine. fits_file = "https://archive.stsci.edu/missions/tess/ffi/s0001/2018/206/4-2/tess2018206192942-s0001-4-2-0120-s_ffic.fits"
TESS FFI FITS files contain a primary HDU with metadata stored in the header. The first extension HDU contains more metadata in the header, and stores the full frame image. The second extension HDU contains the uncertainty values for the image. Let's examine the structure of the FITS file using the astropy.fits
info function, which shows the FITS file format in more detail.
Filename: /root/.astropy/cache/download/py3/a2387fb351da2473071afffde7bf341c No. Name Ver Type Cards Dimensions Format 0 PRIMARY 1 PrimaryHDU 29 () 1 CAMERA.CCD 4.2 cal 1 ImageHDU 183 (2136, 2078) float32 2 CAMERA.CCD 4.2 uncert 1 ImageHDU 183 (2136, 2078) float32
Now that we have the file, let's store the world coordinate system information for use later. We can use the astropy.wcs
WCS function to store the information from the image extension HDU's header.
The following command opens the file, extracts the WCS and Image data and then closes the file. Note this file is quite large and may take a few moments to dowload.
with fits.open(fits_file, mode = "readonly") as hdulist: wcs_info = WCS(hdulist.header) cal_image = hdulist.data header = hdulist.header
# Use the header to determine the mid-point of the exposure time for this FFI. mid_time = (header['TSTOP'] + header['TSTART']) / 2
We show the 2048x2048 image, adjusting the scale so that we can see more of the stars. We also imprint the WCS on top of the image.
plt.figure(figsize = (12,12)) plt.subplot(111, projection = wcs_info) plt.imshow(cal_image, vmin = np.percentile(cal_image,4),vmax = np.percentile(cal_image, 98),origin = "lower") plt.xlabel('RA') plt.ylabel('Dec') plt.title("TESS Calibrated FFI for Sector 1, Camera 4, CCD 2, Timestamp %f BTJD" % mid_time) cal_image.shape