tglc 0.6.3__tar.gz → 0.6.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- tglc-0.6.5/PKG-INFO +80 -0
- {tglc-0.6.3 → tglc-0.6.5}/setup.py +1 -1
- tglc-0.6.5/tglc/__init__.py +3 -0
- {tglc-0.6.3 → tglc-0.6.5}/tglc/ffi.py +1 -1
- {tglc-0.6.3 → tglc-0.6.5}/tglc/ffi_cut.py +1 -2
- {tglc-0.6.3 → tglc-0.6.5}/tglc/quick_lc.py +146 -102
- tglc-0.6.5/tglc.egg-info/PKG-INFO +80 -0
- tglc-0.6.3/PKG-INFO +0 -70
- tglc-0.6.3/tglc/__init__.py +0 -3
- tglc-0.6.3/tglc.egg-info/PKG-INFO +0 -70
- {tglc-0.6.3 → tglc-0.6.5}/LICENSE +0 -0
- {tglc-0.6.3 → tglc-0.6.5}/MANIFEST.in +0 -0
- {tglc-0.6.3 → tglc-0.6.5}/README.rst +0 -0
- {tglc-0.6.3 → tglc-0.6.5}/setup.cfg +0 -0
- {tglc-0.6.3 → tglc-0.6.5}/tglc/background_mask/__init__.py +0 -0
- {tglc-0.6.3 → tglc-0.6.5}/tglc/background_mask/median_mask.fits +0 -0
- {tglc-0.6.3 → tglc-0.6.5}/tglc/effective_psf.py +0 -0
- {tglc-0.6.3 → tglc-0.6.5}/tglc/lc_plot.py +0 -0
- {tglc-0.6.3 → tglc-0.6.5}/tglc/mast.py +0 -0
- {tglc-0.6.3 → tglc-0.6.5}/tglc/run.py +0 -0
- {tglc-0.6.3 → tglc-0.6.5}/tglc/source_output.py +0 -0
- {tglc-0.6.3 → tglc-0.6.5}/tglc/target_lightcurve.py +0 -0
- {tglc-0.6.3 → tglc-0.6.5}/tglc.egg-info/SOURCES.txt +0 -0
- {tglc-0.6.3 → tglc-0.6.5}/tglc.egg-info/dependency_links.txt +0 -0
- {tglc-0.6.3 → tglc-0.6.5}/tglc.egg-info/requires.txt +0 -0
- {tglc-0.6.3 → tglc-0.6.5}/tglc.egg-info/top_level.txt +0 -0
tglc-0.6.5/PKG-INFO
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: tglc
|
|
3
|
+
Version: 0.6.5
|
|
4
|
+
Summary: TESS-Gaia Light Curve
|
|
5
|
+
Home-page: https://github.com/TeHanHunter/TESS_Gaia_Light_Curve
|
|
6
|
+
Author: Te Han
|
|
7
|
+
Author-email: tehanhunter@gmail.com
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Requires-Python: >=3.8
|
|
12
|
+
Description-Content-Type: text/x-rst
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Requires-Dist: astropy>=5.1
|
|
15
|
+
Requires-Dist: astroquery
|
|
16
|
+
Requires-Dist: matplotlib
|
|
17
|
+
Requires-Dist: numpy
|
|
18
|
+
Requires-Dist: oauthlib
|
|
19
|
+
Requires-Dist: requests
|
|
20
|
+
Requires-Dist: scipy
|
|
21
|
+
Requires-Dist: threadpoolctl
|
|
22
|
+
Requires-Dist: tqdm
|
|
23
|
+
Requires-Dist: wheel
|
|
24
|
+
Requires-Dist: wotan
|
|
25
|
+
|
|
26
|
+
==================================
|
|
27
|
+
Introduction
|
|
28
|
+
==================================
|
|
29
|
+
|
|
30
|
+
TESS-Gaia Light Curve (`TGLC <https://archive.stsci.edu/hlsp/tglc>`_) is a dataset of TESS full-frame image light curves publicly available via the MAST portal. It is fitted with effective PSF and decontaminated with Gaia DR3 and achieved percent-level photometric precision down to 16th TESS magnitude! It unlocks astrophysics to a vast number of dim stars below 12th TESS magnitude. A package called tglc is pip-installable for customized light curve fits.
|
|
31
|
+
|
|
32
|
+
==================================
|
|
33
|
+
Usage
|
|
34
|
+
==================================
|
|
35
|
+
There are four fluxes in each FITS file: aperture flux, PSF flux, calibrated aperture flux, and calibrated PSF flux.
|
|
36
|
+
If you are uncertain which to use:
|
|
37
|
+
|
|
38
|
+
* Calibrated psf flux is better in **deblending** targets. Use this if you need to deblend a target near a variable source. The best deblending can be achieved with tglc package by setting a non-zero prior. It also gives the more accurate **transit depth** in most cases, especially when fitting with an optimized prior.
|
|
39
|
+
* Calibrated aperture flux usually has slightly **higher SNR**. The transit depth (or variation amplitude), however, can be imperfect since the normalization depends on the PSF fitting which is imperfect. This imperfection can be minimized by using a bigger aperture than the default aperture (3*3). One need to use the tglc package and set tglc_lc(save_aper=True) to access the 5*5 aperture. In the presence of a bright but "constant" contamination (several magnitudes brighter), the calibrated aperture flux is better in removing the constant contamination.
|
|
40
|
+
* The aperture flux and PSF flux are not detrended or normalized. Use this if you are doing stellar variability science with long baseline. Or, if the detrending is not optimal (default detrending has a window length of 1 day; see Known Problems below), start with the aperture flux or PSF flux and detrend carefully!
|
|
41
|
+
* **If you are uncertain, start with calibrated aperture flux!**
|
|
42
|
+
|
|
43
|
+
The `tutorial <tutorial/TGLC_tutorial.ipynb>`_ shows the syntaxes and differences among these light curves in several examples.
|
|
44
|
+
|
|
45
|
+
==================================
|
|
46
|
+
Data Access
|
|
47
|
+
==================================
|
|
48
|
+
There are three data access methods:
|
|
49
|
+
|
|
50
|
+
* MAST Portal: Easiest for acquiring light curves for a few stars. However, new sectors are updated relatively slowly.
|
|
51
|
+
* MAST bulk download: Best for downloading light curves for all stars (<16 TESS magnitude) in a sectors.
|
|
52
|
+
* tglc package: Capable of producing similar quality light curves for any sector and any star with custom options.
|
|
53
|
+
|
|
54
|
+
MAST Portal/bulk download
|
|
55
|
+
----------------------------
|
|
56
|
+
The easiest usage requires no package installation. Simply follow the `TGLC HLSP page <https://archive.stsci.edu/hlsp/tglc>`_ to download light curves from MAST or use `MAST Portal <https://mast.stsci.edu/portal/Mashup/Clients/Mast/Portal.html>`_. Light curves are being fitted sector by sector and will be available on MAST gradually. MAST hosts all Gaia DR3 stars down to 16th magnitude. Each .fits file includes PSF and aperture light curves and their calibrated versions.
|
|
57
|
+
|
|
58
|
+
MAST available sectors: `sector worklist <https://docs.google.com/spreadsheets/d/1FhHElWb1wmx9asWiZecAJ2umN0-P_aXn55OBVB34_rg/edit?usp=sharing>`_
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
tglc package
|
|
62
|
+
----------------------------
|
|
63
|
+
Users can also fit light curves using the package tglc. Using tglc, one can specify a region, sector(s), and customized aperture shape if needed. It can also allow all field stars to float by assigning Gaussian priors, which can help decontaminate variable field stars. tglc is currently only available for linux. Run::
|
|
64
|
+
|
|
65
|
+
pip install tglc
|
|
66
|
+
|
|
67
|
+
for the latest tglc release. After installation, follow the `tutorial <tutorial/TGLC_tutorial.ipynb>`_ to fit light curves. If there is a problem, please leave a comment in the Issues section to help us improve. Thank you!
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
==================================
|
|
71
|
+
Known Problems
|
|
72
|
+
==================================
|
|
73
|
+
There are several imperfections we noticed in the MAST TGLC light curves and tglc package:
|
|
74
|
+
|
|
75
|
+
* If the star is very dim (~< 15 Tmag) near a variable source, it can make the aperture and/or PSF light curve negative for some cadences. The detrending algorithm could malfunction and result in bad cal_aper_flux and/or cal_psf_flux. This is now fixed for tglc package, but this problem remains for the primary mission light curves published on MAST. Please detrend again if necessary. The extended mission light curves on MAST will not be affected. This is a very rare scenario, but could be important.
|
|
76
|
+
|
|
77
|
+
==================================
|
|
78
|
+
Reference
|
|
79
|
+
==================================
|
|
80
|
+
If you find the TGLC light curves or the tglc package useful in your research, please cite `our paper <https://iopscience.iop.org/article/10.3847/1538-3881/acaaa7>`_ published on the Astronomical Journal.
|
|
@@ -260,7 +260,7 @@ class Source(object):
|
|
|
260
260
|
attempt = 0
|
|
261
261
|
while attempt < 5:
|
|
262
262
|
try:
|
|
263
|
-
catalogdata = Gaia.cone_search_async(coord, radius,
|
|
263
|
+
catalogdata = Gaia.cone_search_async(coord, radius=radius,
|
|
264
264
|
columns=['DESIGNATION', 'phot_g_mean_mag', 'phot_bp_mean_mag',
|
|
265
265
|
'phot_rp_mean_mag', 'ra', 'dec', 'pmra', 'pmdec']).get_results()
|
|
266
266
|
return catalogdata
|
|
@@ -60,7 +60,7 @@ class Source_cut(object):
|
|
|
60
60
|
coord = SkyCoord(ra=ra, dec=dec, unit=(u.degree, u.degree), frame='icrs')
|
|
61
61
|
radius = u.Quantity((self.size + 6) * 21 * 0.707 / 3600, u.deg)
|
|
62
62
|
print(f'Target Gaia: {target[0]["designation"]}')
|
|
63
|
-
catalogdata = Gaia.cone_search_async(coord, radius,
|
|
63
|
+
catalogdata = Gaia.cone_search_async(coord, radius=radius,
|
|
64
64
|
columns=['DESIGNATION', 'phot_g_mean_mag', 'phot_bp_mean_mag',
|
|
65
65
|
'phot_rp_mean_mag', 'ra', 'dec', 'pmra', 'pmdec']).get_results()
|
|
66
66
|
print(f'Found {len(catalogdata)} Gaia DR3 objects.')
|
|
@@ -94,7 +94,6 @@ class Source_cut(object):
|
|
|
94
94
|
else:
|
|
95
95
|
self.select_sector(sector=sector)
|
|
96
96
|
|
|
97
|
-
|
|
98
97
|
def select_sector(self, sector=1):
|
|
99
98
|
"""
|
|
100
99
|
select sector to use if target is in multi-sectors
|
|
@@ -19,7 +19,8 @@ from astroquery.mast import Tesscut
|
|
|
19
19
|
# warnings.simplefilter('ignore', UserWarning)
|
|
20
20
|
from threadpoolctl import ThreadpoolController, threadpool_limits
|
|
21
21
|
import numpy as np
|
|
22
|
-
|
|
22
|
+
import seaborn as sns
|
|
23
|
+
import itertools
|
|
23
24
|
controller = ThreadpoolController()
|
|
24
25
|
|
|
25
26
|
|
|
@@ -30,20 +31,16 @@ def tglc_lc(target='TIC 264468702', local_directory='', size=90, save_aper=True,
|
|
|
30
31
|
Generate light curve for a single target.
|
|
31
32
|
|
|
32
33
|
:param target: target identifier
|
|
33
|
-
:
|
|
34
|
+
:kind target: str, required
|
|
34
35
|
:param local_directory: output directory
|
|
35
|
-
:
|
|
36
|
+
:kind local_directory: str, required
|
|
36
37
|
:param size: size of the FFI cut, default size is 90. Recommend large number for better quality. Cannot exceed 100.
|
|
37
|
-
:
|
|
38
|
+
:kind size: int, optional
|
|
38
39
|
'''
|
|
39
40
|
os.makedirs(local_directory + f'logs/', exist_ok=True)
|
|
40
41
|
os.makedirs(local_directory + f'lc/', exist_ok=True)
|
|
41
42
|
os.makedirs(local_directory + f'epsf/', exist_ok=True)
|
|
42
43
|
os.makedirs(local_directory + f'source/', exist_ok=True)
|
|
43
|
-
if first_sector_only:
|
|
44
|
-
sector = 'first'
|
|
45
|
-
elif last_sector_only:
|
|
46
|
-
sector = 'last'
|
|
47
44
|
print(f'Target: {target}')
|
|
48
45
|
target_ = Catalogs.query_object(target, radius=42 * 0.707 / 3600, catalog="Gaia", version=2)
|
|
49
46
|
if len(target_) == 0:
|
|
@@ -77,7 +74,7 @@ def tglc_lc(target='TIC 264468702', local_directory='', size=90, save_aper=True,
|
|
|
77
74
|
elif first_sector_only:
|
|
78
75
|
print(f'Only processing the first sector the target is observed in: Sector {sector_table["sector"][0]}.')
|
|
79
76
|
print('Downloading Data from MAST and Gaia ...')
|
|
80
|
-
|
|
77
|
+
sector = sector_table["sector"][0]
|
|
81
78
|
source = ffi_cut(target=target, size=size, local_directory=local_directory, sector=sector,
|
|
82
79
|
limit_mag=limit_mag, transient=transient) # sector
|
|
83
80
|
source.select_sector(sector=source.sector_table['sector'][0])
|
|
@@ -86,6 +83,7 @@ def tglc_lc(target='TIC 264468702', local_directory='', size=90, save_aper=True,
|
|
|
86
83
|
elif last_sector_only:
|
|
87
84
|
print(f'Only processing the last sector the target is observed in: Sector {sector_table["sector"][-1]}.')
|
|
88
85
|
print('Downloading Data from MAST and Gaia ...')
|
|
86
|
+
sector = sector_table["sector"][-1]
|
|
89
87
|
source = ffi_cut(target=target, size=size, local_directory=local_directory, sector=sector,
|
|
90
88
|
limit_mag=limit_mag, transient=transient) # sector
|
|
91
89
|
source.select_sector(sector=source.sector_table['sector'][-1])
|
|
@@ -161,27 +159,27 @@ def star_spliter(server=1, # or 2
|
|
|
161
159
|
return
|
|
162
160
|
|
|
163
161
|
|
|
164
|
-
def plot_lc(local_directory=None,
|
|
162
|
+
def plot_lc(local_directory=None, kind='cal_aper_flux', xlow=None, xhigh=None, ylow=None, yhigh=None):
|
|
165
163
|
files = glob(f'{local_directory}lc/*.fits')
|
|
166
164
|
os.makedirs(f'{local_directory}plots/', exist_ok=True)
|
|
167
165
|
for i in range(len(files)):
|
|
168
166
|
with fits.open(files[i], mode='denywrite') as hdul:
|
|
169
167
|
q = [a and b for a, b in zip(list(hdul[1].data['TESS_flags'] == 0), list(hdul[1].data['TGLC_flags'] == 0))]
|
|
170
168
|
plt.figure(constrained_layout=False, figsize=(8, 4))
|
|
171
|
-
plt.plot(hdul[1].data['time'], hdul[1].data[
|
|
172
|
-
plt.plot(hdul[1].data['time'][q], hdul[1].data[
|
|
169
|
+
plt.plot(hdul[1].data['time'], hdul[1].data[kind], '.', c='silver', label=kind)
|
|
170
|
+
plt.plot(hdul[1].data['time'][q], hdul[1].data[kind][q], '.k', label=f'{kind}_flagged')
|
|
173
171
|
plt.xlim(xlow, xhigh)
|
|
174
172
|
plt.ylim(ylow, yhigh)
|
|
175
|
-
plt.title(f'TIC_{hdul[0].header["TICID"]}_sector_{hdul[0].header["SECTOR"]:04d}_{
|
|
173
|
+
plt.title(f'TIC_{hdul[0].header["TICID"]}_sector_{hdul[0].header["SECTOR"]:04d}_{kind}')
|
|
176
174
|
plt.legend()
|
|
177
175
|
# plt.show()
|
|
178
176
|
plt.savefig(
|
|
179
|
-
f'{local_directory}plots/TIC_{hdul[0].header["TICID"]}_sector_{hdul[0].header["SECTOR"]:04d}_{
|
|
177
|
+
f'{local_directory}plots/TIC_{hdul[0].header["TICID"]}_sector_{hdul[0].header["SECTOR"]:04d}_{kind}.png',
|
|
180
178
|
dpi=300)
|
|
181
179
|
plt.close()
|
|
182
180
|
|
|
183
181
|
|
|
184
|
-
def plot_aperture(local_directory=None,
|
|
182
|
+
def plot_aperture(local_directory=None, kind='cal_aper_flux'):
|
|
185
183
|
files = glob(f'{local_directory}*.fits')
|
|
186
184
|
os.makedirs(f'{local_directory}plots/', exist_ok=True)
|
|
187
185
|
portion = [0.9361215204370542, 0.9320709087810205]
|
|
@@ -192,8 +190,8 @@ def plot_aperture(local_directory=None, type='cal_aper_flux'):
|
|
|
192
190
|
print(files[i], portion[i])
|
|
193
191
|
q = [a and b for a, b in zip(list(hdul[1].data['TESS_flags'] == 0), list(hdul[1].data['TGLC_flags'] == 0))]
|
|
194
192
|
plt.figure(constrained_layout=False, figsize=(8, 4))
|
|
195
|
-
plt.plot(hdul[1].data['time'] % 3.79262026, hdul[1].data[
|
|
196
|
-
plt.plot(hdul[1].data['time'][q] % 3.79262026, hdul[1].data[
|
|
193
|
+
plt.plot(hdul[1].data['time'] % 3.79262026, hdul[1].data[kind], '.', c='silver', label=kind)
|
|
194
|
+
plt.plot(hdul[1].data['time'][q] % 3.79262026, hdul[1].data[kind][q], '.k', label=f'{kind}_flagged')
|
|
197
195
|
aperture_bar = 709.5512462444653 * portion[i]
|
|
198
196
|
aper_lc = np.nansum(hdul[0].data, axis=(1, 2))
|
|
199
197
|
local_bg = np.nanmedian(aper_lc) - aperture_bar
|
|
@@ -226,7 +224,7 @@ def plot_aperture(local_directory=None, type='cal_aper_flux'):
|
|
|
226
224
|
np.savetxt(f'{local_directory}TESS_TOI-5344_5_5_aper.csv', data, delimiter=',')
|
|
227
225
|
|
|
228
226
|
|
|
229
|
-
def plot_pf_lc(local_directory=None, period=None, mid_transit_tbjd=None,
|
|
227
|
+
def plot_pf_lc(local_directory=None, period=None, mid_transit_tbjd=None, kind='cal_aper_flux'):
|
|
230
228
|
files = glob(f'{local_directory}*.fits')
|
|
231
229
|
os.makedirs(f'{local_directory}plots/', exist_ok=True)
|
|
232
230
|
fig = plt.figure(figsize=(13, 5))
|
|
@@ -238,27 +236,27 @@ def plot_pf_lc(local_directory=None, period=None, mid_transit_tbjd=None, type='c
|
|
|
238
236
|
with fits.open(files[j], mode='denywrite') as hdul:
|
|
239
237
|
q = [a and b for a, b in
|
|
240
238
|
zip(list(hdul[1].data['TESS_flags'] == 0), list(hdul[1].data['TGLC_flags'] == 0))]
|
|
241
|
-
# q = [a and b for a, b in zip(q, list(hdul[1].data[
|
|
239
|
+
# q = [a and b for a, b in zip(q, list(hdul[1].data[kind] > 0.85))]
|
|
242
240
|
# if hdul[0].header['sector'] == 15:
|
|
243
241
|
# q = [a and b for a, b in zip(q, list(hdul[1].data['time'] < 1736))]
|
|
244
242
|
if len(hdul[1].data['cal_aper_flux']) == len(hdul[1].data['time']):
|
|
245
243
|
if hdul[0].header["SECTOR"] <= 26:
|
|
246
244
|
t = hdul[1].data['time'][q]
|
|
247
|
-
f = hdul[1].data[
|
|
245
|
+
f = hdul[1].data[kind][q]
|
|
248
246
|
elif hdul[0].header["SECTOR"] <= 55:
|
|
249
247
|
t = np.mean(hdul[1].data['time'][q][:len(hdul[1].data['time'][q]) // 3 * 3].reshape(-1, 3), axis=1)
|
|
250
248
|
f = np.mean(
|
|
251
|
-
hdul[1].data[
|
|
249
|
+
hdul[1].data[kind][q][:len(hdul[1].data[kind][q]) // 3 * 3].reshape(-1, 3), axis=1)
|
|
252
250
|
else:
|
|
253
251
|
t = np.mean(hdul[1].data['time'][q][:len(hdul[1].data['time'][q]) // 9 * 9].reshape(-1, 9), axis=1)
|
|
254
252
|
f = np.mean(
|
|
255
|
-
hdul[1].data[
|
|
253
|
+
hdul[1].data[kind][q][:len(hdul[1].data[kind][q]) // 9 * 9].reshape(-1, 9), axis=1)
|
|
256
254
|
t_all = np.append(t_all, t)
|
|
257
255
|
f_all = np.append(f_all, f)
|
|
258
256
|
f_err_all = np.append(f_err_all, np.array([hdul[1].header['CAPE_ERR']] * len(t)))
|
|
259
257
|
|
|
260
|
-
# plt.plot(hdul[1].data['time'] % period / period, hdul[1].data[
|
|
261
|
-
plt.errorbar(t % period / period, f, hdul[1].header['CAPE_ERR'], c='silver', ls='', elinewidth=1
|
|
258
|
+
# plt.plot(hdul[1].data['time'] % period / period, hdul[1].data[kind], '.', c='silver', ms=3)
|
|
259
|
+
plt.errorbar(t % period / period, f, hdul[1].header['CAPE_ERR'], c='silver', ls='', elinewidth=0.1,
|
|
262
260
|
marker='.', ms=3, zorder=2)
|
|
263
261
|
# time_out, meas_out, meas_err_out = timebin(time=t % period, meas=f,
|
|
264
262
|
# meas_err=np.array([hdul[1].header['CAPE_ERR']] * len(t)),
|
|
@@ -267,7 +265,7 @@ def plot_pf_lc(local_directory=None, period=None, mid_transit_tbjd=None, type='c
|
|
|
267
265
|
# marker='.', ms=8, zorder=3, label=f'Sector {hdul[0].header["sector"]}')
|
|
268
266
|
else:
|
|
269
267
|
not_plotted_num += 1
|
|
270
|
-
title = f'TIC_{hdul[0].header["TICID"]} with {len(files) - not_plotted_num} sector(s) of data, {
|
|
268
|
+
title = f'TIC_{hdul[0].header["TICID"]} with {len(files) - not_plotted_num} sector(s) of data, {kind}'
|
|
271
269
|
# PDCSAP_files = glob('/home/tehan/Documents/GEMS/TIC 172370679/PDCSAP/*.txt')
|
|
272
270
|
# for i in range(len(files)):
|
|
273
271
|
# PDCSAP = ascii.read(PDCSAP_files[i])
|
|
@@ -281,11 +279,11 @@ def plot_pf_lc(local_directory=None, period=None, mid_transit_tbjd=None, type='c
|
|
|
281
279
|
plt.errorbar(np.array(time_out) / period, meas_out, meas_err_out, c=f'r', ls='', elinewidth=1.5,
|
|
282
280
|
marker='.', ms=8, zorder=3, label=f'All sectors')
|
|
283
281
|
|
|
284
|
-
plt.ylim(0.
|
|
282
|
+
plt.ylim(0.998, 1.001)
|
|
285
283
|
# plt.xlim(0.3, 0.43)
|
|
286
284
|
plt.legend()
|
|
287
285
|
plt.title(title)
|
|
288
|
-
plt.xlim(mid_transit_tbjd % period - 0.1 * period, mid_transit_tbjd % period + 0.1 * period)
|
|
286
|
+
# plt.xlim(mid_transit_tbjd % period - 0.1 * period, mid_transit_tbjd % period + 0.1 * period)
|
|
289
287
|
# plt.ylim(0.9, 1.1)
|
|
290
288
|
# plt.hlines(y=0.92, xmin=0, xmax=1, ls='dotted', colors='k')
|
|
291
289
|
# plt.hlines(y=0.93, xmin=0, xmax=1, ls='dotted', colors='k')
|
|
@@ -296,47 +294,59 @@ def plot_pf_lc(local_directory=None, period=None, mid_transit_tbjd=None, type='c
|
|
|
296
294
|
plt.close(fig)
|
|
297
295
|
|
|
298
296
|
|
|
299
|
-
def plot_contamination(local_directory=None, gaia_dr3=None):
|
|
300
|
-
|
|
297
|
+
def plot_contamination(local_directory=None, gaia_dr3=None, ymin=None, ymax=None, pm_years=3000):
|
|
298
|
+
sns.set(rc={'font.family': 'serif', 'font.serif': 'DejaVu Serif', 'font.size': 12,
|
|
299
|
+
'axes.edgecolor': '0.2', 'axes.labelcolor': '0.', 'xtick.color': '0.', 'ytick.color': '0.',
|
|
300
|
+
'axes.facecolor': '0.95', "axes.grid": False})
|
|
301
|
+
|
|
302
|
+
files = glob(f'{local_directory}lc/*{gaia_dr3}*.fits')
|
|
301
303
|
os.makedirs(f'{local_directory}plots/', exist_ok=True)
|
|
302
304
|
for i in range(len(files)):
|
|
303
305
|
with fits.open(files[i], mode='denywrite') as hdul:
|
|
304
306
|
sector = hdul[0].header['SECTOR']
|
|
307
|
+
q = [a and b for a, b in
|
|
308
|
+
zip(list(hdul[1].data['TESS_flags'] == 0), list(hdul[1].data['TGLC_flags'] == 0))]
|
|
309
|
+
if ymin is None and ymax is None:
|
|
310
|
+
ymin = np.nanmin(hdul[1].data['cal_aper_flux'][q]) - 0.05
|
|
311
|
+
ymax = np.nanmax(hdul[1].data['cal_aper_flux'][q]) + 0.05
|
|
305
312
|
with open(glob(f'{local_directory}source/*_{sector}.pkl')[0], 'rb') as input_:
|
|
306
313
|
source = pickle.load(input_)
|
|
307
314
|
source.select_sector(sector=sector)
|
|
308
315
|
star_num = np.where(source.gaia['DESIGNATION'] == f'Gaia DR3 {gaia_dr3}')
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
plt.close()
|
|
312
|
-
# print(source.gaia[891])
|
|
313
|
-
# print(source.gaia[star_num])
|
|
314
|
-
nearby_stars = np.argsort(
|
|
316
|
+
|
|
317
|
+
distances = np.sqrt(
|
|
315
318
|
(source.gaia[f'sector_{sector}_x'][:500] - source.gaia[star_num][f'sector_{sector}_x']) ** 2 +
|
|
316
|
-
(source.gaia[f'sector_{sector}_y'][:500] - source.gaia[star_num][f'sector_{sector}_y']) ** 2)
|
|
317
|
-
|
|
319
|
+
(source.gaia[f'sector_{sector}_y'][:500] - source.gaia[star_num][f'sector_{sector}_y']) ** 2)
|
|
320
|
+
|
|
321
|
+
# Find closest 5 stars (6-self) or those within 5 pixels
|
|
322
|
+
nearby_stars = np.argsort(distances)[:6]
|
|
323
|
+
nearby_stars = nearby_stars[distances[nearby_stars] <= 5]
|
|
318
324
|
star_x = source.gaia[star_num][f'sector_{sector}_x'][0]
|
|
319
325
|
star_y = source.gaia[star_num][f'sector_{sector}_y'][0]
|
|
320
326
|
max_flux = np.nanmax(
|
|
321
|
-
np.nanmedian(
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
gs.
|
|
326
|
-
|
|
327
|
+
np.nanmedian(
|
|
328
|
+
source.flux[:, round(star_y) - 2:round(star_y) + 3, round(star_x) - 2:round(star_x) + 3],
|
|
329
|
+
axis=0))
|
|
330
|
+
fig = plt.figure(constrained_layout=False, figsize=(20, 12))
|
|
331
|
+
gs = fig.add_gridspec(21, 10)
|
|
332
|
+
gs.update(wspace=0.03, hspace=0.1)
|
|
333
|
+
ax0 = fig.add_subplot(gs[:10, :3])
|
|
327
334
|
ax0.imshow(np.median(source.flux, axis=0), cmap='RdBu', vmin=-max_flux, vmax=max_flux, origin='lower')
|
|
328
|
-
|
|
329
|
-
ax0.
|
|
330
|
-
|
|
331
|
-
ax0.scatter(source.gaia[f'sector_{sector}_x'][
|
|
332
|
-
source.gaia[f'sector_{sector}_y'][nearby_stars], s=50,
|
|
335
|
+
ax0.set_xlabel('x pixel')
|
|
336
|
+
ax0.set_ylabel('y pixel')
|
|
337
|
+
ax0.scatter(star_x, star_y, s=300, c='r', marker='*', label='target star')
|
|
338
|
+
ax0.scatter(source.gaia[f'sector_{sector}_x'][:500], source.gaia[f'sector_{sector}_y'][:500], s=30,
|
|
333
339
|
c='r', label='background stars')
|
|
340
|
+
ax0.scatter(source.gaia[f'sector_{sector}_x'][nearby_stars[nearby_stars != star_num[0][0]]],
|
|
341
|
+
source.gaia[f'sector_{sector}_y'][nearby_stars[nearby_stars != star_num[0][0]]],
|
|
342
|
+
s=30, c='r', edgecolor='black', linewidth=1, label='background stars')
|
|
343
|
+
|
|
334
344
|
for l in range(len(nearby_stars)):
|
|
335
345
|
index = np.where(
|
|
336
346
|
source.tic['dr3_source_id'] == int(source.gaia['DESIGNATION'][nearby_stars[l]].split(' ')[-1]))
|
|
337
347
|
gaia_targets = source.gaia
|
|
338
348
|
median_time = np.median(source.time)
|
|
339
|
-
interval = (median_time - 388.5) / 365.25 +
|
|
349
|
+
interval = (median_time - 388.5) / 365.25 + pm_years
|
|
340
350
|
ra = gaia_targets['ra'][nearby_stars[l]]
|
|
341
351
|
dec = gaia_targets['dec'][nearby_stars[l]]
|
|
342
352
|
if not np.isnan(gaia_targets['pmra'][nearby_stars[l]]):
|
|
@@ -352,43 +362,36 @@ def plot_contamination(local_directory=None, gaia_dr3=None):
|
|
|
352
362
|
y_gaia - source.gaia[f'sector_{sector}_y'][nearby_stars[l]],
|
|
353
363
|
width=0.02, color='r', edgecolor=None, head_width=0.1)
|
|
354
364
|
try:
|
|
355
|
-
ax0.text(source.gaia[f'sector_{sector}_x'][nearby_stars[l]]
|
|
356
|
-
|
|
357
|
-
|
|
365
|
+
txt = ax0.text(source.gaia[f'sector_{sector}_x'][nearby_stars[l]] + 0.5,
|
|
366
|
+
source.gaia[f'sector_{sector}_y'][nearby_stars[l]] - 0.05,
|
|
367
|
+
f'TIC {int(source.tic["TIC"][index])}', size=7)
|
|
368
|
+
|
|
358
369
|
except TypeError:
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
f'{source.gaia[f"DESIGNATION"][nearby_stars[l]]}', rotation=90)
|
|
362
|
-
ax0.scatter(star_x, star_y, s=300, c='r', marker='*', label='target star')
|
|
370
|
+
designation = source.gaia[f"DESIGNATION"][nearby_stars[l]]
|
|
371
|
+
formatted_text = '\n'.join([designation[i:i + 15] for i in range(0, len(designation), 15)])
|
|
363
372
|
|
|
364
|
-
|
|
373
|
+
txt = ax0.text(source.gaia[f'sector_{sector}_x'][nearby_stars[l]] + 0.5,
|
|
374
|
+
source.gaia[f'sector_{sector}_y'][nearby_stars[l]] - 0.05,
|
|
375
|
+
formatted_text, size=7)
|
|
365
376
|
ax0.set_xlim(round(star_x) - 5.5, round(star_x) + 5.5)
|
|
366
377
|
ax0.set_ylim(round(star_y) - 5.5, round(star_y) + 5.5)
|
|
367
|
-
ax0.set_title(f'TIC_{hdul[0].header["TICID"]}
|
|
368
|
-
ax0.vlines(round(star_x) - 2.5, round(star_y) - 2.5, round(star_y) + 2.5, colors='k')
|
|
369
|
-
ax0.vlines(round(star_x) + 2.5, round(star_y) - 2.5, round(star_y) + 2.5, colors='k')
|
|
370
|
-
ax0.hlines(round(star_y) - 2.5, round(star_x) - 2.5, round(star_x) + 2.5, colors='k')
|
|
371
|
-
ax0.hlines(round(star_y) + 2.5, round(star_x) - 2.5, round(star_x) + 2.5, colors='k')
|
|
372
|
-
# for j in range(5):
|
|
373
|
-
# for k in range(5):
|
|
374
|
-
# ax_ = fig.add_subplot(gs[(4 - j), (5 + k)])
|
|
375
|
-
# ax_.patch.set_facecolor('C0')
|
|
376
|
-
# ax_.patch.set_alpha(max(0, np.median(source.flux[:, round(star_y) - 2 + j, round(star_x) - 2 + k]) / max_flux))
|
|
377
|
-
# cal_lc, trend = flatten(hdul[1].data['time'],
|
|
378
|
-
# source.flux[:, round(star_y) - 2 + j, round(star_x) - 2 + k],
|
|
379
|
-
# window_length=1, method='biweight', return_trend=True)
|
|
380
|
-
# ax_.plot(hdul[1].data['time'], cal_lc, '.k', ms=1, label='center pixel')
|
|
381
|
-
|
|
378
|
+
ax0.set_title(f'TIC_{hdul[0].header["TICID"]}_Sector_{hdul[0].header["SECTOR"]:04d}')
|
|
379
|
+
ax0.vlines(round(star_x) - 2.5, round(star_y) - 2.5, round(star_y) + 2.5, colors='k', lw=1.2)
|
|
380
|
+
ax0.vlines(round(star_x) + 2.5, round(star_y) - 2.5, round(star_y) + 2.5, colors='k', lw=1.2)
|
|
381
|
+
ax0.hlines(round(star_y) - 2.5, round(star_x) - 2.5, round(star_x) + 2.5, colors='k', lw=1.2)
|
|
382
|
+
ax0.hlines(round(star_y) + 2.5, round(star_x) - 2.5, round(star_x) + 2.5, colors='k', lw=1.2)
|
|
382
383
|
t_, y_, x_ = np.shape(hdul[0].data)
|
|
383
384
|
max_flux = np.max(
|
|
384
385
|
np.median(source.flux[:, int(star_y) - 2:int(star_y) + 3, int(star_x) - 2:int(star_x) + 3], axis=0))
|
|
386
|
+
sns.set(rc={'font.family': 'serif', 'font.serif': 'DejaVu Serif', 'font.size': 12,
|
|
387
|
+
'axes.edgecolor': '0.2', 'axes.labelcolor': '0.', 'xtick.color': '0.', 'ytick.color': '0.',
|
|
388
|
+
'axes.facecolor': '0.95', 'grid.color': '0.9'})
|
|
389
|
+
arrays = []
|
|
385
390
|
for j in range(y_):
|
|
386
391
|
for k in range(x_):
|
|
387
|
-
ax_ = fig.add_subplot(gs[(
|
|
388
|
-
ax_.patch.set_facecolor('
|
|
392
|
+
ax_ = fig.add_subplot(gs[(19 - 2 * j):(21 - 2 * j), (2 * k):(2 + 2 * k)])
|
|
393
|
+
ax_.patch.set_facecolor('#4682B4')
|
|
389
394
|
ax_.patch.set_alpha(min(1, max(0, 5 * np.nanmedian(hdul[0].data[:, j, k]) / max_flux)))
|
|
390
|
-
q = [a and b for a, b in
|
|
391
|
-
zip(list(hdul[1].data['TESS_flags'] == 0), list(hdul[1].data['TGLC_flags'] == 0))]
|
|
392
395
|
|
|
393
396
|
_, trend = flatten(hdul[1].data['time'][q],
|
|
394
397
|
hdul[0].data[:, j, k][q] - np.nanmin(hdul[0].data[:, j, k][q]) + 1000,
|
|
@@ -396,16 +399,68 @@ def plot_contamination(local_directory=None, gaia_dr3=None):
|
|
|
396
399
|
cal_aper = (hdul[0].data[:, j, k][q] - np.nanmin(
|
|
397
400
|
hdul[0].data[:, j, k][q]) + 1000 - trend) / np.nanmedian(
|
|
398
401
|
hdul[0].data[:, j, k][q]) + 1
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
+
if 1 <= j <= 3 and 1 <= k <= 3:
|
|
403
|
+
arrays.append(cal_aper)
|
|
404
|
+
ax_.plot(hdul[1].data['time'][q], cal_aper, '.k', ms=0.5)
|
|
405
|
+
# ax_.plot(hdul[1].data['time'][q], hdul[0].data[:, j, k][q], '.k', ms=0.5)
|
|
406
|
+
ax_.set_ylim(ymin, ymax)
|
|
407
|
+
ax_.set_xlabel('TBJD')
|
|
408
|
+
ax_.set_ylabel('')
|
|
402
409
|
if j != 0:
|
|
403
410
|
ax_.set_xticklabels([])
|
|
411
|
+
ax_.set_xlabel('')
|
|
404
412
|
if k != 0:
|
|
405
413
|
ax_.set_yticklabels([])
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
414
|
+
if j == 2 and k == 0:
|
|
415
|
+
ax_.set_ylabel('Normalized and detrended Flux of each pixel')
|
|
416
|
+
|
|
417
|
+
combinations = itertools.combinations(arrays, 2)
|
|
418
|
+
median_abs_diffs = []
|
|
419
|
+
for arr_a, arr_b in combinations:
|
|
420
|
+
abs_diff = np.abs(arr_a - arr_b)
|
|
421
|
+
median_diff = np.median(abs_diff)
|
|
422
|
+
median_abs_diffs.append(median_diff)
|
|
423
|
+
median_abs_diffs = np.array(median_abs_diffs)
|
|
424
|
+
iqr = np.percentile(median_abs_diffs, 75) - np.percentile(median_abs_diffs, 25)
|
|
425
|
+
print(f"Interquartile Range (IQR): {iqr}")
|
|
426
|
+
std_dev = np.std(median_abs_diffs)
|
|
427
|
+
print(f"Standard Deviation: {std_dev}")
|
|
428
|
+
ax1 = fig.add_subplot(gs[:10, 4:7])
|
|
429
|
+
ax1.hist(median_abs_diffs, color='k', edgecolor='k', facecolor='none', rwidth=0.8, linewidth=2)
|
|
430
|
+
ax1.set_box_aspect(1)
|
|
431
|
+
ax1.set_title(f'Distribution of the MADs among combinations of the center 3*3 pixels')
|
|
432
|
+
ax1.set_xlabel('MAD between combinations of center 3*3 pixel fluxes')
|
|
433
|
+
ax1.set_ylabel('Counts')
|
|
434
|
+
text_ax = fig.add_axes([0.71, 0.9, 0.3, 0.3]) # [left, bottom, width, height] in figure coordinates
|
|
435
|
+
text_ax.axis('off') # Turn off axis lines, ticks, etc.
|
|
436
|
+
text_ax.text(0., 0., f"Gaia DR3 {gaia_dr3} \n"
|
|
437
|
+
f" ←← TESS SPOC FFI and TIC/Gaia stars with proper motions. \n"
|
|
438
|
+
f" Arrows show Gaia proper motion after {pm_years} years. \n"
|
|
439
|
+
f" ← Histogram of the MADs between 3*3 pixel fluxes. \n"
|
|
440
|
+
f" ↓ Fluxes of each pixels after contaminations are removed. \n"
|
|
441
|
+
f" The fluxes are normalized and detrended. The background \n"
|
|
442
|
+
f" color shows the pixel brightness after the decontamination. \n"
|
|
443
|
+
f"\n"
|
|
444
|
+
f"How to interpret these plots: \n"
|
|
445
|
+
f" If the signals you are interested in (i.e. transits, \n"
|
|
446
|
+
f" eclipses, variable stars) show similar amplitudes in \n"
|
|
447
|
+
f" all (especially the center 3*3) pixels, then the star \n"
|
|
448
|
+
f" is likely to be the source. The median absolute \n"
|
|
449
|
+
f" differences (MADs) taken between all combinations \n"
|
|
450
|
+
f" of the center pixel fluxes are shown in the histogram \n"
|
|
451
|
+
f" for a quantititive comparison to other possible sources. \n"
|
|
452
|
+
f" The star with smaller distribution width (IQR or \n"
|
|
453
|
+
f" STD) is more likely to be the source of the signal. \n"
|
|
454
|
+
f"\n"
|
|
455
|
+
f"Interquartile Range (IQR): {iqr:05f} \n"
|
|
456
|
+
f"Standard Deviation: {std_dev:05f}", transform=text_ax.transAxes, ha='left',
|
|
457
|
+
va='top')
|
|
458
|
+
plt.subplots_adjust(top=.98, bottom=0.05, left=0.05, right=0.95)
|
|
459
|
+
plt.savefig(
|
|
460
|
+
f'{local_directory}plots/contamination_sector_{hdul[0].header["SECTOR"]:04d}_Gaia_DR3_{gaia_dr3}.pdf',
|
|
461
|
+
dpi=300)
|
|
462
|
+
# plt.savefig(f'{local_directory}plots/contamination_sector_{hdul[0].header["SECTOR"]:04d}_Gaia_DR3_{gaia_dr3}.png',
|
|
463
|
+
# dpi=600)
|
|
409
464
|
plt.close()
|
|
410
465
|
|
|
411
466
|
|
|
@@ -451,32 +506,21 @@ def get_tglc_lc(tics=None, method='query', server=1, directory=None, prior=None)
|
|
|
451
506
|
tglc_lc(target=target, local_directory=local_directory, size=90, save_aper=True, limit_mag=16,
|
|
452
507
|
get_all_lc=False, first_sector_only=False, last_sector_only=False, sector=None, prior=prior,
|
|
453
508
|
transient=None)
|
|
454
|
-
plot_lc(local_directory=f'{directory}TIC {tics[i]}/',
|
|
509
|
+
plot_lc(local_directory=f'{directory}TIC {tics[i]}/', kind='cal_aper_flux')
|
|
455
510
|
if method == 'search':
|
|
456
511
|
star_spliter(server=server, tics=tics, local_directory=directory)
|
|
457
512
|
|
|
458
513
|
|
|
459
514
|
if __name__ == '__main__':
|
|
460
515
|
tics = [16005254]
|
|
461
|
-
directory = f'/home/tehan/
|
|
462
|
-
# directory = f'/home/tehan/data/cosmos/GEMS/'
|
|
516
|
+
directory = f'/home/tehan/data/'
|
|
463
517
|
os.makedirs(directory, exist_ok=True)
|
|
464
|
-
|
|
465
|
-
plot_lc(local_directory=f'
|
|
466
|
-
|
|
518
|
+
get_tglc_lc(tics=tics, method='query', server=1, directory=directory)
|
|
519
|
+
# plot_lc(local_directory=f'{directory}TIC {tics[0]}/', kind='cal_aper_flux')
|
|
520
|
+
# plot_lc(local_directory=f'/home/tehan/Documents/tglc/TIC 16005254/', kind='cal_aper_flux', ylow=0.9, yhigh=1.1)
|
|
521
|
+
# plot_contamination(local_directory=f'{directory}TIC {tics[0]}/', gaia_dr3=5751990597042725632)
|
|
467
522
|
# plot_epsf(local_directory=f'{directory}TIC {tics[0]}/')
|
|
468
523
|
# plot_pf_lc(local_directory=f'{directory}TIC {tics[0]}/lc/', period=0.71912603, mid_transit_tbjd=2790.58344,
|
|
469
|
-
#
|
|
470
|
-
# plot_pf_lc(local_directory=f'{directory}TIC {tics[0]}/lc/', period=0.
|
|
471
|
-
#
|
|
472
|
-
|
|
473
|
-
# target = f'266.489125, -33.8428'
|
|
474
|
-
# directory = f'/home/tehan/data/cosmos/michelle/'
|
|
475
|
-
# local_directory = f'{directory}{target}/'
|
|
476
|
-
# os.makedirs(local_directory, exist_ok=True)
|
|
477
|
-
# tglc_lc(target=target, local_directory=local_directory, size=50, save_aper=True, limit_mag=17,
|
|
478
|
-
# get_all_lc=False, first_sector_only=False, last_sector_only=False, sector=39, prior=None,
|
|
479
|
-
# transient=['266.489125, -33.8428', 266.489125, -33.8428])
|
|
480
|
-
# plot_lc(local_directory=f'{local_directory}', type='cal_aper_flux')
|
|
481
|
-
# plot_lc(local_directory=f'{local_directory}', yhigh=150, type='aperture_flux')
|
|
482
|
-
# plot_contamination(local_directory=f'{local_directory}', gaia_dr3=4041831235071242624)
|
|
524
|
+
# kind='cal_psf_flux')
|
|
525
|
+
# plot_pf_lc(local_directory=f'{directory}TIC {tics[0]}/lc/', period=0.23818244, mid_transit_tbjd=1738.71248,
|
|
526
|
+
# kind='cal_aper_flux')
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: tglc
|
|
3
|
+
Version: 0.6.5
|
|
4
|
+
Summary: TESS-Gaia Light Curve
|
|
5
|
+
Home-page: https://github.com/TeHanHunter/TESS_Gaia_Light_Curve
|
|
6
|
+
Author: Te Han
|
|
7
|
+
Author-email: tehanhunter@gmail.com
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Requires-Python: >=3.8
|
|
12
|
+
Description-Content-Type: text/x-rst
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Requires-Dist: astropy>=5.1
|
|
15
|
+
Requires-Dist: astroquery
|
|
16
|
+
Requires-Dist: matplotlib
|
|
17
|
+
Requires-Dist: numpy
|
|
18
|
+
Requires-Dist: oauthlib
|
|
19
|
+
Requires-Dist: requests
|
|
20
|
+
Requires-Dist: scipy
|
|
21
|
+
Requires-Dist: threadpoolctl
|
|
22
|
+
Requires-Dist: tqdm
|
|
23
|
+
Requires-Dist: wheel
|
|
24
|
+
Requires-Dist: wotan
|
|
25
|
+
|
|
26
|
+
==================================
|
|
27
|
+
Introduction
|
|
28
|
+
==================================
|
|
29
|
+
|
|
30
|
+
TESS-Gaia Light Curve (`TGLC <https://archive.stsci.edu/hlsp/tglc>`_) is a dataset of TESS full-frame image light curves publicly available via the MAST portal. It is fitted with effective PSF and decontaminated with Gaia DR3 and achieved percent-level photometric precision down to 16th TESS magnitude! It unlocks astrophysics to a vast number of dim stars below 12th TESS magnitude. A package called tglc is pip-installable for customized light curve fits.
|
|
31
|
+
|
|
32
|
+
==================================
|
|
33
|
+
Usage
|
|
34
|
+
==================================
|
|
35
|
+
There are four fluxes in each FITS file: aperture flux, PSF flux, calibrated aperture flux, and calibrated PSF flux.
|
|
36
|
+
If you are uncertain which to use:
|
|
37
|
+
|
|
38
|
+
* Calibrated psf flux is better in **deblending** targets. Use this if you need to deblend a target near a variable source. The best deblending can be achieved with tglc package by setting a non-zero prior. It also gives the more accurate **transit depth** in most cases, especially when fitting with an optimized prior.
|
|
39
|
+
* Calibrated aperture flux usually has slightly **higher SNR**. The transit depth (or variation amplitude), however, can be imperfect since the normalization depends on the PSF fitting which is imperfect. This imperfection can be minimized by using a bigger aperture than the default aperture (3*3). One need to use the tglc package and set tglc_lc(save_aper=True) to access the 5*5 aperture. In the presence of a bright but "constant" contamination (several magnitudes brighter), the calibrated aperture flux is better in removing the constant contamination.
|
|
40
|
+
* The aperture flux and PSF flux are not detrended or normalized. Use this if you are doing stellar variability science with long baseline. Or, if the detrending is not optimal (default detrending has a window length of 1 day; see Known Problems below), start with the aperture flux or PSF flux and detrend carefully!
|
|
41
|
+
* **If you are uncertain, start with calibrated aperture flux!**
|
|
42
|
+
|
|
43
|
+
The `tutorial <tutorial/TGLC_tutorial.ipynb>`_ shows the syntaxes and differences among these light curves in several examples.
|
|
44
|
+
|
|
45
|
+
==================================
|
|
46
|
+
Data Access
|
|
47
|
+
==================================
|
|
48
|
+
There are three data access methods:
|
|
49
|
+
|
|
50
|
+
* MAST Portal: Easiest for acquiring light curves for a few stars. However, new sectors are updated relatively slowly.
|
|
51
|
+
* MAST bulk download: Best for downloading light curves for all stars (<16 TESS magnitude) in a sectors.
|
|
52
|
+
* tglc package: Capable of producing similar quality light curves for any sector and any star with custom options.
|
|
53
|
+
|
|
54
|
+
MAST Portal/bulk download
|
|
55
|
+
----------------------------
|
|
56
|
+
The easiest usage requires no package installation. Simply follow the `TGLC HLSP page <https://archive.stsci.edu/hlsp/tglc>`_ to download light curves from MAST or use `MAST Portal <https://mast.stsci.edu/portal/Mashup/Clients/Mast/Portal.html>`_. Light curves are being fitted sector by sector and will be available on MAST gradually. MAST hosts all Gaia DR3 stars down to 16th magnitude. Each .fits file includes PSF and aperture light curves and their calibrated versions.
|
|
57
|
+
|
|
58
|
+
MAST available sectors: `sector worklist <https://docs.google.com/spreadsheets/d/1FhHElWb1wmx9asWiZecAJ2umN0-P_aXn55OBVB34_rg/edit?usp=sharing>`_
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
tglc package
|
|
62
|
+
----------------------------
|
|
63
|
+
Users can also fit light curves using the package tglc. Using tglc, one can specify a region, sector(s), and customized aperture shape if needed. It can also allow all field stars to float by assigning Gaussian priors, which can help decontaminate variable field stars. tglc is currently only available for linux. Run::
|
|
64
|
+
|
|
65
|
+
pip install tglc
|
|
66
|
+
|
|
67
|
+
for the latest tglc release. After installation, follow the `tutorial <tutorial/TGLC_tutorial.ipynb>`_ to fit light curves. If there is a problem, please leave a comment in the Issues section to help us improve. Thank you!
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
==================================
|
|
71
|
+
Known Problems
|
|
72
|
+
==================================
|
|
73
|
+
There are several imperfections we noticed in the MAST TGLC light curves and tglc package:
|
|
74
|
+
|
|
75
|
+
* If the star is very dim (~< 15 Tmag) near a variable source, it can make the aperture and/or PSF light curve negative for some cadences. The detrending algorithm could malfunction and result in bad cal_aper_flux and/or cal_psf_flux. This is now fixed for tglc package, but this problem remains for the primary mission light curves published on MAST. Please detrend again if necessary. The extended mission light curves on MAST will not be affected. This is a very rare scenario, but could be important.
|
|
76
|
+
|
|
77
|
+
==================================
|
|
78
|
+
Reference
|
|
79
|
+
==================================
|
|
80
|
+
If you find the TGLC light curves or the tglc package useful in your research, please cite `our paper <https://iopscience.iop.org/article/10.3847/1538-3881/acaaa7>`_ published on the Astronomical Journal.
|
tglc-0.6.3/PKG-INFO
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: tglc
|
|
3
|
-
Version: 0.6.3
|
|
4
|
-
Summary: TESS-Gaia Light Curve
|
|
5
|
-
Home-page: https://github.com/TeHanHunter/TESS_Gaia_Light_Curve
|
|
6
|
-
Author: Te Han
|
|
7
|
-
Author-email: tehanhunter@gmail.com
|
|
8
|
-
License: UNKNOWN
|
|
9
|
-
Description: ==================================
|
|
10
|
-
Introduction
|
|
11
|
-
==================================
|
|
12
|
-
|
|
13
|
-
TESS-Gaia Light Curve (`TGLC <https://archive.stsci.edu/hlsp/tglc>`_) is a dataset of TESS full-frame image light curves publicly available via the MAST portal. It is fitted with effective PSF and decontaminated with Gaia DR3 and achieved percent-level photometric precision down to 16th TESS magnitude! It unlocks astrophysics to a vast number of dim stars below 12th TESS magnitude. A package called tglc is pip-installable for customized light curve fits.
|
|
14
|
-
|
|
15
|
-
==================================
|
|
16
|
-
Usage
|
|
17
|
-
==================================
|
|
18
|
-
There are four fluxes in each FITS file: aperture flux, PSF flux, calibrated aperture flux, and calibrated PSF flux.
|
|
19
|
-
If you are uncertain which to use:
|
|
20
|
-
|
|
21
|
-
* Calibrated psf flux is better in **deblending** targets. Use this if you need to deblend a target near a variable source. The best deblending can be achieved with tglc package by setting a non-zero prior. It also gives the more accurate **transit depth** in most cases, especially when fitting with an optimized prior.
|
|
22
|
-
* Calibrated aperture flux usually has slightly **higher SNR**. The transit depth (or variation amplitude), however, can be imperfect since the normalization depends on the PSF fitting which is imperfect. This imperfection can be minimized by using a bigger aperture than the default aperture (3*3). One need to use the tglc package and set tglc_lc(save_aper=True) to access the 5*5 aperture. In the presence of a bright but "constant" contamination (several magnitudes brighter), the calibrated aperture flux is better in removing the constant contamination.
|
|
23
|
-
* The aperture flux and PSF flux are not detrended or normalized. Use this if you are doing stellar variability science with long baseline. Or, if the detrending is not optimal (default detrending has a window length of 1 day; see Known Problems below), start with the aperture flux or PSF flux and detrend carefully!
|
|
24
|
-
* **If you are uncertain, start with calibrated aperture flux!**
|
|
25
|
-
|
|
26
|
-
The `tutorial <tutorial/TGLC_tutorial.ipynb>`_ shows the syntaxes and differences among these light curves in several examples.
|
|
27
|
-
|
|
28
|
-
==================================
|
|
29
|
-
Data Access
|
|
30
|
-
==================================
|
|
31
|
-
There are three data access methods:
|
|
32
|
-
|
|
33
|
-
* MAST Portal: Easiest for acquiring light curves for a few stars. However, new sectors are updated relatively slowly.
|
|
34
|
-
* MAST bulk download: Best for downloading light curves for all stars (<16 TESS magnitude) in a sectors.
|
|
35
|
-
* tglc package: Capable of producing similar quality light curves for any sector and any star with custom options.
|
|
36
|
-
|
|
37
|
-
MAST Portal/bulk download
|
|
38
|
-
----------------------------
|
|
39
|
-
The easiest usage requires no package installation. Simply follow the `TGLC HLSP page <https://archive.stsci.edu/hlsp/tglc>`_ to download light curves from MAST or use `MAST Portal <https://mast.stsci.edu/portal/Mashup/Clients/Mast/Portal.html>`_. Light curves are being fitted sector by sector and will be available on MAST gradually. MAST hosts all Gaia DR3 stars down to 16th magnitude. Each .fits file includes PSF and aperture light curves and their calibrated versions.
|
|
40
|
-
|
|
41
|
-
MAST available sectors: `sector worklist <https://docs.google.com/spreadsheets/d/1FhHElWb1wmx9asWiZecAJ2umN0-P_aXn55OBVB34_rg/edit?usp=sharing>`_
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
tglc package
|
|
45
|
-
----------------------------
|
|
46
|
-
Users can also fit light curves using the package tglc. Using tglc, one can specify a region, sector(s), and customized aperture shape if needed. It can also allow all field stars to float by assigning Gaussian priors, which can help decontaminate variable field stars. tglc is currently only available for linux. Run::
|
|
47
|
-
|
|
48
|
-
pip install tglc
|
|
49
|
-
|
|
50
|
-
for the latest tglc release. After installation, follow the `tutorial <tutorial/TGLC_tutorial.ipynb>`_ to fit light curves. If there is a problem, please leave a comment in the Issues section to help us improve. Thank you!
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
==================================
|
|
54
|
-
Known Problems
|
|
55
|
-
==================================
|
|
56
|
-
There are several imperfections we noticed in the MAST TGLC light curves and tglc package:
|
|
57
|
-
|
|
58
|
-
* If the star is very dim (~< 15 Tmag) near a variable source, it can make the aperture and/or PSF light curve negative for some cadences. The detrending algorithm could malfunction and result in bad cal_aper_flux and/or cal_psf_flux. This is now fixed for tglc package, but this problem remains for the primary mission light curves published on MAST. Please detrend again if necessary. The extended mission light curves on MAST will not be affected. This is a very rare scenario, but could be important.
|
|
59
|
-
|
|
60
|
-
==================================
|
|
61
|
-
Reference
|
|
62
|
-
==================================
|
|
63
|
-
If you find the TGLC light curves or the tglc package useful in your research, please cite `our paper <https://iopscience.iop.org/article/10.3847/1538-3881/acaaa7>`_ published on the Astronomical Journal.
|
|
64
|
-
|
|
65
|
-
Platform: UNKNOWN
|
|
66
|
-
Classifier: Programming Language :: Python :: 3
|
|
67
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
68
|
-
Classifier: Operating System :: OS Independent
|
|
69
|
-
Requires-Python: >=3.8
|
|
70
|
-
Description-Content-Type: text/x-rst
|
tglc-0.6.3/tglc/__init__.py
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: tglc
|
|
3
|
-
Version: 0.6.3
|
|
4
|
-
Summary: TESS-Gaia Light Curve
|
|
5
|
-
Home-page: https://github.com/TeHanHunter/TESS_Gaia_Light_Curve
|
|
6
|
-
Author: Te Han
|
|
7
|
-
Author-email: tehanhunter@gmail.com
|
|
8
|
-
License: UNKNOWN
|
|
9
|
-
Description: ==================================
|
|
10
|
-
Introduction
|
|
11
|
-
==================================
|
|
12
|
-
|
|
13
|
-
TESS-Gaia Light Curve (`TGLC <https://archive.stsci.edu/hlsp/tglc>`_) is a dataset of TESS full-frame image light curves publicly available via the MAST portal. It is fitted with effective PSF and decontaminated with Gaia DR3 and achieved percent-level photometric precision down to 16th TESS magnitude! It unlocks astrophysics to a vast number of dim stars below 12th TESS magnitude. A package called tglc is pip-installable for customized light curve fits.
|
|
14
|
-
|
|
15
|
-
==================================
|
|
16
|
-
Usage
|
|
17
|
-
==================================
|
|
18
|
-
There are four fluxes in each FITS file: aperture flux, PSF flux, calibrated aperture flux, and calibrated PSF flux.
|
|
19
|
-
If you are uncertain which to use:
|
|
20
|
-
|
|
21
|
-
* Calibrated psf flux is better in **deblending** targets. Use this if you need to deblend a target near a variable source. The best deblending can be achieved with tglc package by setting a non-zero prior. It also gives the more accurate **transit depth** in most cases, especially when fitting with an optimized prior.
|
|
22
|
-
* Calibrated aperture flux usually has slightly **higher SNR**. The transit depth (or variation amplitude), however, can be imperfect since the normalization depends on the PSF fitting which is imperfect. This imperfection can be minimized by using a bigger aperture than the default aperture (3*3). One need to use the tglc package and set tglc_lc(save_aper=True) to access the 5*5 aperture. In the presence of a bright but "constant" contamination (several magnitudes brighter), the calibrated aperture flux is better in removing the constant contamination.
|
|
23
|
-
* The aperture flux and PSF flux are not detrended or normalized. Use this if you are doing stellar variability science with long baseline. Or, if the detrending is not optimal (default detrending has a window length of 1 day; see Known Problems below), start with the aperture flux or PSF flux and detrend carefully!
|
|
24
|
-
* **If you are uncertain, start with calibrated aperture flux!**
|
|
25
|
-
|
|
26
|
-
The `tutorial <tutorial/TGLC_tutorial.ipynb>`_ shows the syntaxes and differences among these light curves in several examples.
|
|
27
|
-
|
|
28
|
-
==================================
|
|
29
|
-
Data Access
|
|
30
|
-
==================================
|
|
31
|
-
There are three data access methods:
|
|
32
|
-
|
|
33
|
-
* MAST Portal: Easiest for acquiring light curves for a few stars. However, new sectors are updated relatively slowly.
|
|
34
|
-
* MAST bulk download: Best for downloading light curves for all stars (<16 TESS magnitude) in a sectors.
|
|
35
|
-
* tglc package: Capable of producing similar quality light curves for any sector and any star with custom options.
|
|
36
|
-
|
|
37
|
-
MAST Portal/bulk download
|
|
38
|
-
----------------------------
|
|
39
|
-
The easiest usage requires no package installation. Simply follow the `TGLC HLSP page <https://archive.stsci.edu/hlsp/tglc>`_ to download light curves from MAST or use `MAST Portal <https://mast.stsci.edu/portal/Mashup/Clients/Mast/Portal.html>`_. Light curves are being fitted sector by sector and will be available on MAST gradually. MAST hosts all Gaia DR3 stars down to 16th magnitude. Each .fits file includes PSF and aperture light curves and their calibrated versions.
|
|
40
|
-
|
|
41
|
-
MAST available sectors: `sector worklist <https://docs.google.com/spreadsheets/d/1FhHElWb1wmx9asWiZecAJ2umN0-P_aXn55OBVB34_rg/edit?usp=sharing>`_
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
tglc package
|
|
45
|
-
----------------------------
|
|
46
|
-
Users can also fit light curves using the package tglc. Using tglc, one can specify a region, sector(s), and customized aperture shape if needed. It can also allow all field stars to float by assigning Gaussian priors, which can help decontaminate variable field stars. tglc is currently only available for linux. Run::
|
|
47
|
-
|
|
48
|
-
pip install tglc
|
|
49
|
-
|
|
50
|
-
for the latest tglc release. After installation, follow the `tutorial <tutorial/TGLC_tutorial.ipynb>`_ to fit light curves. If there is a problem, please leave a comment in the Issues section to help us improve. Thank you!
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
==================================
|
|
54
|
-
Known Problems
|
|
55
|
-
==================================
|
|
56
|
-
There are several imperfections we noticed in the MAST TGLC light curves and tglc package:
|
|
57
|
-
|
|
58
|
-
* If the star is very dim (~< 15 Tmag) near a variable source, it can make the aperture and/or PSF light curve negative for some cadences. The detrending algorithm could malfunction and result in bad cal_aper_flux and/or cal_psf_flux. This is now fixed for tglc package, but this problem remains for the primary mission light curves published on MAST. Please detrend again if necessary. The extended mission light curves on MAST will not be affected. This is a very rare scenario, but could be important.
|
|
59
|
-
|
|
60
|
-
==================================
|
|
61
|
-
Reference
|
|
62
|
-
==================================
|
|
63
|
-
If you find the TGLC light curves or the tglc package useful in your research, please cite `our paper <https://iopscience.iop.org/article/10.3847/1538-3881/acaaa7>`_ published on the Astronomical Journal.
|
|
64
|
-
|
|
65
|
-
Platform: UNKNOWN
|
|
66
|
-
Classifier: Programming Language :: Python :: 3
|
|
67
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
68
|
-
Classifier: Operating System :: OS Independent
|
|
69
|
-
Requires-Python: >=3.8
|
|
70
|
-
Description-Content-Type: text/x-rst
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|