tglc 0.6.1__tar.gz → 0.6.3__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.3/PKG-INFO ADDED
@@ -0,0 +1,70 @@
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
@@ -6,7 +6,7 @@ with open("README.rst", "r", encoding="utf-8") as fh:
6
6
  long_description = fh.read()
7
7
  setuptools.setup(
8
8
  name="tglc",
9
- version='0.6.1',
9
+ version='0.6.3',
10
10
  author="Te Han",
11
11
  author_email="tehanhunter@gmail.com",
12
12
  description="TESS-Gaia Light Curve",
@@ -0,0 +1,3 @@
1
+ __version__ = "0.6.3"
2
+ __author__ = 'Te Han, Timothy Brandt'
3
+ __credits__ = 'University of California, Santa Barbara'
@@ -204,6 +204,8 @@ class Source(object):
204
204
  self.time = np.array(time)
205
205
  median_time = np.median(self.time)
206
206
  interval = (median_time - 388.5) / 365.25
207
+ # Julian Day Number: 2457000.0 (TBJD=0)
208
+ # Calendar Date/Time: 2014-12-08 12:00:00 388.5 days before J2016
207
209
 
208
210
  num_gaia = len(catalogdata)
209
211
  tic_id = np.zeros(num_gaia)
@@ -14,6 +14,7 @@ from astroquery.mast import Catalogs
14
14
  import astropy.units as u
15
15
  from astropy.coordinates import SkyCoord
16
16
  from astroquery.mast import Tesscut
17
+ # Tesscut._service_api_connection.TIMEOUT = 6000
17
18
 
18
19
  # warnings.simplefilter('ignore', UserWarning)
19
20
  from threadpoolctl import ThreadpoolController, threadpool_limits
@@ -44,7 +45,7 @@ def tglc_lc(target='TIC 264468702', local_directory='', size=90, save_aper=True,
44
45
  elif last_sector_only:
45
46
  sector = 'last'
46
47
  print(f'Target: {target}')
47
- target_ = Catalogs.query_object(target, radius=21 * 0.707 / 3600, catalog="Gaia", version=2)
48
+ target_ = Catalogs.query_object(target, radius=42 * 0.707 / 3600, catalog="Gaia", version=2)
48
49
  if len(target_) == 0:
49
50
  target_ = Catalogs.query_object(target.name, radius=5 * 21 * 0.707 / 3600, catalog="Gaia", version=2)
50
51
  ra = target_[0]['ra']
@@ -160,8 +161,8 @@ def star_spliter(server=1, # or 2
160
161
  return
161
162
 
162
163
 
163
- def plot_lc(local_directory=None, type='cal_aper_flux'):
164
- files = glob(f'{local_directory}*.fits')
164
+ def plot_lc(local_directory=None, type='cal_aper_flux', xlow=None, xhigh=None, ylow=None, yhigh=None):
165
+ files = glob(f'{local_directory}lc/*.fits')
165
166
  os.makedirs(f'{local_directory}plots/', exist_ok=True)
166
167
  for i in range(len(files)):
167
168
  with fits.open(files[i], mode='denywrite') as hdul:
@@ -169,8 +170,8 @@ def plot_lc(local_directory=None, type='cal_aper_flux'):
169
170
  plt.figure(constrained_layout=False, figsize=(8, 4))
170
171
  plt.plot(hdul[1].data['time'], hdul[1].data[type], '.', c='silver', label=type)
171
172
  plt.plot(hdul[1].data['time'][q], hdul[1].data[type][q], '.k', label=f'{type}_flagged')
172
- # plt.xlim(2753, 2755)
173
- # plt.ylim(0.7, 1.1)
173
+ plt.xlim(xlow, xhigh)
174
+ plt.ylim(ylow, yhigh)
174
175
  plt.title(f'TIC_{hdul[0].header["TICID"]}_sector_{hdul[0].header["SECTOR"]:04d}_{type}')
175
176
  plt.legend()
176
177
  # plt.show()
@@ -297,30 +298,33 @@ def plot_pf_lc(local_directory=None, period=None, mid_transit_tbjd=None, type='c
297
298
 
298
299
  def plot_contamination(local_directory=None, gaia_dr3=None):
299
300
  files = glob(f'{local_directory}lc/*.fits')
300
- os.makedirs(f'{local_directory}lc/plots/', exist_ok=True)
301
+ os.makedirs(f'{local_directory}plots/', exist_ok=True)
301
302
  for i in range(len(files)):
302
- with open(glob(f'{local_directory}source/*.pkl')[0], 'rb') as input_:
303
- with fits.open(files[i], mode='denywrite') as hdul:
304
- sector = hdul[0].header['SECTOR']
303
+ with fits.open(files[i], mode='denywrite') as hdul:
304
+ sector = hdul[0].header['SECTOR']
305
+ with open(glob(f'{local_directory}source/*_{sector}.pkl')[0], 'rb') as input_:
305
306
  source = pickle.load(input_)
306
307
  source.select_sector(sector=sector)
307
308
  star_num = np.where(source.gaia['DESIGNATION'] == f'Gaia DR3 {gaia_dr3}')
309
+ plt.imshow(source.flux[0], origin='lower')
310
+ plt.show()
311
+ plt.close()
308
312
  # print(source.gaia[891])
309
- # print(source.gaia[140])
313
+ # print(source.gaia[star_num])
310
314
  nearby_stars = np.argsort(
311
315
  (source.gaia[f'sector_{sector}_x'][:500] - source.gaia[star_num][f'sector_{sector}_x']) ** 2 +
312
316
  (source.gaia[f'sector_{sector}_y'][:500] - source.gaia[star_num][f'sector_{sector}_y']) ** 2)[0:5]
313
317
  # print(f'sector = {source.sector}')
314
318
  star_x = source.gaia[star_num][f'sector_{sector}_x'][0]
315
319
  star_y = source.gaia[star_num][f'sector_{sector}_y'][0]
316
- max_flux = np.max(
317
- np.median(source.flux[:, round(star_y) - 2:round(star_y) + 3, round(star_x) - 2:round(star_x) + 3],
320
+ max_flux = np.nanmax(
321
+ np.nanmedian(source.flux[:, round(star_y) - 2:round(star_y) + 3, round(star_x) - 2:round(star_x) + 3],
318
322
  axis=0))
319
- fig = plt.figure(constrained_layout=False, figsize=(15, 7))
320
- gs = fig.add_gridspec(5, 10)
321
- gs.update(wspace=0.5, hspace=0.5)
323
+ fig = plt.figure(constrained_layout=False, figsize=(15, 5))
324
+ gs = fig.add_gridspec(5, 16)
325
+ gs.update(wspace=0.1, hspace=0.1)
322
326
  ax0 = fig.add_subplot(gs[:5, :5])
323
- ax0.imshow(source.flux[0], cmap='RdBu', vmin=-max_flux, vmax=max_flux, origin='lower')
327
+ ax0.imshow(np.median(source.flux, axis=0), cmap='RdBu', vmin=-max_flux, vmax=max_flux, origin='lower')
324
328
 
325
329
  ax0.scatter(source.gaia[f'sector_{sector}_x'][:500], source.gaia[f'sector_{sector}_y'][:500], s=50,
326
330
  c='r', label='background stars')
@@ -380,7 +384,7 @@ def plot_contamination(local_directory=None, gaia_dr3=None):
380
384
  np.median(source.flux[:, int(star_y) - 2:int(star_y) + 3, int(star_x) - 2:int(star_x) + 3], axis=0))
381
385
  for j in range(y_):
382
386
  for k in range(x_):
383
- ax_ = fig.add_subplot(gs[(4 - j), (5 + k)])
387
+ ax_ = fig.add_subplot(gs[(4 - j), (6 + 2 * k):(8 + 2 * k)])
384
388
  ax_.patch.set_facecolor('C0')
385
389
  ax_.patch.set_alpha(min(1, max(0, 5 * np.nanmedian(hdul[0].data[:, j, k]) / max_flux)))
386
390
  q = [a and b for a, b in
@@ -392,11 +396,29 @@ def plot_contamination(local_directory=None, gaia_dr3=None):
392
396
  cal_aper = (hdul[0].data[:, j, k][q] - np.nanmin(
393
397
  hdul[0].data[:, j, k][q]) + 1000 - trend) / np.nanmedian(
394
398
  hdul[0].data[:, j, k][q]) + 1
395
- ax_.plot(hdul[1].data['time'][q], cal_aper, '.k', ms=1, label='center pixel')
396
- ax_.set_ylim(0.95, 1.05)
397
- plt.savefig(f'{local_directory}lc/plots/contamination_sector_{hdul[0].header["SECTOR"]:04d}.pdf',
399
+ # ax_.plot(hdul[1].data['time'][q], cal_aper, '.k', ms=0.5)
400
+ ax_.plot(hdul[1].data['time'][q], hdul[0].data[:, j, k][q], '.k', ms=0.5)
401
+ # ax_.set_ylim(0.7, 1.3)
402
+ if j != 0:
403
+ ax_.set_xticklabels([])
404
+ if k != 0:
405
+ ax_.set_yticklabels([])
406
+
407
+ plt.savefig(f'{local_directory}plots/contamination_sector_{hdul[0].header["SECTOR"]:04d}.pdf',
398
408
  dpi=300)
399
- plt.show()
409
+ plt.close()
410
+
411
+
412
+ def plot_epsf(local_directory=None):
413
+ files = glob(f'{local_directory}epsf/*.npy')
414
+ os.makedirs(f'{local_directory}plots/', exist_ok=True)
415
+ for i in range(len(files)):
416
+ psf = np.load(files[i])
417
+ plt.imshow(psf[0, :23 ** 2].reshape(23, 23), cmap='bone', origin='lower')
418
+ plt.tick_params(axis='x', bottom=False)
419
+ plt.tick_params(axis='y', left=False)
420
+ plt.title(f'{files[i].split("/")[-1].split(".")[0]}')
421
+ plt.savefig(f'{local_directory}plots/{files[i].split("/")[-1]}.png', bbox_inches='tight', dpi=300)
400
422
 
401
423
 
402
424
  def choose_prior(tics, local_directory=None, priors=np.logspace(-5, 0, 100)):
@@ -429,21 +451,32 @@ def get_tglc_lc(tics=None, method='query', server=1, directory=None, prior=None)
429
451
  tglc_lc(target=target, local_directory=local_directory, size=90, save_aper=True, limit_mag=16,
430
452
  get_all_lc=False, first_sector_only=False, last_sector_only=False, sector=None, prior=prior,
431
453
  transient=None)
432
- plot_lc(local_directory=f'{directory}TIC {tics[i]}/lc/', type='cal_aper_flux')
454
+ plot_lc(local_directory=f'{directory}TIC {tics[i]}/', type='cal_aper_flux')
433
455
  if method == 'search':
434
456
  star_spliter(server=server, tics=tics, local_directory=directory)
435
457
 
436
458
 
437
459
  if __name__ == '__main__':
438
- tics = [56883709]
439
- directory = f'/home/tehan/Documents/GEMS/'
460
+ tics = [16005254]
461
+ directory = f'/home/tehan/Documents/tglc/'
440
462
  # directory = f'/home/tehan/data/cosmos/GEMS/'
441
463
  os.makedirs(directory, exist_ok=True)
442
- get_tglc_lc(tics=tics, method='query', server=1, directory=directory)
443
- plot_lc(local_directory=f'{directory}TIC {tics[0]}/lc/', type='cal_psf_flux')
444
- plot_lc(local_directory=f'{directory}TIC {tics[0]}/lc/', type='cal_aper_flux')
445
-
464
+ # get_tglc_lc(tics=tics, method='query', server=1, directory=directory)
465
+ plot_lc(local_directory=f'/home/tehan/Documents/tglc/TIC 16005254/', type='cal_aper_flux', ylow=0.9, yhigh=1.1)
466
+ plot_contamination(local_directory=f'{directory}TIC {tics[0]}/', gaia_dr3=5751990597042725632)
467
+ # plot_epsf(local_directory=f'{directory}TIC {tics[0]}/')
446
468
  # plot_pf_lc(local_directory=f'{directory}TIC {tics[0]}/lc/', period=0.71912603, mid_transit_tbjd=2790.58344,
447
469
  # type='cal_psf_flux')
448
470
  # plot_pf_lc(local_directory=f'{directory}TIC {tics[0]}/lc/', period=0.71912603, mid_transit_tbjd=2790.58344,
449
471
  # type='cal_aper_flux')
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)
@@ -0,0 +1,70 @@
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.1/PKG-INFO DELETED
@@ -1,69 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: tglc
3
- Version: 0.6.1
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
-
15
- ==================================
16
- Introduction
17
- ==================================
18
-
19
- 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.
20
-
21
- ==================================
22
- Usage
23
- ==================================
24
- There are four fluxes in each FITS file: aperture flux, PSF flux, calibrated aperture flux, and calibrated PSF flux.
25
- If you are uncertain which to use:
26
-
27
- * 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.
28
- * 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.
29
- * 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!
30
- * **If you are uncertain, start with calibrated aperture flux!**
31
-
32
- The `tutorial <tutorial/TGLC_tutorial.ipynb>`_ shows the syntaxes and differences among these light curves in several examples.
33
-
34
- ==================================
35
- Data Access
36
- ==================================
37
- There are three data access methods:
38
-
39
- * MAST Portal: Easiest for acquiring light curves for a few stars. However, new sectors are updated relatively slowly.
40
- * MAST bulk download: Best for downloading light curves for all stars (<16 TESS magnitude) in a sectors.
41
- * tglc package: Capable of producing similar quality light curves for any sector and any star with custom options.
42
-
43
- MAST Portal/bulk download
44
- ----------------------------
45
- 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.
46
-
47
- MAST available sectors: `sector worklist <https://docs.google.com/spreadsheets/d/1FhHElWb1wmx9asWiZecAJ2umN0-P_aXn55OBVB34_rg/edit?usp=sharing>`_
48
-
49
-
50
- tglc package
51
- ----------------------------
52
- 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::
53
-
54
- pip install tglc
55
-
56
- 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!
57
-
58
-
59
- ==================================
60
- Known Problems
61
- ==================================
62
- There are several imperfections we noticed in the MAST TGLC light curves and tglc package:
63
-
64
- * 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.
65
-
66
- ==================================
67
- Reference
68
- ==================================
69
- 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.
@@ -1,3 +0,0 @@
1
- __version__ = "0.6.1"
2
- __author__ = 'Te Han, Timothy Brandt'
3
- __credits__ = 'University of California, Santa Barbara'
@@ -1,69 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: tglc
3
- Version: 0.6.1
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
-
15
- ==================================
16
- Introduction
17
- ==================================
18
-
19
- 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.
20
-
21
- ==================================
22
- Usage
23
- ==================================
24
- There are four fluxes in each FITS file: aperture flux, PSF flux, calibrated aperture flux, and calibrated PSF flux.
25
- If you are uncertain which to use:
26
-
27
- * 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.
28
- * 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.
29
- * 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!
30
- * **If you are uncertain, start with calibrated aperture flux!**
31
-
32
- The `tutorial <tutorial/TGLC_tutorial.ipynb>`_ shows the syntaxes and differences among these light curves in several examples.
33
-
34
- ==================================
35
- Data Access
36
- ==================================
37
- There are three data access methods:
38
-
39
- * MAST Portal: Easiest for acquiring light curves for a few stars. However, new sectors are updated relatively slowly.
40
- * MAST bulk download: Best for downloading light curves for all stars (<16 TESS magnitude) in a sectors.
41
- * tglc package: Capable of producing similar quality light curves for any sector and any star with custom options.
42
-
43
- MAST Portal/bulk download
44
- ----------------------------
45
- 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.
46
-
47
- MAST available sectors: `sector worklist <https://docs.google.com/spreadsheets/d/1FhHElWb1wmx9asWiZecAJ2umN0-P_aXn55OBVB34_rg/edit?usp=sharing>`_
48
-
49
-
50
- tglc package
51
- ----------------------------
52
- 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::
53
-
54
- pip install tglc
55
-
56
- 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!
57
-
58
-
59
- ==================================
60
- Known Problems
61
- ==================================
62
- There are several imperfections we noticed in the MAST TGLC light curves and tglc package:
63
-
64
- * 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.
65
-
66
- ==================================
67
- Reference
68
- ==================================
69
- 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.
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
@@ -76,10 +76,10 @@ def ffi_to_source(sector=1, local_directory=''):
76
76
  if __name__ == '__main__':
77
77
  sector = 56
78
78
  ffi_to_source(sector=sector, local_directory=f'/home/tehan/data/sector{sector:04d}/')
79
+ # med_mask = median_mask(sector_num=26)
79
80
  # ffi_to_source(sector=sector, local_directory=f'/pdo/users/tehan/sector{sector:04d}/')
80
81
  # files = glob.glob(f'/home/tehan/data/sector{sector:04d}/source/*/source_00_00.pkl')
81
82
  # for i in range(len(files)):
82
83
  # with open(files[i], 'rb') as input_:
83
84
  # source = pickle.load(input_)
84
85
  # print(np.min(np.diff(source.cadence)), files[i])
85
- # med_mask = median_mask(sector_num=26)
File without changes
File without changes
File without changes
File without changes