<jupyter_start><jupyter_text><jupyter_code>#!pip install git+https://github.com/jpdeleon/chronos.git@master<jupyter_output><empty_output><jupyter_text>TESS lightcurves<jupyter_code>%matplotlib inline
import numpy as np
import matplotlib.pyplot as pl
pl.style.use("default")

import chronos as cr<jupyter_output>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<jupyter_text>long (30-minute) cadence<jupyter_code>#initialize LongCadence class
l = cr.LongCadence(toiid=200, sap_mask='square', aper_radius=2)<jupyter_output>Target: TOI 200
Available sectors: [1]
Using sector=1.
Using TESS long cadence.<jupyter_text>custom<jupyter_code>#make custom lightcurve
lc = l.make_custom_lc()
lc.plot();
# show aperture mask
pl.matshow(l.aper_mask)
#show tpf with aperture mask
img = np.median(l.tpf_tesscut.flux, axis=0)
cr.plot_aperture_outline(img, mask=l.aper_mask)<jupyter_output><empty_output><jupyter_text>varying apertures<jupyter_code>fig = l.plot_lc_per_aperture()<jupyter_output>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<jupyter_text>CDIPS method* See also lightcurves-tess-cdips.ipynb<jupyter_code>#get CDIPS lightcurve using a method that calls CDIPS class
l = cr.LongCadence(toiid=837)
lc = l.get_cdips_lc() 
lc.plot();
#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})')<jupyter_output>There are 2 gaia sources within 3.0 arcsec.
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.
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.
There are 2 TIC stars within 3.0 arcsec
Gaia and TIC catalog cross-match succeeded.
Found 2 CDIPS lightcurves.<jupyter_text>PATHOS method* See also lightcurves-tess-pathos.ipynb<jupyter_code>#get CDIPS lightcurve using a method that calls CDIPS class
l = cr.LongCadence(toiid=837)
lc = l.get_pathos_lc() 
lc.plot();
#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})')<jupyter_output>There are 2 gaia sources within 3.0 arcsec.
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.
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.
There are 2 TIC stars within 3.0 arcsec
Gaia and TIC catalog cross-match succeeded.
Found 2 PATHOS lightcurves.<jupyter_text>pixel lightcurves<jupyter_code>import eleanor

target = eleanor.Source(tic=star.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];<jupyter_output><empty_output><jupyter_text>short cadence<jupyter_code>import chronos as cr

s = cr.ShortCadence(toiid=837)<jupyter_output>Target: TOI 837
Available sectors: [10 11]
Using sector=10.
Using TESS short cadence.<jupyter_text>custom<jupyter_code>#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})')
fig = s.plot_lc_per_aperture()<jupyter_output>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<jupyter_text>pipeline lc: SAP and PDCSAP<jupyter_code>#get pipeline lc
pdcsap = s.get_lc(lctype='pdcsap')
ax = pdcsap.plot(label='pdcsap')

sap = s.get_lc(lctype='sap')
sap.plot(ax=ax, label='sap')
ax.set_title(f'{s.target_name} (sector {pdcsap.sector})')
#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<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10621714700018126, 'fraction_numerical': 0.028094979155338047, 'mean_word_length': 6.092544987146529, 'pattern_counts': {'":': 0, '<': 38, '<?xml version=': 0, '>': 39, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '11', 'dir': 'jupyter-structured-clean-dedup', 'id': '625746', 'license': 'MIT', 'n_tokens_mistral': 2186, 'n_tokens_neox': 2038, 'n_words': 544, 'path': 'notebooks/examples-lightcurves-tess.ipynb', 'repo_name': 'LanzLagman/chronos', 'size': '5517'}