<jupyter_start><jupyter_text>Example: Centroid Vetting. How to look for centroid offset between in and out of transitIn this example we show how to use the vetting module to visualize the transit and take the difference between the in transit and out of transit to determine if there is a centroid offset between the two.<jupyter_code>import numpy
import matplotlib
import exovetter as exo
from exovetter import const
from exovetter import utils
import exovetter.vetters as vet
import lightkurve as lk
import astropy.units as u
#Name of our first TOI Example
candidate = "TOI 1013.01"<jupyter_output><empty_output><jupyter_text>Use a utility function get_mast_tce to get the properties of the candidate and put into a tce.<jupyter_code>tce = utils.get_mast_tce(candidate)
tce<jupyter_output><empty_output><jupyter_text>Grab the light curve using lightkurve<jupyter_code>lc = lk.search_lightcurve(candidate, sector=33, exptime=120).download()
lc.plot()
#Visualize the transits
#Initiate the vetter
viz = vet.VizTransits()

#Run the vetter on the tce and lightcurve of your choice.
viz.run(tce[0], lc, plot=True)<jupyter_output>[131. 132. 133. 134. 135.]
6
[130. 130. 130. ... 135. 135. 135.]<jupyter_text>Run the Centroid VetterThe Centroid Vetter is run in the same way. It returns the average offset and significance that it is on the target.You get several plots showing the out of transits, in transit and difference image. The centroids of each are measured using a Gaussian.For the OOT and In-Transit, the centroid is constrained to the central +/-1pixel in box row and column direction.As input, the Centroid Vetter requires a Target Pixel File objects from lightkurve.This example shows no significant offset between the out of transit location and the difference image centroid.<jupyter_code>tpf = lk.search_targetpixelfile(candidate, sector=33, exptime=120).download()
cent = vet.Centroid()
cent.run(tce[0],tpf, plot=True)<jupyter_output><empty_output><jupyter_text>Example 2. An example with a small put possible offset.Here we will do the same thing on TOI 565.01<jupyter_code>candidate = "TOI 565.01"
tce = utils.get_mast_tce(candidate)
tce
lc = lk.search_lightcurve(candidate)[0].download()
lc.plot()
viz = vet.VizTransits(max_transits=8)
viz.run(tce[0],lc, plot=True, )
#Examine difference images and measure centroids
tpf = lk.search_targetpixelfile(candidate)[0].download()
cent = vet.Centroid()
cent.run(tce[0],tpf,plot=True)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.08050161812297735, 'fraction_numerical': 0.027912621359223302, 'mean_word_length': 5.907821229050279, 'pattern_counts': {'":': 0, '<': 20, '<?xml version=': 0, '>': 20, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '517556', 'license': 'MIT', 'n_tokens_mistral': 866, 'n_tokens_neox': 796, 'n_words': 288, 'path': 'example_notebooks/Centorid_Vetting_Example.ipynb', 'repo_name': 'spacetelescope/exovetter', 'size': '2472'}