#!pip install git+https://github.com/jpdeleon/chronos.git@master
%matplotlib inline
import numpy as np
import matplotlib.pyplot as pl
import chronos as cr
Created TAP+ (v1.2.1) - Connection: Host: gea.esac.esa.int Use HTTPS: True Port: 443 SSL Port: 443 Created TAP+ (v1.2.1) - Connection: Host: geadata.esac.esa.int Use HTTPS: True Port: 443 SSL Port: 443
#initialize LongCadence class
l = cr.LongCadence(toiid=200, sap_mask='square', aper_radius=2)
Target: TOI 200 Available sectors: [ 1 27 28] Using sector=1. Using lightcurve with custom aperture. Searching targetpixelfile for ra,dec=(354.915 -69.196) using Tesscut Removing scattered light + applying PLD Querying Gaia DR2 catalog for ra,dec=(354.915 -69.196) within 120.0 arcsec. Using TESS long cadence.
#make custom lightcurve
lc = l.make_custom_lc()
lc.plot();
Using lightcurve with custom aperture. Removing scattered light + applying PLD
# show aperture mask
pl.matshow(l.aper_mask)
<matplotlib.image.AxesImage at 0x7f6aeec5c410>
#show tpf with aperture mask
img = np.median(l.tpf_tesscut.flux, axis=0)
cr.plot_aperture_outline(img, mask=l.aper_mask)
<matplotlib.axes._subplots.AxesSubplot at 0x7f6aeec51e10>
fig = l.plot_lc_per_aperture()
Using lightcurve with custom aperture. Removing scattered light + applying PLD mask=round; contratio=0.37 Using lightcurve with custom aperture. Removing scattered light + applying PLD mask=square; contratio=0.37 Using lightcurve with custom aperture. Removing scattered light + applying PLD mask=percentile; contratio=0.37 Using lightcurve with custom aperture. Removing scattered light + applying PLD mask=threshold; contratio=0.37
#get CDIPS lightcurve using a method that calls CDIPS class
l = cr.LongCadence(toiid=837)
lc = l.get_cdips_lc()
lc.plot();
Target: TOI 837 Available sectors: [10 11] Using sector=10. Using lightcurve with custom aperture. Searching targetpixelfile for ra,dec=(157.037 -64.5052) using Tesscut Brightest star detected is far from the center. Aperture mask is placed at the center instead. Removing scattered light + applying PLD Querying Gaia DR2 catalog for ra,dec=(157.037 -64.5052) within 120.0 arcsec. Using TESS long cadence. Querying Gaia DR2 catalog for ra,dec=(157.037 -64.5052) within 3.0 arcsec. There are 2 gaia sources within 3.0 arcsec. High proper-motion star: (pmra,pmdec)=(-18.02,11.31) mas/yr There are 2 gaia sources within 3.0 arcsec. High proper-motion star: (pmra,pmdec)=(-18.02,11.31) mas/yr There are 2 TIC stars within 3.0 arcsec Gaia and TIC catalog cross-match succeeded. Found 2 CDIPS lightcurves.
#vary aperture using index 1,2,3
cdips_lcs = {}
fig, ax = pl.subplots(1,1, figsize=(10,6))
for aper in [1,2,3]:
lc = l.get_cdips_lc(sector=10, aper_idx=aper, verbose=False)
lc.plot(ax=ax, label=f'aper={aper}')
cdips_lcs[aper] = lc
ax.set_title(f'TIC {l.ticid} (sector {lc.sector})')
There are 2 gaia sources within 3.0 arcsec. High proper-motion star: (pmra,pmdec)=(-18.02,11.31) mas/yr There are 2 TIC stars within 3.0 arcsec Gaia and TIC catalog cross-match succeeded. Found 2 CDIPS lightcurves. There are 2 gaia sources within 3.0 arcsec. High proper-motion star: (pmra,pmdec)=(-18.02,11.31) mas/yr There are 2 TIC stars within 3.0 arcsec Gaia and TIC catalog cross-match succeeded. Found 2 CDIPS lightcurves. There are 2 gaia sources within 3.0 arcsec. High proper-motion star: (pmra,pmdec)=(-18.02,11.31) mas/yr There are 2 TIC stars within 3.0 arcsec Gaia and TIC catalog cross-match succeeded. Found 2 CDIPS lightcurves.
Text(0.5, 1.0, 'TIC 460205581 (sector 10)')
#get CDIPS lightcurve using a method that calls CDIPS class
l = cr.LongCadence(toiid=837)
lc = l.get_pathos_lc()
lc.plot();
Target: TOI 837 Available sectors: [10 11] Using sector=10. Using lightcurve with custom aperture. Searching targetpixelfile for ra,dec=(157.037 -64.5052) using Tesscut Brightest star detected is far from the center. Aperture mask is placed at the center instead. Removing scattered light + applying PLD Querying Gaia DR2 catalog for ra,dec=(157.037 -64.5052) within 120.0 arcsec. Using TESS long cadence. Querying Gaia DR2 catalog for ra,dec=(157.037 -64.5052) within 3.0 arcsec. There are 2 gaia sources within 3.0 arcsec. High proper-motion star: (pmra,pmdec)=(-18.02,11.31) mas/yr There are 2 gaia sources within 3.0 arcsec. High proper-motion star: (pmra,pmdec)=(-18.02,11.31) mas/yr There are 2 TIC stars within 3.0 arcsec Gaia and TIC catalog cross-match succeeded. Found 2 PATHOS lightcurves.
#vary aperture using index 1,2,3
pathos_lcs = {}
fig, ax = pl.subplots(1,1, figsize=(10,6))
for aper in [1,2,3]:
lc = l.get_pathos_lc(aper_idx=aper)
lc.plot(ax=ax, label=f'aper={aper}')
pathos_lcs[aper] = lc
ax.set_title(f'TIC {l.ticid} (sector {lc.sector})')
There are 2 gaia sources within 3.0 arcsec. High proper-motion star: (pmra,pmdec)=(-18.02,11.31) mas/yr There are 2 TIC stars within 3.0 arcsec Gaia and TIC catalog cross-match succeeded. Found 2 PATHOS lightcurves. There are 2 gaia sources within 3.0 arcsec. High proper-motion star: (pmra,pmdec)=(-18.02,11.31) mas/yr There are 2 TIC stars within 3.0 arcsec Gaia and TIC catalog cross-match succeeded. Found 2 PATHOS lightcurves. There are 2 gaia sources within 3.0 arcsec. High proper-motion star: (pmra,pmdec)=(-18.02,11.31) mas/yr There are 2 TIC stars within 3.0 arcsec Gaia and TIC catalog cross-match succeeded. Found 2 PATHOS lightcurves.
Text(0.5, 1.0, 'TIC 460205581 (sector 10)')
import eleanor
target = eleanor.Source(tic=l.ticid, sector='recent', tc=True)
data = eleanor.TargetData(target, height=5, width=5)
vis = eleanor.Visualize(data)
fig = vis.pixel_by_pixel(data_type="corrected", color_by_pixel=True)
[ax.set_ylim(0.99,1.01) for n,ax in enumerate(fig.axes) if n>1];
import chronos as cr
s = cr.ShortCadence(toiid=837)
Target: TOI 837 Available sectors: [10 11] Using sector=10. Searching lightcurvefile for TIC 460205581 (sector 10) Found 1 lightcurves Using TESS short cadence.
#make custom lc
custom_lc = s.make_custom_lc(sap_mask='pipeline')
ax = custom_lc.plot(label='custom')
ax.set_title(f'{s.target_name} (sector {s.sector})')
Using lightcurve with custom aperture. Searching mast for TIC 460205581 2 tpf(s) found in sector(s) [10, 11] Using data from sector 10 only Downloading TIC 460205581 ... Removing scattered light + applying PLD Querying TIC catalog for ra,dec=(157.037 -64.5052) within 3.0 arcsec. There are 2 TIC stars within 3.0 arcsec
Text(0.5, 1.0, 'TOI 837 (sector 10)')
fig = s.plot_lc_per_aperture()
Using lightcurve with custom aperture. Removing scattered light + applying PLD mask=pipeline; contratio=0.08 Using lightcurve with custom aperture. Brightest star is detected far from the center. Aperture mask is placed at the center instead. Removing scattered light + applying PLD mask=round; contratio=0.07 Using lightcurve with custom aperture. Brightest star detected is far from the center. Aperture mask is placed at the center instead. Removing scattered light + applying PLD mask=square; contratio=0.08 Using lightcurve with custom aperture. Removing scattered light + applying PLD mask=percentile; contratio=0.07 Using lightcurve with custom aperture. Removing scattered light + applying PLD mask=threshold; contratio=0.07
#get pipeline lc
pdcsap = s.lc_pdcsap
ax = pdcsap.plot(label='pdcsap')
sap = s.lc_sap
sap.plot(ax=ax, label='sap')
ax.set_title(f'{s.target_name} (sector {pdcsap.sector})')
Text(0.5, 1.0, 'TOI 837 (sector 10)')
#note that these two are identical
ax = s.lc_sap.bin(100).scatter(label='sap') #sap
s.tpf.to_lightcurve(aperture_mask='pipeline').remove_outliers().scatter(ax=ax, alpha=0.5) #also sap
<matplotlib.axes._subplots.AxesSubplot at 0x7f6ae6039a90>