FluxCT: A Web Tool for Identifying Contaminating Flux in Kepler and TESS Target Pixel Files

We announce FluxCT, a web tool for identifying contaminating flux in Kepler and TESS target pixel files due to secondary visual sources. We demonstrate the usage of this tool and discuss the benefits of this tool over a simple Gaia radius search. FluxCT focuses on clarity and simplicity, where the only input needed from the user is a KIC or TIC ID. By more appropriately accounting for the actual shape of the photometric pixel apertures, FluxCT can produce much more accurate estimates of contaminating flux than simple radial cone searches.


INTRODUCTION
Contaminating flux from unexpected sources is a known issue in both Kepler (Borucki et al. 2010) and TESS (Ricker et al. 2015) light curves. Excess flux occurs due to a combination of pixel size (4. and 21. , respectively) and flux integration -taking the sum of observed flux in all pixels comprising the Target's Pixel Aperture (TPA) to ensure collection of all light from the target. Data for each source is collected in Target Pixel Files (TPFs) and overlaid with a TPA. TPAs vary in size and shape for each source and are approximately 20. (∼5 pixels) in the x direction and 40. (∼10 pixels) in the y direction 1 . Subsequently, a light curve is created by plotting the integrated flux measurements.
Measurements determined using light curves containing excess flux may result in inaccurate conclusions. Some documented examples include false-positive planet transit signals caused by eclipsing binaries (Ziegler et al. 2016), the underestimation of planet radii (Ziegler et al. 2018), the possible dilution of stellar oscillations (Schonhut-Stasik et al. 2017, 2020, and observed stellar flares attributed to an incorrect source at a rate of 6.7±0.4% for Kepler short cadence data (Jackman et al. 2021).

WEB TOOL
Using the FluxCT web tool requires only an internet connection and browser access. We built FluxCT by combining Python scripts into a Python Anywhere 2 framework, allowing it to run through a website. The user navigates to the site and enters the KIC or TIC ID they wish to search; FluxCT then produces the plots and data to the user's browser.
Once provided an ID number, FluxCT pulls the source's TPF and TPA using the Python module lightkurve (Lightkurve Collaboration et al. 2018). Then, using the TPA, FluxCT creates a unique search polygon containing the TPA, with as few surrounding pixels as possible. Next, the script searches this area using astroquery FluxCT finds potential contaminating sources using Gaia, outputting results and a plot; Figure 1 shows an example plot. Returned data include all source magnitudes, the magnitude differences between each accompanying source and the target, the ratio of flux between each accompanying source and the target, and the total percentage of flux in Figure 1. Returned plot for KIC 11860814. The pink star shows the target source in RA (hour angle) and Dec (degrees); grey dotted lines represent on-sky coordinates. Each colored square depicts a pixel. Grey pixels constitute areas without data, dark purple represents pixels not included in the TPA, and Lighter shades of purple through white correspond to the source's TPA, scaled toward white as flux values increase. White lines around the TPA show the smallest possible polygon, with RA and Dec values in each corner. KIC 11860814 has one additional source within the TPA, with a target magnitude of 11.16 and 13.50 for the accompanying source, giving a magnitude difference of ∼2. There is a flux ratio (F2/F1) of ∼0.1, resulting in a total flux contamination of 10%. The secondary source has a RUWE of 1.7, suggesting an unresolved double system. the system due to contaminants. For flux, we use Gaia G-band values as the closest approximation to the Kepler passband. FluxCT also returns the Renormalized Unit Weight Error (RUWE); often used as a marker for close binarity (Lindegren et al. 2018;Stassun & Torres 2021). The use of RUWE supports completeness, as Gaia can only resolve stars down to 1. (Ziegler et al. 2018).

USE BENEFITS
When searching for contaminating sources, it is crucial to consider the shape and size of the search area. For both Kepler and TESS, the TPA encapsulates many pixels, not just the pixel with the target source. Furthermore, the target source may not fall in a pixel central to the TPA, which is usually asymmetric. Therefore, simple radial searches can prove inadequate for finding the correct amount of contaminating flux.
In the case of Kepler, standard practice is to check for contaminating sources using a 4. radial search. The dominant issue is that small radial searches miss possible contaminants. We tested this using a sample of 147 Kepler stars with observed oscillations currently undergoing analysis to consider dilution of their oscillation amplitudes (Schonhut-Stasik in prep.). A 4. Gaia radial cone search found 23 contaminant sources in this sample. In contrast, FluxCT found 107 stars within its unique search polygons, representing a much more complete estimate of the true contaminating flux.
Sometimes, in an attempt to find all possible contaminating sources, a much larger radial search is used. This more considerable size risks exceeding TPA boundaries and can return many outside stars that would not contribute excess flux. For example, we performed a Gaia radial search of 20. , where we found 671 sources within 20. of our 147 sources, meaning the cone search found 564 stars not identified in the above FluxCT determination-a vast overestimate. These extensive radial searches can be even more problematic for targets that fall closer to the Galactic Plane or in areas of high stellar density.
To be sure, FluxCT is not perfect and will slightly overestimate the number of contaminating sources when the FluxCT rectangular polygon is somewhat larger than the complex TPA. For the test sample, a manual investigation found seven stars within the FluxCT polygon, but outside the true TPA, an overestimate of 6.5%.

ACCESSIBILITY
FluxCT is currently available as a web tool that allows the search of single targets (http://jstasik.pythonanywhere. com). Creating an accessible web tool is motivated by the desire to encourage broader access to space telescope data for students. The ease of use allows students as early as high school to explore the data without needing advanced knowledge of Python. A full version that can search multiple sources is available at the GitHub https: //github.com/Jesstella/FluxCT. The corresponding author welcomes any suggestions for updates. More example plots and supplemental material exist at https://www.jessicastasik.com/flux-contamination-tool. A frozen version of the code is available on Zenodo Schonhut-Stasik & Stassun (2023).