tglc 0.6.5__py3-none-any.whl
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/__init__.py +3 -0
- tglc/background_mask/__init__.py +0 -0
- tglc/background_mask/median_mask.fits +0 -0
- tglc/effective_psf.py +484 -0
- tglc/ffi.py +376 -0
- tglc/ffi_cut.py +279 -0
- tglc/lc_plot.py +2662 -0
- tglc/mast.py +116 -0
- tglc/quick_lc.py +526 -0
- tglc/run.py +95 -0
- tglc/source_output.py +85 -0
- tglc/target_lightcurve.py +362 -0
- tglc-0.6.5.dist-info/LICENSE +21 -0
- tglc-0.6.5.dist-info/METADATA +80 -0
- tglc-0.6.5.dist-info/RECORD +17 -0
- tglc-0.6.5.dist-info/WHEEL +5 -0
- tglc-0.6.5.dist-info/top_level.txt +1 -0
tglc/lc_plot.py
ADDED
|
@@ -0,0 +1,2662 @@
|
|
|
1
|
+
import os
|
|
2
|
+
from glob import glob
|
|
3
|
+
import numpy as np
|
|
4
|
+
import matplotlib.pyplot as plt
|
|
5
|
+
import pickle
|
|
6
|
+
from wotan import flatten
|
|
7
|
+
from scipy import ndimage
|
|
8
|
+
from astropy.io import ascii
|
|
9
|
+
from astropy.io import fits
|
|
10
|
+
from tqdm import trange
|
|
11
|
+
from matplotlib.patches import ConnectionPatch
|
|
12
|
+
from tglc.target_lightcurve import epsf
|
|
13
|
+
from tglc.ffi_cut import ffi_cut
|
|
14
|
+
from tglc.quick_lc import tglc_lc
|
|
15
|
+
import matplotlib.patheffects as pe
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def load_eleanor(ld='', tic=1, sector=1):
|
|
19
|
+
eleanor_pca = np.load(ld + f'eleanor/TIC {tic}_{sector}_corr.npy')
|
|
20
|
+
eleanor_psf = np.load(ld + f'eleanor/TIC {tic}_{sector}_psf.npy')
|
|
21
|
+
eleanor_t = eleanor_pca[0]
|
|
22
|
+
eleanor_pca_f = flatten(eleanor_t, eleanor_pca[1] / np.nanmedian(eleanor_pca[1]), window_length=1,
|
|
23
|
+
method='biweight', return_trend=False)
|
|
24
|
+
try:
|
|
25
|
+
eleanor_psf_f = flatten(eleanor_t, eleanor_psf[1] / np.nanmedian(eleanor_psf[1]), window_length=1,
|
|
26
|
+
method='biweight', return_trend=False)
|
|
27
|
+
except:
|
|
28
|
+
eleanor_psf_f = np.zeros(len(eleanor_t))
|
|
29
|
+
if sector > 26:
|
|
30
|
+
eleanor_t = np.mean(eleanor_t[:len(eleanor_t) // 3 * 3].reshape(-1, 3), axis=1)
|
|
31
|
+
eleanor_pca_f = np.mean(eleanor_pca_f[:len(eleanor_pca_f) // 3 * 3].reshape(-1, 3), axis=1)
|
|
32
|
+
eleanor_psf_f = np.mean(eleanor_psf_f[:len(eleanor_psf_f) // 3 * 3].reshape(-1, 3), axis=1)
|
|
33
|
+
return eleanor_t, eleanor_pca_f, eleanor_psf_f
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def load_qlp(ld='', tic=1, sector=1):
|
|
37
|
+
qlp = fits.open(ld + f'HLSP/hlsp_qlp_tess_ffi_s{sector:04d}-{tic:016d}_tess_v01_llc/' +
|
|
38
|
+
f'hlsp_qlp_tess_ffi_s{sector:04d}-{tic:016d}_tess_v01_llc.fits', mode='denywrite')
|
|
39
|
+
quality = qlp[1].data['QUALITY']
|
|
40
|
+
index = np.where(quality == 0)
|
|
41
|
+
qlp_t = qlp[1].data['TIME'][index]
|
|
42
|
+
lc = qlp[1].data['KSPSAP_FLUX']
|
|
43
|
+
qlp_f = flatten(qlp_t, lc[index] / np.nanmedian(lc[index]), window_length=1, method='biweight',
|
|
44
|
+
return_trend=False)
|
|
45
|
+
if sector > 26:
|
|
46
|
+
qlp_t = np.mean(qlp_t[:len(qlp_t) // 3 * 3].reshape(-1, 3), axis=1)
|
|
47
|
+
qlp_f = np.mean(qlp_f[:len(qlp_f) // 3 * 3].reshape(-1, 3), axis=1)
|
|
48
|
+
return qlp_t, qlp_f
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def load_ztf(ld='', index=1):
|
|
52
|
+
data = ascii.read(ld + f'ZTF/{index}_g.csv')
|
|
53
|
+
data.remove_rows(np.where(data['catflags'] != 0))
|
|
54
|
+
ztf_g_t = data['hjd'] - 2457000
|
|
55
|
+
mag = data['mag']
|
|
56
|
+
ztf_g_flux = 10 ** (- mag / 2.5)
|
|
57
|
+
try:
|
|
58
|
+
data = ascii.read(ld + f'ZTF/{index}_r.csv')
|
|
59
|
+
data.remove_rows(np.where(data['catflags'] != 0))
|
|
60
|
+
ztf_r_t = data['hjd'] - 2457000
|
|
61
|
+
mag = data['mag']
|
|
62
|
+
ztf_r_flux = 10 ** (- mag / 2.5)
|
|
63
|
+
except:
|
|
64
|
+
return ztf_g_t, ztf_g_flux
|
|
65
|
+
return ztf_g_t, ztf_g_flux, ztf_r_t, ztf_r_flux
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def figure_1():
|
|
69
|
+
with open('/mnt/c/Users/tehan/Documents/GitHub/Searching-Eclipsing-Binaries-in-TESS/source_NGC_7654_90.pkl',
|
|
70
|
+
'rb') as input:
|
|
71
|
+
source = pickle.load(input)
|
|
72
|
+
period = 2.2895
|
|
73
|
+
t1_ = 435
|
|
74
|
+
t2_ = 455
|
|
75
|
+
t3_ = 940
|
|
76
|
+
|
|
77
|
+
t1 = 530
|
|
78
|
+
t2 = 555
|
|
79
|
+
t3 = 1080
|
|
80
|
+
|
|
81
|
+
time = np.load('/mnt/c/users/tehan/desktop/eleanor_time.npy')
|
|
82
|
+
eleanor_pca = np.load('/mnt/c/users/tehan/desktop/TIC_270023061.npy')
|
|
83
|
+
eleanor_PSF = np.load('/mnt/c/users/tehan/desktop/eleanor_PSF_1251.npy')
|
|
84
|
+
moffat = np.load('/mnt/c/users/tehan/desktop/moffat_1251.npy')
|
|
85
|
+
lightcurve = np.load('/mnt/c/users/tehan/desktop/lightcurves.npy')
|
|
86
|
+
qlp = fits.open(
|
|
87
|
+
'/mnt/c/users/tehan/desktop/hlsp_qlp_tess_ffi_s0017-0000000270023089_tess_v01_llc.fits')
|
|
88
|
+
qlp_data = qlp[1].data
|
|
89
|
+
|
|
90
|
+
bg_mod = lightcurve[1251][0] - np.median(source.flux[:, 10, 24] * source.gaia['tess_flux_ratio'][1251])
|
|
91
|
+
# epsf
|
|
92
|
+
flatten_lc, trend_lc = flatten(source.time, (lightcurve[1251] - bg_mod) / np.median((lightcurve[1251] - bg_mod)),
|
|
93
|
+
window_length=1,
|
|
94
|
+
method='biweight',
|
|
95
|
+
return_trend=True)
|
|
96
|
+
# moffat
|
|
97
|
+
flatten_lc_, trend_lc_ = flatten(source.time, (moffat - bg_mod) / np.median(moffat - bg_mod), window_length=1,
|
|
98
|
+
method='biweight',
|
|
99
|
+
return_trend=True)
|
|
100
|
+
# eleanor gaussian
|
|
101
|
+
flatten_lc__, trend_lc__ = flatten(time, eleanor_PSF / np.median(eleanor_PSF), window_length=1, method='biweight',
|
|
102
|
+
return_trend=True)
|
|
103
|
+
|
|
104
|
+
# eleanor pca
|
|
105
|
+
flatten_lc___, trend_lc___ = flatten(time, eleanor_pca / np.median(eleanor_pca), window_length=1, method='biweight',
|
|
106
|
+
return_trend=True)
|
|
107
|
+
|
|
108
|
+
# qlp
|
|
109
|
+
# flatten_lc___, trend_lc___ = flatten(qlp_data['TIME'], qlp_data['KSPSAP_FLUX'], window_length=1,
|
|
110
|
+
# method='biweight',
|
|
111
|
+
# return_trend=True)
|
|
112
|
+
|
|
113
|
+
fig = plt.figure(constrained_layout=False, figsize=(10, 6))
|
|
114
|
+
gs = fig.add_gridspec(4, 14)
|
|
115
|
+
gs.update(wspace=0.2, hspace=0.4)
|
|
116
|
+
ax1 = fig.add_subplot(gs[0, 0:5])
|
|
117
|
+
ax2 = fig.add_subplot(gs[1, 0:5])
|
|
118
|
+
# ax3 = fig.add_subplot(gs[2, 0:5])
|
|
119
|
+
ax4 = fig.add_subplot(gs[2, 0:5])
|
|
120
|
+
ax5 = fig.add_subplot(gs[3, 0:5])
|
|
121
|
+
|
|
122
|
+
ax6 = fig.add_subplot(gs[0, 5:10])
|
|
123
|
+
ax7 = fig.add_subplot(gs[1, 5:10])
|
|
124
|
+
# ax8 = fig.add_subplot(gs[2, 5:10])
|
|
125
|
+
ax9 = fig.add_subplot(gs[2, 5:10])
|
|
126
|
+
ax10 = fig.add_subplot(gs[3, 5:10])
|
|
127
|
+
|
|
128
|
+
ax11 = fig.add_subplot(gs[0, 11:])
|
|
129
|
+
ax12 = fig.add_subplot(gs[1, 11:])
|
|
130
|
+
# ax13 = fig.add_subplot(gs[2, 12:])
|
|
131
|
+
|
|
132
|
+
ax1.plot(time, flatten_lc___ / np.median(flatten_lc___), '.k', ms=1)
|
|
133
|
+
ax2.plot(time, flatten_lc__, '.k', ms=1)
|
|
134
|
+
# ax3.plot(qlp_data['TIME'], qlp_data['KSPSAP_FLUX'], '.k', ms=1)
|
|
135
|
+
ax4.plot(source.time, flatten_lc_, '.k', ms=1)
|
|
136
|
+
ax5.plot(source.time, flatten_lc, '.k', ms=1)
|
|
137
|
+
|
|
138
|
+
ax6.plot(time[0:t1_] % period / period, flatten_lc___[0:t1_] / np.median(flatten_lc___), '.k', ms=1)
|
|
139
|
+
ax6.plot(time[t2_:t3_] % period / period, flatten_lc___[t2_:t3_] / np.median(flatten_lc___), '.k', ms=1)
|
|
140
|
+
ax7.plot(time[0:t1_] % period / period, flatten_lc__[0:t1_], '.k', ms=1)
|
|
141
|
+
ax7.plot(time[t2_:t3_] % period / period, flatten_lc__[t2_:t3_], '.k', ms=1)
|
|
142
|
+
# ax8.plot(qlp_data['TIME'] % period, qlp_data['KSPSAP_FLUX'], '.k', ms=1)
|
|
143
|
+
ax9.plot(source.time[0:t1] % period / period, flatten_lc_[0:t1], '.k', ms=1)
|
|
144
|
+
ax9.plot(source.time[t2:t3] % period / period, flatten_lc_[t2:t3], '.k', ms=1)
|
|
145
|
+
ax10.plot(source.time[0:t1] % period / period, flatten_lc[0:t1], '.k', ms=1)
|
|
146
|
+
ax10.plot(source.time[t2:t3] % period / period, flatten_lc[t2:t3], '.k', ms=1)
|
|
147
|
+
ax11.plot(time[0:t1_] % period / period, flatten_lc___[0:t1_] / np.median(flatten_lc___), '.k', ms=1, zorder=3)
|
|
148
|
+
ax11.plot(time[t2_:t3_] % period / period, flatten_lc___[t2_:t3_] / np.median(flatten_lc___), '.k', ms=1, zorder=3)
|
|
149
|
+
ax12.plot(time[0:t1_] % period / period, flatten_lc__[0:t1_], '.k', ms=1, zorder=3)
|
|
150
|
+
ax12.plot(time[t2_:t3_] % period / period, flatten_lc__[t2_:t3_], '.k', ms=1, zorder=3, label='TESS')
|
|
151
|
+
# ax13.plot(qlp_data['TIME'] % period/period, qlp_data['KSPSAP_FLUX'], '.k', ms=1, label='TESS', zorder=3)
|
|
152
|
+
|
|
153
|
+
data = ascii.read(f'/mnt/d/Astro/Output of SEBIT/eb_candidate_new/ZTF/1251_g.csv')
|
|
154
|
+
data.remove_rows(np.where(data['catflags'] != 0))
|
|
155
|
+
tbjd = data['hjd'] - 2457000
|
|
156
|
+
mag = data['mag']
|
|
157
|
+
flux = 10 ** (- mag / 2.5) # 3.208e-10 *
|
|
158
|
+
ax6.plot(tbjd % period / period, flux / np.median(flux), 'x', color='green', ms=3, label='ZTF g-band')
|
|
159
|
+
ax7.plot(tbjd % period / period, flux / np.median(flux), 'x', color='green', ms=3, label='ZTF g-band')
|
|
160
|
+
# ax8.plot(tbjd % period, flux / np.median(flux), 'x', color='green', ms=3, label='ZTF g-band')
|
|
161
|
+
ax9.plot(tbjd % period / period, flux / np.median(flux), 'x', color='green', ms=3, label='ZTF g-band')
|
|
162
|
+
ax10.plot(tbjd % period / period, flux / np.median(flux), 'x', color='green', ms=3, label='ZTF g-band')
|
|
163
|
+
ax11.plot(tbjd % period / period, flux / np.median(flux), 'x', color='green', ms=3, label='ZTF g-band')
|
|
164
|
+
ax12.plot(tbjd % period / period, flux / np.median(flux), 'x', color='green', ms=3, label='ZTF g-band')
|
|
165
|
+
# ax13.plot(tbjd % period, flux / np.median(flux), 'x', color='green', ms=3, label='ZTF g-band')
|
|
166
|
+
|
|
167
|
+
data = ascii.read(f'/mnt/d/Astro/Output of SEBIT/eb_candidate_new/ZTF/1251_r.csv')
|
|
168
|
+
data.remove_rows(np.where(data['catflags'] != 0))
|
|
169
|
+
tbjd = data['hjd'] - 2457000
|
|
170
|
+
mag = data['mag']
|
|
171
|
+
flux = 10 ** (- mag / 2.5)
|
|
172
|
+
ax6.scatter(tbjd % period / period, flux / np.median(flux), facecolors='none', edgecolors='orangered', s=5,
|
|
173
|
+
label='ZTF r-band')
|
|
174
|
+
ax7.scatter(tbjd % period / period, flux / np.median(flux), facecolors='none', edgecolors='orangered', s=5,
|
|
175
|
+
label='ZTF r-band')
|
|
176
|
+
# ax8.scatter(tbjd % period, flux / np.median(flux), facecolors='none', edgecolors='orangered', s=5,
|
|
177
|
+
# label='ZTF r-band')
|
|
178
|
+
ax9.scatter(tbjd % period / period, flux / np.median(flux), facecolors='none', edgecolors='orangered', s=5,
|
|
179
|
+
label='ZTF r-band')
|
|
180
|
+
ax10.scatter(tbjd % period / period, flux / np.median(flux), facecolors='none', edgecolors='orangered', s=5,
|
|
181
|
+
label='ZTF r-band')
|
|
182
|
+
ax11.scatter(tbjd % period / period, flux / np.median(flux), facecolors='none', edgecolors='orangered', s=5,
|
|
183
|
+
label='ZTF r-band')
|
|
184
|
+
ax12.scatter(tbjd % period / period, flux / np.median(flux), facecolors='none', edgecolors='orangered', s=5,
|
|
185
|
+
label='ZTF r-band')
|
|
186
|
+
# ax13.scatter(tbjd % period, flux / np.median(flux), facecolors='none', edgecolors='orangered', s=5,
|
|
187
|
+
# label='ZTF r-band')
|
|
188
|
+
|
|
189
|
+
ax1.set_title('eleanor PCA', loc='left')
|
|
190
|
+
ax2.set_title('eleanor PSF', loc='left')
|
|
191
|
+
# ax3.set_title('QLP KSPSAP', loc='left')
|
|
192
|
+
ax4.set_title('Moffat PSF', loc='left')
|
|
193
|
+
ax5.set_title('effective PSF', loc='left')
|
|
194
|
+
ax1.set_xticklabels([])
|
|
195
|
+
ax1.tick_params(axis="both", direction="in")
|
|
196
|
+
ax2.set_xticklabels([])
|
|
197
|
+
ax2.tick_params(axis="both", direction="in")
|
|
198
|
+
# ax3.set_xticklabels([])
|
|
199
|
+
# ax3.tick_params(axis="both", direction="in")
|
|
200
|
+
ax4.set_xticklabels([])
|
|
201
|
+
ax4.tick_params(axis="both", direction="in")
|
|
202
|
+
ax6.set_xticklabels([])
|
|
203
|
+
ax6.set_yticklabels([])
|
|
204
|
+
ax6.tick_params(axis="both", direction="in")
|
|
205
|
+
ax7.set_xticklabels([])
|
|
206
|
+
ax7.set_yticklabels([])
|
|
207
|
+
ax7.tick_params(axis="both", direction="in")
|
|
208
|
+
# ax8.set_xticklabels([])
|
|
209
|
+
# ax8.set_yticklabels([])
|
|
210
|
+
# ax8.tick_params(axis="both", direction="in")
|
|
211
|
+
ax9.set_xticklabels([])
|
|
212
|
+
ax9.set_yticklabels([])
|
|
213
|
+
ax9.tick_params(axis="both", direction="in")
|
|
214
|
+
|
|
215
|
+
ax5.tick_params(axis="both", direction="in")
|
|
216
|
+
ax10.set_yticklabels([])
|
|
217
|
+
ax10.tick_params(axis="both", direction="in")
|
|
218
|
+
ax11.set_ylabel('Normalized Flux')
|
|
219
|
+
ax11.tick_params(axis="both", direction="in")
|
|
220
|
+
ax11.yaxis.set_label_position("right")
|
|
221
|
+
ax11.yaxis.tick_right()
|
|
222
|
+
ax11.set_xticklabels([])
|
|
223
|
+
ax12.set_ylabel('Normalized Flux')
|
|
224
|
+
ax12.tick_params(axis="both", direction="in")
|
|
225
|
+
ax12.yaxis.set_label_position("right")
|
|
226
|
+
ax12.yaxis.tick_right()
|
|
227
|
+
# ax12.set_xticklabels([])
|
|
228
|
+
# ax13.set_ylabel('Normalized Flux')
|
|
229
|
+
# ax13.tick_params(axis="both", direction="in")
|
|
230
|
+
# ax13.yaxis.set_label_position("right")
|
|
231
|
+
# ax13.yaxis.tick_right()
|
|
232
|
+
|
|
233
|
+
ax1.set_ylabel('Normalized Flux')
|
|
234
|
+
ax2.set_ylabel('Normalized Flux')
|
|
235
|
+
# ax3.set_ylabel('Normalized Flux')
|
|
236
|
+
ax4.set_ylabel('Normalized Flux')
|
|
237
|
+
ax5.set_ylabel('Normalized Flux')
|
|
238
|
+
# ax1.set_xlabel('TBJD')
|
|
239
|
+
# ax2.set_xlabel('TBJD')
|
|
240
|
+
# ax3.set_xlabel('TBJD')
|
|
241
|
+
# ax4.set_xlabel('TBJD')
|
|
242
|
+
ax5.set_xlabel('TBJD')
|
|
243
|
+
# ax6.set_xlabel('Phase (days)')
|
|
244
|
+
# ax7.set_xlabel('Phase (days)')
|
|
245
|
+
# ax8.set_xlabel('Phase (days)')
|
|
246
|
+
# ax9.set_xlabel('Phase (days)')
|
|
247
|
+
ax10.set_xlabel('Phase')
|
|
248
|
+
ax12.set_xlabel('Phase')
|
|
249
|
+
|
|
250
|
+
ax1.set_ylim(0.65, 1.1)
|
|
251
|
+
ax6.set_ylim(0.65, 1.1)
|
|
252
|
+
ax2.set_ylim(0.65, 1.1)
|
|
253
|
+
ax7.set_ylim(0.65, 1.1)
|
|
254
|
+
# ax3.set_ylim(0.65, 1.1)
|
|
255
|
+
# ax8.set_ylim(0.65, 1.1)
|
|
256
|
+
ax4.set_ylim(0.65, 1.1)
|
|
257
|
+
ax9.set_ylim(0.65, 1.1)
|
|
258
|
+
ax5.set_ylim(0.65, 1.1)
|
|
259
|
+
ax10.set_ylim(0.65, 1.1)
|
|
260
|
+
ax11.set_ylim(0.993, 1.006)
|
|
261
|
+
ax12.set_ylim(0.993, 1.006)
|
|
262
|
+
# ax13.set_ylim(0.993, 1.006)
|
|
263
|
+
|
|
264
|
+
ax1.plot(time[t3_:], flatten_lc___[t3_:] / np.median(flatten_lc___), '.', c='silver', ms=2)
|
|
265
|
+
ax1.plot(time[t1_:t2_], flatten_lc___[t1_:t2_] / np.median(flatten_lc___), '.', c='silver', ms=1)
|
|
266
|
+
ax2.plot(time[t3_:], flatten_lc__[t3_:], '.', c='silver', ms=1)
|
|
267
|
+
ax2.plot(time[t1_:t2_], flatten_lc__[t1_:t2_], '.', c='silver', ms=1)
|
|
268
|
+
ax4.plot(source.time[t3:], flatten_lc_[t3:], '.', c='silver', ms=1)
|
|
269
|
+
ax4.plot(source.time[t1:t2], flatten_lc_[t1:t2], '.', c='silver', ms=1)
|
|
270
|
+
ax5.plot(source.time[t3:], flatten_lc[t3:], '.', c='silver', ms=1)
|
|
271
|
+
ax5.plot(source.time[t1:t2], flatten_lc[t1:t2], '.', c='silver', ms=1)
|
|
272
|
+
con1 = ConnectionPatch(xyA=(ax6.get_xlim()[1], 1.006), xyB=(ax11.get_xlim()[0], 1.006), coordsA="data",
|
|
273
|
+
coordsB="data", axesA=ax6,
|
|
274
|
+
axesB=ax11, color="k")
|
|
275
|
+
con2 = ConnectionPatch(xyA=(ax6.get_xlim()[1], 0.993), xyB=(ax11.get_xlim()[0], 0.993), coordsA="data",
|
|
276
|
+
coordsB="data", axesA=ax6,
|
|
277
|
+
axesB=ax11, color="k")
|
|
278
|
+
ax6.add_artist(con1)
|
|
279
|
+
ax6.add_artist(con2)
|
|
280
|
+
con1 = ConnectionPatch(xyA=(ax7.get_xlim()[1], 1.006), xyB=(ax12.get_xlim()[0], 1.006), coordsA="data",
|
|
281
|
+
coordsB="data", axesA=ax7,
|
|
282
|
+
axesB=ax12, color="k")
|
|
283
|
+
con2 = ConnectionPatch(xyA=(ax7.get_xlim()[1], 0.993), xyB=(ax12.get_xlim()[0], 0.993), coordsA="data",
|
|
284
|
+
coordsB="data", axesA=ax7,
|
|
285
|
+
axesB=ax12, color="k")
|
|
286
|
+
ax7.add_artist(con1)
|
|
287
|
+
ax7.add_artist(con2)
|
|
288
|
+
# con1 = ConnectionPatch(xyA=(ax8.get_xlim()[1], 1.006), xyB=(ax13.get_xlim()[0], 1.006), coordsA="data",
|
|
289
|
+
# coordsB="data", axesA=ax8,
|
|
290
|
+
# axesB=ax13, color="k")
|
|
291
|
+
# con2 = ConnectionPatch(xyA=(ax8.get_xlim()[1], 0.993), xyB=(ax13.get_xlim()[0], 0.993), coordsA="data",
|
|
292
|
+
# coordsB="data", axesA=ax8,
|
|
293
|
+
# axesB=ax13, color="k")
|
|
294
|
+
# ax8.add_artist(con1)
|
|
295
|
+
# ax8.add_artist(con2)
|
|
296
|
+
ax12.legend(bbox_to_anchor=(1, -1.7), loc=1)
|
|
297
|
+
plt.savefig('/mnt/c/users/tehan/desktop/light_curve_comparison_1251.png', bbox_inches='tight', dpi=300)
|
|
298
|
+
plt.show()
|
|
299
|
+
plt.close()
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
def figure_2():
|
|
303
|
+
with open('/mnt/c/Users/tehan/Documents/GitHub/Searching-Eclipsing-Binaries-in-TESS/source_NGC_7654_90.pkl',
|
|
304
|
+
'rb') as input:
|
|
305
|
+
source = pickle.load(input)
|
|
306
|
+
lightcurve = np.load('/mnt/c/users/tehan/desktop/lightcurves.npy')
|
|
307
|
+
|
|
308
|
+
def flatten_lc(source, lightcurve, index, bg_mod=0):
|
|
309
|
+
flatten_lc = flatten(source.time, (lightcurve[index] - bg_mod) / (np.median(lightcurve[index]) - bg_mod),
|
|
310
|
+
window_length=1,
|
|
311
|
+
method='biweight',
|
|
312
|
+
return_trend=False)
|
|
313
|
+
return flatten_lc
|
|
314
|
+
|
|
315
|
+
index = [699, 77, 1251, 469, 1585]
|
|
316
|
+
period = [1.01968, 1.9221, 2.2895, 6.126, 6.558]
|
|
317
|
+
lc = np.zeros((len(index), len(source.time)))
|
|
318
|
+
for i in range(len(index)):
|
|
319
|
+
lc[i] = flatten_lc(source, lightcurve, index[i])
|
|
320
|
+
if i == 2:
|
|
321
|
+
print(
|
|
322
|
+
lightcurve[index[i]][0] - np.median(source.flux[:, 10, 24] * source.gaia['tess_flux_ratio'][index[i]]))
|
|
323
|
+
lc[i] = flatten_lc(source, lightcurve, index[i], bg_mod=
|
|
324
|
+
lightcurve[index[i]][0] - np.median(source.flux[:, 10, 24] * source.gaia['tess_flux_ratio'][index[i]]))
|
|
325
|
+
|
|
326
|
+
fig = plt.figure(constrained_layout=False, figsize=(10, 9))
|
|
327
|
+
gs = fig.add_gridspec(len(index), 4)
|
|
328
|
+
gs.update(wspace=0.2, hspace=0.6)
|
|
329
|
+
t1 = 530
|
|
330
|
+
t2 = 555
|
|
331
|
+
t3 = 1080
|
|
332
|
+
for i in range(len(index)):
|
|
333
|
+
ax1 = fig.add_subplot(gs[i, 0:2])
|
|
334
|
+
ax2 = fig.add_subplot(gs[i, 2:])
|
|
335
|
+
ax1.plot(source.time, lc[i], '.k', ms=1, zorder=0)
|
|
336
|
+
ax1.scatter(source.time[t3:], lc[i][t3:], marker='x', c='r', s=7, linewidths=0.5)
|
|
337
|
+
ax1.scatter(source.time[t1:t2], lc[i][t1:t2], marker='x', c='r', s=7, linewidths=0.5, label='TESS outliers')
|
|
338
|
+
# ax1.plot(source.time[t2:t2 + 500], lc[i][t2:t2 + 500], '.', c='C0', ms=3)
|
|
339
|
+
ax2.plot(source.time[0:t1] % period[i], lc[i][0:t1], '.k', ms=1)
|
|
340
|
+
ax2.plot(source.time[t2:t3] % period[i], lc[i][t2:t3], '.k', ms=1, label='TESS')
|
|
341
|
+
ax1.tick_params(axis="both", direction="in")
|
|
342
|
+
ax2.set_yticklabels([])
|
|
343
|
+
ax2.tick_params(axis="both", direction="in")
|
|
344
|
+
|
|
345
|
+
ylim = ax2.get_ylim()
|
|
346
|
+
ax2.set_ylim((ylim[0] - 0.02, ylim[1] + 0.02))
|
|
347
|
+
ylim = ax2.get_ylim()
|
|
348
|
+
ax1.set_ylim(ylim)
|
|
349
|
+
try:
|
|
350
|
+
data = ascii.read(f'/mnt/c/users/tehan/desktop/eb_candidate_new/ZTF/{index[i]}_g.csv')
|
|
351
|
+
data.remove_rows(np.where(data['catflags'] != 0))
|
|
352
|
+
tbjd = data['hjd'] - 2457000
|
|
353
|
+
mag = data['mag']
|
|
354
|
+
flux = 10 ** (- mag / 2.5) # 3.208e-10 *
|
|
355
|
+
ax2_ = ax2.twinx()
|
|
356
|
+
ax2_.plot(tbjd % period[i], flux / np.median(flux), 'x', color='green', ms=3, label='ZTF g-band')
|
|
357
|
+
# ax2_.set_ylabel('ZTF mag')
|
|
358
|
+
ax2_.set_ylim(ylim)
|
|
359
|
+
ax2_.get_yaxis().set_visible(False)
|
|
360
|
+
# ax2_.tick_params(axis='y', colors='k')
|
|
361
|
+
except:
|
|
362
|
+
pass
|
|
363
|
+
try:
|
|
364
|
+
data = ascii.read(f'/mnt/d/Astro/Output of SEBIT/eb_candidate_new/ZTF/{index[i]}_r.csv')
|
|
365
|
+
data.remove_rows(np.where(data['catflags'] != 0))
|
|
366
|
+
tbjd = data['hjd'] - 2457000
|
|
367
|
+
mag = data['mag']
|
|
368
|
+
flux = 10 ** ((4.74 - mag) / 2.5)
|
|
369
|
+
ax2__ = ax2.twinx()
|
|
370
|
+
ax2__.scatter(tbjd % period[i], flux / np.median(flux), facecolors='none', edgecolors='orangered', s=5,
|
|
371
|
+
label='ZTF r-band')
|
|
372
|
+
ax2__.set_ylim(ylim)
|
|
373
|
+
ax2__.get_yaxis().set_visible(False)
|
|
374
|
+
if i == 2:
|
|
375
|
+
ax2.set_ylim([0.65, 1.1])
|
|
376
|
+
ax2_.set_ylim([0.65, 1.1])
|
|
377
|
+
ax2__.set_ylim([0.65, 1.1])
|
|
378
|
+
except:
|
|
379
|
+
pass
|
|
380
|
+
if i == 4:
|
|
381
|
+
ax1.set_xlabel('TBJD', labelpad=0)
|
|
382
|
+
ax1.set_ylabel('Normalized Flux', labelpad=0)
|
|
383
|
+
ax2.set_xlabel('Phase (days)', labelpad=0)
|
|
384
|
+
ax1.set_title(f'{source.gaia[index[i]]["designation"]}', loc='left')
|
|
385
|
+
ax2.set_title(f'P = {period[i]}' + f' TESS magnitude = {source.gaia[index[i]]["tess_mag"]:.2f}')
|
|
386
|
+
ax1.legend(bbox_to_anchor=(0.9, -.35))
|
|
387
|
+
ax2.legend(bbox_to_anchor=(-.8, -.35))
|
|
388
|
+
ax2_.legend(bbox_to_anchor=(0.5, -.35))
|
|
389
|
+
ax2__.legend(bbox_to_anchor=(.9, -.35))
|
|
390
|
+
# plt.savefig(f'/mnt/c/users/tehan/desktop/EBs.png', bbox_inches='tight', dpi=300)
|
|
391
|
+
plt.show()
|
|
392
|
+
plt.close()
|
|
393
|
+
|
|
394
|
+
|
|
395
|
+
def eleanor(tic, local_directory=''):
|
|
396
|
+
sector = 17
|
|
397
|
+
star = eleanor.Source(tic=tic, sector=int(sector))
|
|
398
|
+
data = eleanor.TargetData(star, height=15, width=15, bkg_size=31, do_psf=True, do_pca=True)
|
|
399
|
+
q = data.quality == 0
|
|
400
|
+
np.save(f'{local_directory}TIC{tic}_{sector}_corr.npy', np.array([data.time[q], data.corr_flux[q]]))
|
|
401
|
+
|
|
402
|
+
|
|
403
|
+
def figure_3():
|
|
404
|
+
target = '21.0607 34.4578'
|
|
405
|
+
# target = 'TOI 519'
|
|
406
|
+
local_directory = f'/home/tehan/Documents/tglc/{target}/'
|
|
407
|
+
# os.makedirs(local_directory, exist_ok=True)
|
|
408
|
+
# tglc_lc(target=target, local_directory=local_directory, size=90, save_aper=False, limit_mag=20,
|
|
409
|
+
# get_all_lc=True, first_sector_only=False, sector=17)
|
|
410
|
+
files = glob(f'{local_directory}lc/*.fits')
|
|
411
|
+
print(len(files))
|
|
412
|
+
tic = np.zeros((len(files), 2))
|
|
413
|
+
for i in range(len(files)):
|
|
414
|
+
with fits.open(files[i], mode='denywrite') as hdul:
|
|
415
|
+
try:
|
|
416
|
+
tic[i] = [int(hdul[0].header['TICID']), hdul[0].header['TESSMAG']]
|
|
417
|
+
except:
|
|
418
|
+
pass
|
|
419
|
+
np.save(f'/home/tehan/Documents/tglc/{target}/tic.npy', tic)
|
|
420
|
+
# tic = np.load(f'/home/tehan/Documents/tglc/{target}/tic.npy')
|
|
421
|
+
|
|
422
|
+
# 1-1/07_07 # 21.0607 34.4578 # 90
|
|
423
|
+
noise_2015 = ascii.read('/home/tehan/Documents/tglc/prior_mad/noisemodel.dat')
|
|
424
|
+
qlp_file = glob(f'{local_directory}QLP/HLSP/*/*.fits')
|
|
425
|
+
# ele_file = glob(f'{local_directory}lc_eleanor_psf/*.npy')
|
|
426
|
+
|
|
427
|
+
mag_qlp = []
|
|
428
|
+
median_diff_qlp = []
|
|
429
|
+
for i in trange(len(qlp_file)):
|
|
430
|
+
with fits.open(qlp_file[i], mode='denywrite') as hdul:
|
|
431
|
+
quality = hdul[1].data['QUALITY']
|
|
432
|
+
lc = hdul[1].data['KSPSAP_FLUX']
|
|
433
|
+
mag_ = hdul[0].header['TESSMAG']
|
|
434
|
+
scale = 1.5e4 * 10 ** ((10 - mag_) / 2.5)
|
|
435
|
+
index = np.where(quality == 0)
|
|
436
|
+
mag_qlp.append(mag_)
|
|
437
|
+
median_diff_qlp.append(np.nanmedian(np.abs(np.diff(lc[index]))))
|
|
438
|
+
mag_ele = []
|
|
439
|
+
median_diff_ele = []
|
|
440
|
+
# diff = []
|
|
441
|
+
# for i in trange(len(ele_file)):
|
|
442
|
+
# lc = np.load(ele_file[i])[1]
|
|
443
|
+
# tic_id = int(os.path.basename(ele_file[i]).split(' ')[-1][:-10])
|
|
444
|
+
# mag_ = tic[np.where(tic[:, 0] == tic_id)[0][0], 1]
|
|
445
|
+
# mag_ele.append(mag_)
|
|
446
|
+
# scale = 1.5e4 * 10 ** ((10 - mag_) / 2.5)
|
|
447
|
+
# median_diff_ele.append(np.nanmedian(np.abs(np.diff(lc))) / scale)
|
|
448
|
+
# diff.append((scale - np.median(lc))/scale)
|
|
449
|
+
#
|
|
450
|
+
# plt.plot(mag_ele, diff, '.')
|
|
451
|
+
# plt.ylim(-50, 50)
|
|
452
|
+
# plt.show()
|
|
453
|
+
tglc_mag = np.load(f'/home/tehan/Documents/tglc/{target}/mag.npy')
|
|
454
|
+
mag_both = np.load(f'/home/tehan/Documents/tglc/{target}/mag_both.npy')
|
|
455
|
+
MAD_aper = np.load(f'/home/tehan/Documents/tglc/{target}/MAD_aper.npy')
|
|
456
|
+
# AAD_aper = np.load(f'/home/tehan/Documents/tglc/{target}/AAD_aper.npy')
|
|
457
|
+
MAD_psf = np.load(f'/home/tehan/Documents/tglc/{target}/MAD_psf.npy')
|
|
458
|
+
# AAD_psf = np.load(f'/home/tehan/Documents/tglc/{target}/AAD_psf.npy')
|
|
459
|
+
MAD_both = np.load(f'/home/tehan/Documents/tglc/{target}/MAD_both.npy')
|
|
460
|
+
|
|
461
|
+
aper_precision = 1.48 * MAD_aper / (np.sqrt(2) * 1.5e4 * 10 ** ((10 - tglc_mag) / 2.5))
|
|
462
|
+
psf_precision = 1.48 * MAD_psf / (np.sqrt(2) * 1.5e4 * 10 ** ((10 - tglc_mag) / 2.5))
|
|
463
|
+
aver_precision = 1.48 * MAD_both / (np.sqrt(2) * 1.5e4 * 10 ** ((10 - mag_both) / 2.5))
|
|
464
|
+
qlp_precision = 1.48 * np.array(median_diff_qlp) / np.sqrt(2)
|
|
465
|
+
ele_precision = 1.48 * np.array(median_diff_ele) / np.sqrt(2)
|
|
466
|
+
|
|
467
|
+
fig, ax = plt.subplots(2, 2, sharex=True, gridspec_kw=dict(height_ratios=[3, 2], hspace=0.1, wspace=0.05),
|
|
468
|
+
figsize=(10, 5))
|
|
469
|
+
ax[0, 0].plot(mag_both, aver_precision, 'D', c='tomato', ms=1, label='TGLC Weighted', alpha=0.9)
|
|
470
|
+
# ax[0].plot(mag_ele, ele_precision, '^', c='C0', ms=1.5, label='eleanor PSF', alpha=0.4)
|
|
471
|
+
ax[0, 0].plot(mag_qlp, qlp_precision, '^', c='teal', ms=1.5, label='QLP', alpha=0.9)
|
|
472
|
+
|
|
473
|
+
# ax[0].plot(tglc_mag, aper_precision, 'D', c='k', ms=1, label='TGLC PSF', alpha=0.8)
|
|
474
|
+
ax[0, 0].plot(noise_2015['col1'], noise_2015['col2'], c='k', ms=1.5, label='Sullivan (2015)', alpha=1)
|
|
475
|
+
# # ax[0].plot(mean_diff_aper[0], aper_precision, 'D', c='r', ms=1, label='TGLC Aper', alpha=0.8)
|
|
476
|
+
ax[0, 0].hlines(y=.1, xmin=8, xmax=np.max(tglc_mag), colors='k', linestyles='dotted')
|
|
477
|
+
ax[0, 0].hlines(y=.01, xmin=8, xmax=np.max(tglc_mag), colors='k', linestyles='dotted')
|
|
478
|
+
|
|
479
|
+
leg = ax[0, 0].legend(loc=4, markerscale=4, fontsize=8)
|
|
480
|
+
for lh in leg.legendHandles:
|
|
481
|
+
lh.set_alpha(1)
|
|
482
|
+
ax[0, 0].set_ylabel(r'Estimated Photometric Precision')
|
|
483
|
+
ax[0, 0].set_yscale('log')
|
|
484
|
+
ax[0, 0].set_ylim(1e-4, 1)
|
|
485
|
+
ax[0, 0].set_title('Sparse Field')
|
|
486
|
+
|
|
487
|
+
psf_ratio = psf_precision / aver_precision
|
|
488
|
+
psf_tglc_mag = tglc_mag[np.invert(np.isnan(psf_ratio))]
|
|
489
|
+
psf_ratio = psf_ratio[np.invert(np.isnan(psf_ratio))]
|
|
490
|
+
psf_runningmed = ndimage.median_filter(psf_ratio, size=250, mode='nearest')
|
|
491
|
+
|
|
492
|
+
aper_ratio = aper_precision / aver_precision
|
|
493
|
+
aper_tglc_mag = tglc_mag[np.invert(np.isnan(aper_ratio))]
|
|
494
|
+
aper_ratio = aper_ratio[np.invert(np.isnan(aper_ratio))]
|
|
495
|
+
aper_runningmed = ndimage.median_filter(aper_ratio, size=300, mode='nearest')
|
|
496
|
+
|
|
497
|
+
ax[1, 0].plot(psf_tglc_mag[:-100], psf_ratio[:-100], '.', c='C1', ms=6, alpha=0.15,
|
|
498
|
+
label='TGLC PSF Precision/TGLC Weighted Precision')
|
|
499
|
+
ax[1, 0].plot(aper_tglc_mag[:-100], aper_ratio[:-100], '.', c='C0', ms=6, alpha=0.15,
|
|
500
|
+
label='TGLC Aperture Precision/TGLC Weighted Precision')
|
|
501
|
+
ax[1, 0].plot(psf_tglc_mag[:-100], psf_runningmed[:-100], c='C1', label='Median', lw=1.5,
|
|
502
|
+
path_effects=[pe.Stroke(linewidth=3, foreground='k'), pe.Normal()])
|
|
503
|
+
ax[1, 0].plot(aper_tglc_mag[:-100], aper_runningmed[:-100], c='C0', label='Median', lw=1.5,
|
|
504
|
+
path_effects=[pe.Stroke(linewidth=3, foreground='k'), pe.Normal()])
|
|
505
|
+
|
|
506
|
+
ax[1, 0].hlines(y=1, xmin=8, xmax=np.max(tglc_mag), colors='k', linestyles='dotted')
|
|
507
|
+
# ax[1].set_yscale('log')
|
|
508
|
+
ax[1, 0].set_ylim(0.5, 1.5)
|
|
509
|
+
ax[1, 0].tick_params(axis='y', which='minor', labelleft=False)
|
|
510
|
+
ax[1, 0].set_yticks(ticks=[0.5, 1, 1.5], labels=['0.5', '1', '1.5'])
|
|
511
|
+
# ax[1].set_title('Photometric Precision Ratio')
|
|
512
|
+
ax[1, 0].set_xlabel('TESS magnitude')
|
|
513
|
+
ax[1, 0].set_ylabel('Precision Ratio')
|
|
514
|
+
leg = ax[1, 0].legend(loc=4, markerscale=1, ncol=2, columnspacing=1, fontsize=7.2)
|
|
515
|
+
for lh in leg.legendHandles:
|
|
516
|
+
lh.set_alpha(1)
|
|
517
|
+
plt.xlim(7, 20.5)
|
|
518
|
+
|
|
519
|
+
##############################
|
|
520
|
+
# target = '21.0607 34.4578'
|
|
521
|
+
target = 'TOI 519'
|
|
522
|
+
local_directory = f'/home/tehan/Documents/tglc/{target}/'
|
|
523
|
+
# os.makedirs(local_directory, exist_ok=True)
|
|
524
|
+
# tglc_lc(target=target, local_directory=local_directory, size=90, save_aper=False, limit_mag=20,
|
|
525
|
+
# get_all_lc=True, first_sector_only=False, sector=17)
|
|
526
|
+
files = glob(f'{local_directory}lc/*.fits')
|
|
527
|
+
|
|
528
|
+
tic = np.zeros((len(files), 2))
|
|
529
|
+
for i in range(len(files)):
|
|
530
|
+
with fits.open(files[i], mode='denywrite') as hdul:
|
|
531
|
+
try:
|
|
532
|
+
tic[i] = [int(hdul[0].header['TICID']), hdul[0].header['TESSMAG']]
|
|
533
|
+
except:
|
|
534
|
+
pass
|
|
535
|
+
np.save(f'/home/tehan/Documents/tglc/{target}/tic.npy', tic)
|
|
536
|
+
# tic = np.load(f'/home/tehan/Documents/tglc/{target}/tic.npy')
|
|
537
|
+
|
|
538
|
+
# 1-1/07_07 # 21.0607 34.4578 # 90
|
|
539
|
+
noise_2015 = ascii.read('/home/tehan/Documents/tglc/prior_mad/noisemodel.dat')
|
|
540
|
+
qlp_file = glob(f'{local_directory}QLP/HLSP/*/*.fits')
|
|
541
|
+
# ele_file = glob(f'{local_directory}lc_eleanor_psf/*.npy')
|
|
542
|
+
|
|
543
|
+
mag_qlp = []
|
|
544
|
+
median_diff_qlp = []
|
|
545
|
+
for i in trange(len(qlp_file)):
|
|
546
|
+
with fits.open(qlp_file[i], mode='denywrite') as hdul:
|
|
547
|
+
quality = hdul[1].data['QUALITY']
|
|
548
|
+
lc = hdul[1].data['KSPSAP_FLUX']
|
|
549
|
+
mag_ = hdul[0].header['TESSMAG']
|
|
550
|
+
scale = 1.5e4 * 10 ** ((10 - mag_) / 2.5)
|
|
551
|
+
index = np.where(quality == 0)
|
|
552
|
+
mag_qlp.append(mag_)
|
|
553
|
+
median_diff_qlp.append(np.nanmedian(np.abs(np.diff(lc[index]))))
|
|
554
|
+
tglc_mag = np.load(f'/home/tehan/Documents/tglc/{target}/mag.npy')
|
|
555
|
+
mag_both = np.load(f'/home/tehan/Documents/tglc/{target}/mag_both.npy')
|
|
556
|
+
MAD_aper = np.load(f'/home/tehan/Documents/tglc/{target}/MAD_aper.npy')
|
|
557
|
+
# AAD_aper = np.load(f'/home/tehan/Documents/tglc/{target}/AAD_aper.npy')
|
|
558
|
+
MAD_psf = np.load(f'/home/tehan/Documents/tglc/{target}/MAD_psf.npy')
|
|
559
|
+
# AAD_psf = np.load(f'/home/tehan/Documents/tglc/{target}/AAD_psf.npy')
|
|
560
|
+
MAD_both = np.load(f'/home/tehan/Documents/tglc/{target}/MAD_both.npy')
|
|
561
|
+
|
|
562
|
+
aper_precision = 1.48 * MAD_aper / (np.sqrt(2) * 1.5e4 * 10 ** ((10 - tglc_mag) / 2.5))
|
|
563
|
+
psf_precision = 1.48 * MAD_psf / (np.sqrt(2) * 1.5e4 * 10 ** ((10 - tglc_mag) / 2.5))
|
|
564
|
+
aver_precision = 1.48 * MAD_both / (np.sqrt(2) * 1.5e4 * 10 ** ((10 - mag_both) / 2.5))
|
|
565
|
+
qlp_precision = 1.48 * np.array(median_diff_qlp) / np.sqrt(2)
|
|
566
|
+
# ele_precision = 1.48 * np.array(median_diff_ele) / np.sqrt(2)
|
|
567
|
+
|
|
568
|
+
# fig, ax = plt.subplots(2, 1, sharex=True, gridspec_kw=dict(height_ratios=[3, 2], hspace=0.1), figsize=(5, 7))
|
|
569
|
+
ax[0, 1].plot(mag_both, aver_precision, 'D', c='tomato', ms=1, label='TGLC Weighted', alpha=0.9)
|
|
570
|
+
# ax[0].plot(mag_ele, ele_precision, '^', c='C0', ms=1.5, label='eleanor PSF', alpha=0.4)
|
|
571
|
+
ax[0, 1].plot(mag_qlp, qlp_precision, '^', c='teal', ms=1.5, label='QLP', alpha=0.9)
|
|
572
|
+
|
|
573
|
+
# ax[0].plot(tglc_mag, aper_precision, 'D', c='k', ms=1, label='TGLC PSF', alpha=0.8)
|
|
574
|
+
ax[0, 1].plot(noise_2015['col1'], noise_2015['col2'], c='k', ms=1.5, label='Sullivan (2015)', alpha=1)
|
|
575
|
+
# # ax[0].plot(mean_diff_aper[0], aper_precision, 'D', c='r', ms=1, label='TGLC Aper', alpha=0.8)
|
|
576
|
+
ax[0, 1].hlines(y=.1, xmin=8, xmax=np.max(tglc_mag), colors='k', linestyles='dotted')
|
|
577
|
+
ax[0, 1].hlines(y=.01, xmin=8, xmax=np.max(tglc_mag), colors='k', linestyles='dotted')
|
|
578
|
+
|
|
579
|
+
leg = ax[0, 1].legend(loc=4, markerscale=4, fontsize=8)
|
|
580
|
+
for lh in leg.legendHandles:
|
|
581
|
+
lh.set_alpha(1)
|
|
582
|
+
# ax[0, 1].set_ylabel(r'Estimated Photometric Precision')
|
|
583
|
+
ax[0, 1].set_yscale('log')
|
|
584
|
+
ax[0, 1].set_ylim(1e-4, 1)
|
|
585
|
+
ax[0, 1].set_yticklabels([])
|
|
586
|
+
ax[0, 1].set_title('Crowded Field')
|
|
587
|
+
|
|
588
|
+
psf_ratio = psf_precision / aver_precision
|
|
589
|
+
psf_tglc_mag = tglc_mag[np.invert(np.isnan(psf_ratio))]
|
|
590
|
+
psf_ratio = psf_ratio[np.invert(np.isnan(psf_ratio))]
|
|
591
|
+
psf_runningmed = ndimage.median_filter(psf_ratio, size=250, mode='nearest')
|
|
592
|
+
|
|
593
|
+
aper_ratio = aper_precision / aver_precision
|
|
594
|
+
aper_tglc_mag = tglc_mag[np.invert(np.isnan(aper_ratio))]
|
|
595
|
+
aper_ratio = aper_ratio[np.invert(np.isnan(aper_ratio))]
|
|
596
|
+
aper_runningmed = ndimage.median_filter(aper_ratio, size=300, mode='nearest')
|
|
597
|
+
|
|
598
|
+
ax[1, 1].plot(psf_tglc_mag[:-100], psf_ratio[:-100], '.', c='C1', ms=6, alpha=0.15,
|
|
599
|
+
label='TGLC PSF Precision/TGLC Weighted Precision')
|
|
600
|
+
ax[1, 1].plot(aper_tglc_mag[:-100], aper_ratio[:-100], '.', c='C0', ms=6, alpha=0.15,
|
|
601
|
+
label='TGLC Aperture Precision/TGLC Weighted Precision')
|
|
602
|
+
ax[1, 1].plot(psf_tglc_mag[:-100], psf_runningmed[:-100], c='C1', label='Median', lw=1.5,
|
|
603
|
+
path_effects=[pe.Stroke(linewidth=3, foreground='k'), pe.Normal()])
|
|
604
|
+
ax[1, 1].plot(aper_tglc_mag[:-100], aper_runningmed[:-100], c='C0', label='Median', lw=1.5,
|
|
605
|
+
path_effects=[pe.Stroke(linewidth=3, foreground='k'), pe.Normal()])
|
|
606
|
+
|
|
607
|
+
ax[1, 1].hlines(y=1, xmin=8, xmax=np.max(tglc_mag), colors='k', linestyles='dotted')
|
|
608
|
+
# ax[1].set_yscale('log')
|
|
609
|
+
ax[1, 1].set_ylim(0.5, 1.5)
|
|
610
|
+
ax[1, 1].tick_params(axis='y', which='minor', labelleft=False)
|
|
611
|
+
ax[1, 1].set_yticks(ticks=[0.5, 1, 1.5], labels=['0.5', '1', '1.5'])
|
|
612
|
+
# ax[1].set_title('Photometric Precision Ratio')
|
|
613
|
+
ax[1, 1].set_xlabel('TESS magnitude')
|
|
614
|
+
ax[1, 1].set_yticklabels([])
|
|
615
|
+
leg = ax[1, 1].legend(loc=4, markerscale=1, ncol=2, columnspacing=1, fontsize=7.2)
|
|
616
|
+
for lh in leg.legendHandles:
|
|
617
|
+
lh.set_alpha(1)
|
|
618
|
+
plt.xlim(7, 20.5)
|
|
619
|
+
|
|
620
|
+
# plt.savefig(f'{local_directory}MAD.png', bbox_inches='tight', dpi=300)
|
|
621
|
+
plt.show()
|
|
622
|
+
# point-to-point scatter
|
|
623
|
+
|
|
624
|
+
|
|
625
|
+
def figure_4():
|
|
626
|
+
with open(f'/mnt/d/TESS_Sector_17/' + f'source/1-1/source_00_00.pkl', 'rb') as input_:
|
|
627
|
+
source = pickle.load(input_)
|
|
628
|
+
local_bg = np.load('/mnt/c/users/tehan/desktop/local_bg00_00.npy')
|
|
629
|
+
plt.imshow(np.log10(source.flux[0]), cmap='bone', origin='lower')
|
|
630
|
+
plt.scatter(local_bg[0], local_bg[1], s=3 * np.sqrt(abs(local_bg[2])), marker='.', c='C0', label='overestimate')
|
|
631
|
+
plt.scatter(local_bg[0][np.where(local_bg[2] < 0)], local_bg[1][np.where(local_bg[2] < 0)],
|
|
632
|
+
s=3 * np.sqrt(abs(local_bg[2][np.where(local_bg[2] < 0)])), marker='.', c='C1', label='underestimate')
|
|
633
|
+
plt.legend(loc=4)
|
|
634
|
+
plt.title('Local background eliminates vignetting')
|
|
635
|
+
plt.xlim(-0.5, 149.5)
|
|
636
|
+
plt.ylim(-0.5, 149.5)
|
|
637
|
+
plt.xlabel('pixels')
|
|
638
|
+
plt.ylabel('pixels')
|
|
639
|
+
# plt.savefig('/mnt/c/users/tehan/desktop/bg_mod_distribution.png', bbox_inches='tight', dpi=300)
|
|
640
|
+
plt.show()
|
|
641
|
+
|
|
642
|
+
|
|
643
|
+
def figure_5():
|
|
644
|
+
target = 'NGC 7654'
|
|
645
|
+
local_directory = f'/mnt/c/users/tehan/desktop/7654/{target}/'
|
|
646
|
+
# local_directory = f'/home/tehan/data/{target}/'
|
|
647
|
+
os.makedirs(local_directory + 'source/', exist_ok=True)
|
|
648
|
+
os.makedirs(local_directory + f'epsf/', exist_ok=True)
|
|
649
|
+
# source = ffi_cut(target=target, size=50, local_directory=local_directory, sector=18)
|
|
650
|
+
with open(f'{local_directory}source/source_NGC 7654_sector_18.pkl', 'rb') as input_:
|
|
651
|
+
source = pickle.load(input_)
|
|
652
|
+
# epsf(source, factor=2, sector=source.sector, target=target, power=1.4, local_directory=local_directory,
|
|
653
|
+
# name=None, limit_mag=15, save_aper=False)
|
|
654
|
+
contamination_8 = np.load('/mnt/c/users/tehan/desktop/7654/contamination_8_.npy').reshape(50, 50)
|
|
655
|
+
fig = plt.figure(constrained_layout=False, figsize=(11, 4))
|
|
656
|
+
gs = fig.add_gridspec(1, 31)
|
|
657
|
+
gs.update(wspace=1, hspace=0.1)
|
|
658
|
+
|
|
659
|
+
# cmap = plt.get_cmap('cmr.fusion') # MPL
|
|
660
|
+
cmap = 'RdBu'
|
|
661
|
+
ax1 = fig.add_subplot(gs[0, 0:10], projection=source.wcs, slices=('y', 'x'))
|
|
662
|
+
ax1.set_title('TESS FFI', pad=10)
|
|
663
|
+
im1 = ax1.imshow(source.flux[0].transpose(), origin='lower', cmap=cmap, vmin=-5000, vmax=5000)
|
|
664
|
+
ax1.scatter(source.gaia['sector_18_y'][:100], source.gaia['sector_18_x'][:100], s=5, c='r',
|
|
665
|
+
label='background stars')
|
|
666
|
+
ax1.scatter(source.gaia['sector_18_y'][8], source.gaia['sector_18_x'][8], s=30, c='r', marker='*',
|
|
667
|
+
label='target star')
|
|
668
|
+
ax1.coords['pos.eq.ra'].set_axislabel('Right Ascension')
|
|
669
|
+
ax1.coords['pos.eq.ra'].set_axislabel_position('b')
|
|
670
|
+
ax1.coords['pos.eq.dec'].set_axislabel('Declination')
|
|
671
|
+
ax1.coords['pos.eq.dec'].set_axislabel_position('l')
|
|
672
|
+
ax1.coords.grid(color='k', ls='dotted')
|
|
673
|
+
ax1.tick_params(axis='x', labelbottom=True)
|
|
674
|
+
ax1.tick_params(axis='y', labelleft=True)
|
|
675
|
+
|
|
676
|
+
ax2 = fig.add_subplot(gs[0, 10:20], projection=source.wcs, slices=('y', 'x'))
|
|
677
|
+
ax2.set_title('Simulated background stars', pad=10)
|
|
678
|
+
im2 = ax2.imshow(contamination_8.transpose(), origin='lower', cmap=cmap, vmin=-5000, vmax=5000)
|
|
679
|
+
ax2.scatter(source.gaia['sector_18_y'][:8], source.gaia['sector_18_x'][:8], s=5, c='r')
|
|
680
|
+
ax2.scatter(source.gaia['sector_18_y'][9:100], source.gaia['sector_18_x'][9:100], s=5, c='r')
|
|
681
|
+
# ax2.set_xticks([20, 25, 30, 35, 40])
|
|
682
|
+
# ax2.set_yticks([20, 25, 30, 35, 40])
|
|
683
|
+
|
|
684
|
+
ax2.coords['pos.eq.dec'].set_ticklabel_visible(False)
|
|
685
|
+
ax2.coords['pos.eq.ra'].set_axislabel('Right Ascension')
|
|
686
|
+
ax2.coords['pos.eq.ra'].set_axislabel_position('b')
|
|
687
|
+
ax2.coords.grid(color='k', ls='dotted')
|
|
688
|
+
ax2.tick_params(axis='x', labelbottom=True)
|
|
689
|
+
ax2.tick_params(axis='y', labelleft=True)
|
|
690
|
+
|
|
691
|
+
ax3 = fig.add_subplot(gs[0, 20:30], projection=source.wcs, slices=('y', 'x'))
|
|
692
|
+
ax3.set_title('Decontaminated target star', pad=10)
|
|
693
|
+
im3 = ax3.imshow(source.flux[0].transpose() - contamination_8.transpose(), origin='lower', cmap=cmap, vmin=-5000,
|
|
694
|
+
vmax=5000)
|
|
695
|
+
ax3.scatter(source.gaia['sector_18_y'][8], source.gaia['sector_18_x'][8], s=30, c='r', marker='*')
|
|
696
|
+
ax3.coords['pos.eq.dec'].set_ticklabel_visible(False)
|
|
697
|
+
ax3.coords['pos.eq.ra'].set_axislabel('Right Ascension')
|
|
698
|
+
ax3.coords['pos.eq.ra'].set_axislabel_position('b')
|
|
699
|
+
ax3.coords.grid(color='k', ls='dotted')
|
|
700
|
+
ax3.tick_params(axis='x', labelbottom=True)
|
|
701
|
+
ax3.tick_params(axis='y', labelleft=True)
|
|
702
|
+
|
|
703
|
+
# divider = make_axes_locatable(ax3)
|
|
704
|
+
# cax = divider.append_axes('right', size='5%', pad=0.05)
|
|
705
|
+
ax_cb = fig.colorbar(im3, cax=fig.add_subplot(gs[0, 30]), orientation='vertical',
|
|
706
|
+
boundaries=np.linspace(-1000, 5000, 1000),
|
|
707
|
+
ticks=[-1000, 0, 1000, 2000, 3000, 4000, 5000], aspect=50, shrink=0.7)
|
|
708
|
+
ax_cb.ax.set_yticklabels(['-1', '0', '1', '2', '3', '4', '5'])
|
|
709
|
+
ax_cb.ax.set_ylabel(r'TESS Flux ($\times 1000$ $\mathrm{e^-}$/ s) ')
|
|
710
|
+
ax1.legend(loc=2, prop={'size': 8})
|
|
711
|
+
plt.setp([ax1, ax2, ax3], xlim=(18.5, 33.5), ylim=(21.5, 36.5))
|
|
712
|
+
# plt.savefig('/mnt/c/users/tehan/desktop/remove_contamination_.png', bbox_inches='tight', dpi=300)
|
|
713
|
+
plt.show()
|
|
714
|
+
plt.close()
|
|
715
|
+
|
|
716
|
+
|
|
717
|
+
def figure_6(mode='psf'):
|
|
718
|
+
type = f'cal_{mode}_flux'
|
|
719
|
+
# local_directory = '/home/tehan/data/exoplanets/'
|
|
720
|
+
local_directory = '/home/tehan/data/known_exoplanet/'
|
|
721
|
+
os.makedirs(local_directory + f'transits/', exist_ok=True)
|
|
722
|
+
os.makedirs(local_directory + f'lc/', exist_ok=True)
|
|
723
|
+
os.makedirs(local_directory + f'epsf/', exist_ok=True)
|
|
724
|
+
os.makedirs(local_directory + f'source/', exist_ok=True)
|
|
725
|
+
data = ascii.read(local_directory + 'PS_2022.04.17_18.23.57_.csv')
|
|
726
|
+
hosts = list(data['tic_id'])
|
|
727
|
+
# for i in range(len(hosts)):
|
|
728
|
+
# target = hosts[i] # Target identifier or coordinates TOI-3714
|
|
729
|
+
# print(target)
|
|
730
|
+
# size = 90 # int, suggests big cuts
|
|
731
|
+
# source = ffi_cut(target=target, size=size, local_directory=local_directory)
|
|
732
|
+
# for j in range(len(source.sector_table)):
|
|
733
|
+
# source.select_sector(sector=source.sector_table['sector'][j])
|
|
734
|
+
# epsf(source, factor=2, sector=source.sector, target=target, local_directory=local_directory,
|
|
735
|
+
# name='Gaia DR3 '+data['gaia_id'][i].split()[-1], power=1.5, save_aper=True)
|
|
736
|
+
# plt.imshow(source.flux[0])
|
|
737
|
+
# plt.scatter(source.gaia[f'sector_{source.sector_table["sector"][j]}_x'][:100],
|
|
738
|
+
# source.gaia[f'sector_{source.sector_table["sector"][j]}_y'][:100], c='r', s=5)
|
|
739
|
+
# plt.xlim(-0.5, 89.5)
|
|
740
|
+
# plt.ylim(-0.5, 89.5)
|
|
741
|
+
# plt.title(f'{target}_sector_{source.sector_table["sector"][j]}')
|
|
742
|
+
# plt.show()
|
|
743
|
+
|
|
744
|
+
fig = plt.figure(constrained_layout=False, figsize=(10, 10))
|
|
745
|
+
gs = fig.add_gridspec(5, 12)
|
|
746
|
+
gs.update(wspace=0.2, hspace=0.4)
|
|
747
|
+
###########################################
|
|
748
|
+
index = np.where(data['pl_name'] == 'TOI-674 b')
|
|
749
|
+
# period = float(data['pl_orbper'][index])
|
|
750
|
+
period = 1.977165
|
|
751
|
+
t_0 = float(data['pl_tranmid'][index])
|
|
752
|
+
phase_fold_mid = (t_0 - 2457000) % period / period
|
|
753
|
+
with fits.open(glob(f'{local_directory}lc/hlsp_tglc_tess_ffi_gaiaid-5400949450924312576-s0009*.fits')[0],
|
|
754
|
+
mode='denywrite') as hdul:
|
|
755
|
+
q = list(hdul[1].data['TESS_flags'] == 0) and list(hdul[1].data['TGLC_flags'] == 0)
|
|
756
|
+
t_09 = hdul[1].data['time'][q]
|
|
757
|
+
f_09 = hdul[1].data[type][q]
|
|
758
|
+
with fits.open(glob(f'{local_directory}lc/hlsp_tglc_tess_ffi_gaiaid-5400949450924312576-s0010*.fits')[0],
|
|
759
|
+
mode='denywrite') as hdul:
|
|
760
|
+
q = list(hdul[1].data['TESS_flags'] == 0) and list(hdul[1].data['TGLC_flags'] == 0)
|
|
761
|
+
t_10 = hdul[1].data['time'][q]
|
|
762
|
+
f_10 = hdul[1].data[type][q]
|
|
763
|
+
with fits.open(glob(f'{local_directory}lc/hlsp_tglc_tess_ffi_gaiaid-5400949450924312576-s0036*.fits')[0],
|
|
764
|
+
mode='denywrite') as hdul:
|
|
765
|
+
q = list(hdul[1].data['TESS_flags'] == 0) and list(hdul[1].data['TGLC_flags'] == 0)
|
|
766
|
+
t_36 = hdul[1].data['time'][q]
|
|
767
|
+
f_36 = hdul[1].data[type][q]
|
|
768
|
+
t_36 = np.mean(t_36[:len(t_36) // 3 * 3].reshape(-1, 3), axis=1)
|
|
769
|
+
f_36 = np.mean(f_36[:len(f_36) // 3 * 3].reshape(-1, 3), axis=1)
|
|
770
|
+
ax1_1 = fig.add_subplot(gs[0, :3])
|
|
771
|
+
ax1_2 = fig.add_subplot(gs[0, 3:6])
|
|
772
|
+
ax1_3 = fig.add_subplot(gs[0, 6:9])
|
|
773
|
+
ax1_4 = fig.add_subplot(gs[0, 9:12])
|
|
774
|
+
|
|
775
|
+
ax1_1.plot(t_09, f_09, '.', c='k', markersize=1)
|
|
776
|
+
ax1_2.plot(t_10, f_10, '.', c='k', markersize=1)
|
|
777
|
+
ax1_3.plot(t_36, f_36, '.', c='k', markersize=1)
|
|
778
|
+
|
|
779
|
+
ax1_4.plot(t_09 % period / period - phase_fold_mid, f_09, '.', c='C0', markersize=2, label='9')
|
|
780
|
+
ax1_4.plot(t_10 % period / period - phase_fold_mid, f_10, '.', c='C1', markersize=2, label='10')
|
|
781
|
+
ax1_4.plot(t_36 % period / period - phase_fold_mid, f_36, '.', c='C3', markersize=2, label='36')
|
|
782
|
+
ax1_4.legend(loc=3, fontsize=6, markerscale=1)
|
|
783
|
+
# split
|
|
784
|
+
ax1_1.spines['right'].set_visible(False)
|
|
785
|
+
ax1_2.spines['left'].set_visible(False)
|
|
786
|
+
ax1_2.spines['right'].set_visible(False)
|
|
787
|
+
ax1_3.spines['left'].set_visible(False)
|
|
788
|
+
d = .7 # proportion of vertical to horizontal extent of the slanted line
|
|
789
|
+
kwargs = dict(marker=[(-1, -d), (1, d)], markersize=12,
|
|
790
|
+
linestyle="none", color='k', mec='k', mew=1, clip_on=False)
|
|
791
|
+
ax1_1.plot([1, 1], [0, 1], transform=ax1_1.transAxes, **kwargs)
|
|
792
|
+
ax1_2.plot([0, 0], [0, 1], transform=ax1_2.transAxes, **kwargs)
|
|
793
|
+
ax1_2.plot([1, 1], [0, 1], transform=ax1_2.transAxes, **kwargs)
|
|
794
|
+
ax1_3.plot([0, 0], [0, 1], transform=ax1_3.transAxes, **kwargs)
|
|
795
|
+
ax1_2.set_yticklabels([])
|
|
796
|
+
ax1_2.tick_params(axis='y', left=False)
|
|
797
|
+
ax1_3.set_yticklabels([])
|
|
798
|
+
ax1_3.tick_params(axis='y', left=False)
|
|
799
|
+
ax1_4.set_yticklabels([])
|
|
800
|
+
# ax2.plot([0, 0], [0, 1], transform=ax2.transAxes, **kwargs)
|
|
801
|
+
ax1_1.set_ylim(0.975, 1.01)
|
|
802
|
+
ax1_2.set_ylim(0.975, 1.01)
|
|
803
|
+
ax1_3.set_ylim(0.975, 1.01)
|
|
804
|
+
ax1_4.set_ylim(0.975, 1.01)
|
|
805
|
+
ax1_4.set_xlim(- 0.03, 0.03)
|
|
806
|
+
|
|
807
|
+
ax1_1.set_title('Sector 9')
|
|
808
|
+
ax1_2.set_title('Sector 10')
|
|
809
|
+
ax1_3.set_title('Sector 36')
|
|
810
|
+
ax1_4.set_title('TOI-674 b', {'fontweight': 'semibold'})
|
|
811
|
+
ax1_1.set_ylabel('Normalized Flux')
|
|
812
|
+
# ax1_1.set_xlabel('Time (TBJD)')
|
|
813
|
+
# ax1_2.set_xlabel('Time (TBJD)')
|
|
814
|
+
# ax1_3.set_xlabel('Time (TBJD)')
|
|
815
|
+
# ax1_4.set_xlabel('Phase')
|
|
816
|
+
# ax1_4.text(0.98, 0.1, 'Aper', horizontalalignment='right', transform=ax1_4.transAxes)
|
|
817
|
+
|
|
818
|
+
###########################################
|
|
819
|
+
index = np.where(data['pl_name'] == 'LHS 3844 b')
|
|
820
|
+
period = float(data['pl_orbper'][index])
|
|
821
|
+
t_0 = float(data['pl_tranmid'][index])
|
|
822
|
+
phase_fold_mid = (t_0 - 2457000) % period / period
|
|
823
|
+
with fits.open(glob(f'{local_directory}lc/hlsp_tglc_tess_ffi_gaiaid-6385548541499112448-s0027*.fits')[0],
|
|
824
|
+
mode='denywrite') as hdul:
|
|
825
|
+
q = list(hdul[1].data['TESS_flags'] == 0) and list(hdul[1].data['TGLC_flags'] == 0)
|
|
826
|
+
t_27 = hdul[1].data['time'][q]
|
|
827
|
+
f_27 = hdul[1].data[type][q]
|
|
828
|
+
t_27 = np.mean(t_27[:len(t_27) // 3 * 3].reshape(-1, 3), axis=1)
|
|
829
|
+
f_27 = np.mean(f_27[:len(f_27) // 3 * 3].reshape(-1, 3), axis=1)
|
|
830
|
+
with fits.open(glob(f'{local_directory}lc/hlsp_tglc_tess_ffi_gaiaid-6385548541499112448-s0028*.fits')[0],
|
|
831
|
+
mode='denywrite') as hdul:
|
|
832
|
+
q = list(hdul[1].data['TESS_flags'] == 0) and list(hdul[1].data['TGLC_flags'] == 0)
|
|
833
|
+
t_28 = hdul[1].data['time'][q]
|
|
834
|
+
f_28 = hdul[1].data[type][q]
|
|
835
|
+
t_28 = np.mean(t_28[:len(t_28) // 3 * 3].reshape(-1, 3), axis=1)
|
|
836
|
+
f_28 = np.mean(f_28[:len(f_28) // 3 * 3].reshape(-1, 3), axis=1)
|
|
837
|
+
ax2_1 = fig.add_subplot(gs[1, :3])
|
|
838
|
+
ax2_2 = fig.add_subplot(gs[1, 3:6])
|
|
839
|
+
ax2_4 = fig.add_subplot(gs[1, 9:12])
|
|
840
|
+
|
|
841
|
+
ax2_1.plot(t_27, f_27, '.', c='k', markersize=1)
|
|
842
|
+
ax2_2.plot(t_28, f_28, '.', c='k', markersize=1)
|
|
843
|
+
ax2_4.plot(t_27 % period / period - phase_fold_mid, f_27, '.', c='C0', markersize=2, label='27')
|
|
844
|
+
ax2_4.plot(t_28 % period / period - phase_fold_mid, f_28, '.', c='C1', markersize=2, label='28')
|
|
845
|
+
ax2_4.legend(loc=3, fontsize=6, markerscale=1)
|
|
846
|
+
# split
|
|
847
|
+
ax2_1.spines['right'].set_visible(False)
|
|
848
|
+
ax2_2.spines['left'].set_visible(False)
|
|
849
|
+
|
|
850
|
+
d = .7 # proportion of vertical to horizontal extent of the slanted line
|
|
851
|
+
kwargs = dict(marker=[(-1, -d), (1, d)], markersize=12,
|
|
852
|
+
linestyle="none", color='k', mec='k', mew=1, clip_on=False)
|
|
853
|
+
ax2_1.plot([1, 1], [0, 1], transform=ax2_1.transAxes, **kwargs)
|
|
854
|
+
ax2_2.plot([0, 0], [0, 1], transform=ax2_2.transAxes, **kwargs)
|
|
855
|
+
ax2_2.set_yticklabels([])
|
|
856
|
+
ax2_2.tick_params(axis='y', left=False)
|
|
857
|
+
ax2_4.set_yticklabels([])
|
|
858
|
+
# ax2.plot([0, 0], [0, 1], transform=ax2.transAxes, **kwargs)
|
|
859
|
+
ax2_1.set_ylim(0.988, 1.007)
|
|
860
|
+
ax2_2.set_ylim(0.988, 1.007)
|
|
861
|
+
ax2_4.set_ylim(0.988, 1.007)
|
|
862
|
+
ax2_4.set_xlim(- 0.1, 0.1)
|
|
863
|
+
|
|
864
|
+
ax2_1.set_title('Sector 27')
|
|
865
|
+
ax2_2.set_title('Sector 28')
|
|
866
|
+
ax2_4.set_title('LHS 3844 b', {'fontweight': 'semibold'})
|
|
867
|
+
ax2_1.set_ylabel('Normalized Flux')
|
|
868
|
+
# ax2_1.set_xlabel('Time (TBJD)')
|
|
869
|
+
# ax2_2.set_xlabel('Time (TBJD)')
|
|
870
|
+
# ax2_4.set_xlabel('Phase')
|
|
871
|
+
# ax2_4.text(0.98, 0.1, 'PSF', horizontalalignment='right', transform=ax2_4.transAxes)
|
|
872
|
+
|
|
873
|
+
###########################################
|
|
874
|
+
index = np.where(data['pl_name'] == 'TOI-530 b')
|
|
875
|
+
period = 6.387583
|
|
876
|
+
t_0 = float(data['pl_tranmid'][index])
|
|
877
|
+
phase_fold_mid = (t_0 - 2457000) % period / period
|
|
878
|
+
with fits.open(glob(f'{local_directory}lc/hlsp_tglc_tess_ffi_gaiaid-3353218995355814656-s0006*.fits')[0],
|
|
879
|
+
mode='denywrite') as hdul:
|
|
880
|
+
q = list(hdul[1].data['TESS_flags'] == 0) and list(hdul[1].data['TGLC_flags'] == 0)
|
|
881
|
+
t_06 = hdul[1].data['time'][q]
|
|
882
|
+
f_06 = hdul[1].data[type][q]
|
|
883
|
+
with fits.open(glob(f'{local_directory}lc/hlsp_tglc_tess_ffi_gaiaid-3353218995355814656-s0044*.fits')[0],
|
|
884
|
+
mode='denywrite') as hdul:
|
|
885
|
+
q = list(hdul[1].data['TESS_flags'] == 0) and list(hdul[1].data['TGLC_flags'] == 0)
|
|
886
|
+
t_44 = hdul[1].data['time'][q]
|
|
887
|
+
f_44 = hdul[1].data[type][q]
|
|
888
|
+
t_44 = np.mean(t_44[:len(t_44) // 3 * 3].reshape(-1, 3), axis=1)
|
|
889
|
+
f_44 = np.mean(f_44[:len(f_44) // 3 * 3].reshape(-1, 3), axis=1)
|
|
890
|
+
with fits.open(glob(f'{local_directory}lc/hlsp_tglc_tess_ffi_gaiaid-3353218995355814656-s0045*.fits')[0],
|
|
891
|
+
mode='denywrite') as hdul:
|
|
892
|
+
q = list(hdul[1].data['TESS_flags'] == 0) and list(hdul[1].data['TGLC_flags'] == 0)
|
|
893
|
+
t_45 = hdul[1].data['time'][q]
|
|
894
|
+
f_45 = hdul[1].data[type][q]
|
|
895
|
+
t_45 = np.mean(t_45[:len(t_45) // 3 * 3].reshape(-1, 3), axis=1)
|
|
896
|
+
f_45 = np.mean(f_45[:len(f_45) // 3 * 3].reshape(-1, 3), axis=1)
|
|
897
|
+
ax3_1 = fig.add_subplot(gs[2, :3])
|
|
898
|
+
ax3_2 = fig.add_subplot(gs[2, 3:6])
|
|
899
|
+
ax3_3 = fig.add_subplot(gs[2, 6:9])
|
|
900
|
+
ax3_4 = fig.add_subplot(gs[2, 9:12])
|
|
901
|
+
|
|
902
|
+
ax3_1.plot(t_06, f_06, '.', c='k', markersize=1)
|
|
903
|
+
ax3_2.plot(t_44, f_44, '.', c='k', markersize=1)
|
|
904
|
+
ax3_3.plot(t_45, f_45, '.', c='k', markersize=1)
|
|
905
|
+
|
|
906
|
+
ax3_4.plot(t_06 % period / period - phase_fold_mid, f_06, '.', c='C0', markersize=2, label='6')
|
|
907
|
+
ax3_4.plot(t_44 % period / period - phase_fold_mid, f_44, '.', c='C1', markersize=2, label='44')
|
|
908
|
+
ax3_4.plot(t_45 % period / period - phase_fold_mid, f_45, '.', c='C3', markersize=2, label='45')
|
|
909
|
+
ax3_4.legend(loc=3, fontsize=6, markerscale=1)
|
|
910
|
+
# split
|
|
911
|
+
ax3_1.spines['right'].set_visible(False)
|
|
912
|
+
ax3_2.spines['left'].set_visible(False)
|
|
913
|
+
ax3_2.spines['right'].set_visible(False)
|
|
914
|
+
ax3_3.spines['left'].set_visible(False)
|
|
915
|
+
d = .7 # proportion of vertical to horizontal extent of the slanted line
|
|
916
|
+
kwargs = dict(marker=[(-1, -d), (1, d)], markersize=12,
|
|
917
|
+
linestyle="none", color='k', mec='k', mew=1, clip_on=False)
|
|
918
|
+
ax3_1.plot([1, 1], [0, 1], transform=ax3_1.transAxes, **kwargs)
|
|
919
|
+
ax3_2.plot([0, 0], [0, 1], transform=ax3_2.transAxes, **kwargs)
|
|
920
|
+
ax3_2.plot([1, 1], [0, 1], transform=ax3_2.transAxes, **kwargs)
|
|
921
|
+
ax3_3.plot([0, 0], [0, 1], transform=ax3_3.transAxes, **kwargs)
|
|
922
|
+
ax3_2.set_yticklabels([])
|
|
923
|
+
ax3_2.tick_params(axis='y', left=False)
|
|
924
|
+
ax3_3.set_yticklabels([])
|
|
925
|
+
ax3_3.tick_params(axis='y', left=False)
|
|
926
|
+
ax3_4.set_yticklabels([])
|
|
927
|
+
ax3_1.set_xticks([1470, 1480, 1490])
|
|
928
|
+
ax3_1.set_xticklabels([1470, 1480, None])
|
|
929
|
+
# ax2.plot([0, 0], [0, 1], transform=ax2.transAxes, **kwargs)
|
|
930
|
+
ax3_1.set_ylim(0.95, 1.03)
|
|
931
|
+
ax3_2.set_ylim(0.95, 1.03)
|
|
932
|
+
ax3_3.set_ylim(0.95, 1.03)
|
|
933
|
+
ax3_4.set_ylim(0.95, 1.03)
|
|
934
|
+
ax3_4.set_xlim(- 0.03, 0.03)
|
|
935
|
+
|
|
936
|
+
ax3_1.set_title('Sector 6')
|
|
937
|
+
ax3_2.set_title('Sector 44')
|
|
938
|
+
ax3_3.set_title('Sector 45')
|
|
939
|
+
ax3_4.set_title('TOI-530 b', {'fontweight': 'semibold'})
|
|
940
|
+
ax3_1.set_ylabel('Normalized Flux')
|
|
941
|
+
# ax3_1.set_xlabel('Time (TBJD)')
|
|
942
|
+
# ax3_2.set_xlabel('Time (TBJD)')
|
|
943
|
+
# ax3_3.set_xlabel('Time (TBJD)')
|
|
944
|
+
# ax3_4.set_xlabel('Phase')
|
|
945
|
+
# ax3_4.text(0.98, 0.1, 'Aper', horizontalalignment='right', transform=ax3_4.transAxes)
|
|
946
|
+
|
|
947
|
+
###########################################
|
|
948
|
+
index = np.where(data['pl_name'] == 'TOI-2406 b')
|
|
949
|
+
period = 3.076676
|
|
950
|
+
t_0 = float(data['pl_tranmid'][index])
|
|
951
|
+
phase_fold_mid = (t_0 - 2457000) % period / period
|
|
952
|
+
with fits.open(glob(f'{local_directory}lc/hlsp_tglc_tess_ffi_gaiaid-2528453161326406016-s0003*.fits')[0],
|
|
953
|
+
mode='denywrite') as hdul:
|
|
954
|
+
q = list(hdul[1].data['TESS_flags'] == 0) and list(hdul[1].data['TGLC_flags'] == 0)
|
|
955
|
+
t_03 = hdul[1].data['time'][q]
|
|
956
|
+
f_03 = hdul[1].data[type][q]
|
|
957
|
+
with fits.open(glob(f'{local_directory}lc/hlsp_tglc_tess_ffi_gaiaid-2528453161326406016-s0042*.fits')[0],
|
|
958
|
+
mode='denywrite') as hdul:
|
|
959
|
+
q = list(hdul[1].data['TESS_flags'] == 0) and list(hdul[1].data['TGLC_flags'] == 0)
|
|
960
|
+
t_42 = hdul[1].data['time'][q]
|
|
961
|
+
f_42 = hdul[1].data[type][q]
|
|
962
|
+
t_42 = np.mean(t_42[:len(t_42) // 3 * 3].reshape(-1, 3), axis=1)
|
|
963
|
+
f_42 = np.mean(f_42[:len(f_42) // 3 * 3].reshape(-1, 3), axis=1)
|
|
964
|
+
with fits.open(glob(f'{local_directory}lc/hlsp_tglc_tess_ffi_gaiaid-2528453161326406016-s0043*.fits')[0],
|
|
965
|
+
mode='denywrite') as hdul:
|
|
966
|
+
q = list(hdul[1].data['TESS_flags'] == 0) and list(hdul[1].data['TGLC_flags'] == 0)
|
|
967
|
+
t_43 = hdul[1].data['time'][q]
|
|
968
|
+
f_43 = hdul[1].data[type][q]
|
|
969
|
+
t_43 = np.mean(t_43[:len(t_43) // 3 * 3].reshape(-1, 3), axis=1)
|
|
970
|
+
f_43 = np.mean(f_43[:len(f_43) // 3 * 3].reshape(-1, 3), axis=1)
|
|
971
|
+
ax4_1 = fig.add_subplot(gs[3, :3])
|
|
972
|
+
ax4_2 = fig.add_subplot(gs[3, 3:6])
|
|
973
|
+
ax4_3 = fig.add_subplot(gs[3, 6:9])
|
|
974
|
+
ax4_4 = fig.add_subplot(gs[3, 9:12])
|
|
975
|
+
|
|
976
|
+
ax4_1.plot(t_03, f_03, '.', c='k', markersize=1)
|
|
977
|
+
ax4_2.plot(t_42, f_42, '.', c='k', markersize=1)
|
|
978
|
+
ax4_3.plot(t_43, f_43, '.', c='k', markersize=1)
|
|
979
|
+
|
|
980
|
+
ax4_4.plot(t_03 % period / period - phase_fold_mid, f_03, '.', c='C0', markersize=2, label='3')
|
|
981
|
+
ax4_4.plot(t_42 % period / period - phase_fold_mid, f_42, '.', c='C1', markersize=2, label='42')
|
|
982
|
+
ax4_4.plot(t_43 % period / period - phase_fold_mid, f_43, '.', c='C3', markersize=2, label='43')
|
|
983
|
+
ax4_4.legend(loc=3, fontsize=6, markerscale=1)
|
|
984
|
+
# split
|
|
985
|
+
ax4_1.spines['right'].set_visible(False)
|
|
986
|
+
ax4_2.spines['left'].set_visible(False)
|
|
987
|
+
ax4_2.spines['right'].set_visible(False)
|
|
988
|
+
ax4_3.spines['left'].set_visible(False)
|
|
989
|
+
d = .7 # proportion of vertical to horizontal extent of the slanted line
|
|
990
|
+
kwargs = dict(marker=[(-1, -d), (1, d)], markersize=12,
|
|
991
|
+
linestyle="none", color='k', mec='k', mew=1, clip_on=False)
|
|
992
|
+
ax4_1.plot([1, 1], [0, 1], transform=ax4_1.transAxes, **kwargs)
|
|
993
|
+
ax4_2.plot([0, 0], [0, 1], transform=ax4_2.transAxes, **kwargs)
|
|
994
|
+
ax4_2.plot([1, 1], [0, 1], transform=ax4_2.transAxes, **kwargs)
|
|
995
|
+
ax4_3.plot([0, 0], [0, 1], transform=ax4_3.transAxes, **kwargs)
|
|
996
|
+
ax4_2.set_yticklabels([])
|
|
997
|
+
ax4_2.tick_params(axis='y', left=False)
|
|
998
|
+
ax4_3.set_yticklabels([])
|
|
999
|
+
ax4_3.tick_params(axis='y', left=False)
|
|
1000
|
+
ax4_4.set_yticklabels([])
|
|
1001
|
+
# ax2.plot([0, 0], [0, 1], transform=ax2.transAxes, **kwargs)
|
|
1002
|
+
ax4_1.set_ylim(0.945, 1.04)
|
|
1003
|
+
ax4_2.set_ylim(0.945, 1.04)
|
|
1004
|
+
ax4_3.set_ylim(0.945, 1.04)
|
|
1005
|
+
ax4_4.set_ylim(0.945, 1.04)
|
|
1006
|
+
ax4_4.set_xlim(- 0.04, 0.04)
|
|
1007
|
+
|
|
1008
|
+
ax4_1.set_title('Sector 3')
|
|
1009
|
+
ax4_2.set_title('Sector 42')
|
|
1010
|
+
ax4_3.set_title('Sector 43')
|
|
1011
|
+
ax4_4.set_title('TOI-2406 b', {'fontweight': 'semibold'})
|
|
1012
|
+
ax4_1.set_ylabel('Normalized Flux')
|
|
1013
|
+
# ax4_1.set_xlabel('Time (TBJD)')
|
|
1014
|
+
# ax4_2.set_xlabel('Time (TBJD)')
|
|
1015
|
+
# ax4_3.set_xlabel('Time (TBJD)')
|
|
1016
|
+
# ax4_4.set_xlabel('Phase')
|
|
1017
|
+
# ax4_4.text(0.98, 0.1, 'PSF', horizontalalignment='right', transform=ax4_4.transAxes)
|
|
1018
|
+
|
|
1019
|
+
###########################################
|
|
1020
|
+
index = np.where(data['pl_name'] == 'TOI-519 b')
|
|
1021
|
+
period = 1.265232
|
|
1022
|
+
t_0 = float(data['pl_tranmid'][index])
|
|
1023
|
+
phase_fold_mid = (t_0 - 2457000) % period / period
|
|
1024
|
+
with fits.open(glob(f'{local_directory}lc/hlsp_tglc_tess_ffi_gaiaid-5707485527450614656-s0007*.fits')[0],
|
|
1025
|
+
mode='denywrite') as hdul:
|
|
1026
|
+
q = list(hdul[1].data['TESS_flags'] == 0) and list(hdul[1].data['TGLC_flags'] == 0)
|
|
1027
|
+
t_07 = hdul[1].data['time'][q]
|
|
1028
|
+
f_07 = hdul[1].data[type][q]
|
|
1029
|
+
with fits.open(glob(f'{local_directory}lc/hlsp_tglc_tess_ffi_gaiaid-5707485527450614656-s0008*.fits')[0],
|
|
1030
|
+
mode='denywrite') as hdul:
|
|
1031
|
+
q = list(hdul[1].data['TESS_flags'] == 0) and list(hdul[1].data['TGLC_flags'] == 0)
|
|
1032
|
+
t_08 = hdul[1].data['time'][q]
|
|
1033
|
+
f_08 = hdul[1].data[type][q]
|
|
1034
|
+
with fits.open(glob(f'{local_directory}lc/hlsp_tglc_tess_ffi_gaiaid-5707485527450614656-s0034*.fits')[0],
|
|
1035
|
+
mode='denywrite') as hdul:
|
|
1036
|
+
q = list(hdul[1].data['TESS_flags'] == 0) and list(hdul[1].data['TGLC_flags'] == 0)
|
|
1037
|
+
t_34 = hdul[1].data['time'][q]
|
|
1038
|
+
f_34 = hdul[1].data[type][q]
|
|
1039
|
+
t_34 = np.mean(t_34[:len(t_34) // 3 * 3].reshape(-1, 3), axis=1)
|
|
1040
|
+
f_34 = np.mean(f_34[:len(f_34) // 3 * 3].reshape(-1, 3), axis=1)
|
|
1041
|
+
ax5_1 = fig.add_subplot(gs[4, :3])
|
|
1042
|
+
ax5_2 = fig.add_subplot(gs[4, 3:6])
|
|
1043
|
+
ax5_3 = fig.add_subplot(gs[4, 6:9])
|
|
1044
|
+
ax5_4 = fig.add_subplot(gs[4, 9:12])
|
|
1045
|
+
|
|
1046
|
+
ax5_1.plot(t_07, f_07, '.', c='k', markersize=1)
|
|
1047
|
+
ax5_2.plot(t_08, f_08, '.', c='k', markersize=1)
|
|
1048
|
+
ax5_3.plot(t_34, f_34, '.', c='k', markersize=1)
|
|
1049
|
+
|
|
1050
|
+
ax5_4.plot(t_07 % period / period - phase_fold_mid, f_07, '.', c='C0', markersize=2, label='7')
|
|
1051
|
+
ax5_4.plot(t_08 % period / period - phase_fold_mid, f_08, '.', c='C1', markersize=2, label='8')
|
|
1052
|
+
ax5_4.plot(t_34 % period / period - phase_fold_mid, f_34, '.', c='C3', markersize=2, label='34')
|
|
1053
|
+
ax5_4.legend(loc=3, fontsize=6, markerscale=1)
|
|
1054
|
+
# split
|
|
1055
|
+
ax5_1.spines['right'].set_visible(False)
|
|
1056
|
+
ax5_2.spines['left'].set_visible(False)
|
|
1057
|
+
ax5_2.spines['right'].set_visible(False)
|
|
1058
|
+
ax5_3.spines['left'].set_visible(False)
|
|
1059
|
+
d = .7 # proportion of vertical to horizontal extent of the slanted line
|
|
1060
|
+
kwargs = dict(marker=[(-1, -d), (1, d)], markersize=12,
|
|
1061
|
+
linestyle="none", color='k', mec='k', mew=1, clip_on=False)
|
|
1062
|
+
ax5_1.plot([1, 1], [0, 1], transform=ax5_1.transAxes, **kwargs)
|
|
1063
|
+
ax5_2.plot([0, 0], [0, 1], transform=ax5_2.transAxes, **kwargs)
|
|
1064
|
+
ax5_2.plot([1, 1], [0, 1], transform=ax5_2.transAxes, **kwargs)
|
|
1065
|
+
ax5_3.plot([0, 0], [0, 1], transform=ax5_3.transAxes, **kwargs)
|
|
1066
|
+
ax5_2.set_yticklabels([])
|
|
1067
|
+
ax5_2.tick_params(axis='y', left=False)
|
|
1068
|
+
ax5_3.set_yticklabels([])
|
|
1069
|
+
ax5_3.tick_params(axis='y', left=False)
|
|
1070
|
+
ax5_4.set_yticklabels([])
|
|
1071
|
+
ax5_4.set_xticks([-0.04, 0, 0.04])
|
|
1072
|
+
ax5_4.set_xticklabels([f'\N{MINUS SIGN}0.04', '0.00', '0.04'])
|
|
1073
|
+
# ax2.plot([0, 0], [0, 1], transform=ax2.transAxes, **kwargs)
|
|
1074
|
+
ax5_1.set_ylim(0.83, 1.05)
|
|
1075
|
+
ax5_2.set_ylim(0.83, 1.05)
|
|
1076
|
+
ax5_3.set_ylim(0.83, 1.05)
|
|
1077
|
+
ax5_4.set_ylim(0.83, 1.05)
|
|
1078
|
+
ax5_4.set_xlim(- 0.05, 0.05)
|
|
1079
|
+
|
|
1080
|
+
ax5_1.set_title('Sector 7')
|
|
1081
|
+
ax5_2.set_title('Sector 8')
|
|
1082
|
+
ax5_3.set_title('Sector 34')
|
|
1083
|
+
ax5_4.set_title('TOI-519 b', {'fontweight': 'semibold'})
|
|
1084
|
+
ax5_1.set_ylabel('Normalized Flux')
|
|
1085
|
+
ax5_1.set_xlabel('Time (TBJD)')
|
|
1086
|
+
ax5_2.set_xlabel('Time (TBJD)')
|
|
1087
|
+
ax5_3.set_xlabel('Time (TBJD)')
|
|
1088
|
+
ax5_4.set_xlabel('Phase')
|
|
1089
|
+
# ax5_4.text(0.98, 0.1, 'Aper', horizontalalignment='right', transform=ax5_4.transAxes)
|
|
1090
|
+
|
|
1091
|
+
plt.savefig(f'{local_directory}known_exoplanets_{mode}.png', bbox_inches='tight', dpi=300)
|
|
1092
|
+
plt.show()
|
|
1093
|
+
|
|
1094
|
+
|
|
1095
|
+
def figure_7():
|
|
1096
|
+
local_directory = '/mnt/c/users/tehan/desktop/known_exoplanet/'
|
|
1097
|
+
data = ascii.read(local_directory + 'PS_2022.04.17_18.23.57_.csv')
|
|
1098
|
+
fig = plt.figure(constrained_layout=False, figsize=(10, 8))
|
|
1099
|
+
gs = fig.add_gridspec(5, 12)
|
|
1100
|
+
gs.update(wspace=0.3, hspace=0.3)
|
|
1101
|
+
color = ['C0', 'C1', 'C3']
|
|
1102
|
+
|
|
1103
|
+
#########################################################################
|
|
1104
|
+
# TOI-674
|
|
1105
|
+
tic = 158588995
|
|
1106
|
+
|
|
1107
|
+
# load QLP
|
|
1108
|
+
qlp_9_t, qlp_9_f = load_qlp(ld=local_directory, tic=tic, sector=9)
|
|
1109
|
+
qlp_10_t, qlp_10_f = load_qlp(ld=local_directory, tic=tic, sector=10)
|
|
1110
|
+
qlp_36_t, qlp_36_f = load_qlp(ld=local_directory, tic=tic, sector=36)
|
|
1111
|
+
|
|
1112
|
+
# load eleanor
|
|
1113
|
+
eleanor_9_t, eleanor_9_f_pca, eleanor_9_f_psf = load_eleanor(ld=local_directory, tic=tic, sector=9)
|
|
1114
|
+
eleanor_10_t, eleanor_10_f_pca, eleanor_10_f_psf = load_eleanor(ld=local_directory, tic=tic, sector=10)
|
|
1115
|
+
eleanor_36_t, eleanor_36_f_pca, eleanor_36_f_psf = load_eleanor(ld=local_directory, tic=tic, sector=36)
|
|
1116
|
+
|
|
1117
|
+
files = glob(local_directory + 'SPOC/TOI-674/*.fits')
|
|
1118
|
+
index = np.where(data['pl_name'] == 'TOI-674 b')
|
|
1119
|
+
period = 1.977165
|
|
1120
|
+
t_0 = float(data['pl_tranmid'][index])
|
|
1121
|
+
phase_fold_mid = (t_0 - 2457000) % period / period
|
|
1122
|
+
ax1_1 = fig.add_subplot(gs[0, :3])
|
|
1123
|
+
ax1_2 = fig.add_subplot(gs[0, 3:6])
|
|
1124
|
+
ax1_3 = fig.add_subplot(gs[0, 6:9])
|
|
1125
|
+
ax1_4 = fig.add_subplot(gs[0, 9:])
|
|
1126
|
+
|
|
1127
|
+
for i in range(len(files)):
|
|
1128
|
+
with fits.open(files[i], mode='denywrite') as hdul:
|
|
1129
|
+
spoc_t = hdul[1].data['TIME']
|
|
1130
|
+
spoc_f = hdul[1].data['PDCSAP_FLUX']
|
|
1131
|
+
spoc_t = np.mean(spoc_t[:len(spoc_t) // 15 * 15].reshape(-1, 15), axis=1)
|
|
1132
|
+
spoc_f = np.mean(spoc_f[:len(spoc_f) // 15 * 15].reshape(-1, 15), axis=1)
|
|
1133
|
+
ax1_1.plot(spoc_t % period / period - phase_fold_mid, spoc_f / np.nanmedian(spoc_f), '.', c=color[i], ms=2,
|
|
1134
|
+
label=str(hdul[0].header['sector']))
|
|
1135
|
+
ax1_2.plot(eleanor_9_t % period / period - phase_fold_mid, eleanor_9_f_pca, '.', c=color[0], markersize=2,
|
|
1136
|
+
label='9')
|
|
1137
|
+
ax1_2.plot(eleanor_10_t % period / period - phase_fold_mid, eleanor_10_f_pca, '.', c=color[1], markersize=2,
|
|
1138
|
+
label='10')
|
|
1139
|
+
ax1_2.plot(eleanor_36_t % period / period - phase_fold_mid, eleanor_36_f_pca, '.', c=color[2], markersize=2,
|
|
1140
|
+
label='36')
|
|
1141
|
+
ax1_3.plot(eleanor_9_t % period / period - phase_fold_mid, eleanor_9_f_psf, '.', c=color[0], markersize=2,
|
|
1142
|
+
label='9')
|
|
1143
|
+
ax1_3.plot(eleanor_10_t % period / period - phase_fold_mid, eleanor_10_f_psf, '.', c=color[1], markersize=2,
|
|
1144
|
+
label='10')
|
|
1145
|
+
ax1_3.plot(eleanor_36_t % period / period - phase_fold_mid, eleanor_36_f_psf, '.', c=color[2], markersize=2,
|
|
1146
|
+
label='36')
|
|
1147
|
+
ax1_4.plot(qlp_9_t % period / period - phase_fold_mid, qlp_9_f, '.', c=color[0], markersize=2, label='9')
|
|
1148
|
+
ax1_4.plot(qlp_10_t % period / period - phase_fold_mid, qlp_10_f, '.', c=color[1], markersize=2, label='10')
|
|
1149
|
+
ax1_4.plot(qlp_36_t % period / period - phase_fold_mid, qlp_36_f, '.', c=color[2], markersize=2, label='36')
|
|
1150
|
+
|
|
1151
|
+
ax1_1.legend(loc=3, fontsize=6)
|
|
1152
|
+
ax1_2.legend(loc=3, fontsize=6)
|
|
1153
|
+
ax1_3.legend(loc=3, fontsize=6)
|
|
1154
|
+
ax1_4.legend(loc=3, fontsize=6)
|
|
1155
|
+
ax1_1.set_ylim(0.975, 1.01)
|
|
1156
|
+
ax1_2.set_ylim(0.975, 1.01)
|
|
1157
|
+
ax1_3.set_ylim(0.975, 1.01)
|
|
1158
|
+
ax1_4.set_ylim(0.975, 1.01)
|
|
1159
|
+
ax1_1.set_xlim(- 0.03, 0.03)
|
|
1160
|
+
ax1_2.set_xlim(- 0.03, 0.03)
|
|
1161
|
+
ax1_3.set_xlim(- 0.03, 0.03)
|
|
1162
|
+
ax1_4.set_xlim(- 0.03, 0.03)
|
|
1163
|
+
ax1_2.set_yticklabels([])
|
|
1164
|
+
ax1_3.set_yticklabels([])
|
|
1165
|
+
ax1_4.set_yticklabels([])
|
|
1166
|
+
|
|
1167
|
+
ax1_1.set_title('SPOC 2-min')
|
|
1168
|
+
ax1_2.set_title('eleanor CORR')
|
|
1169
|
+
ax1_3.set_title('eleanor PSF')
|
|
1170
|
+
ax1_4.set_title('QLP')
|
|
1171
|
+
ax1_1.set_ylabel('Normalized Flux')
|
|
1172
|
+
ax1_3.text(2.25, 0.5, f'TOI-674 b', horizontalalignment='center',
|
|
1173
|
+
verticalalignment='center', transform=ax1_3.transAxes, rotation=270, fontweight='semibold')
|
|
1174
|
+
ax1_3.text(2.15, 0.5, 'mag=11.88', horizontalalignment='center',
|
|
1175
|
+
verticalalignment='center', transform=ax1_3.transAxes, rotation=270)
|
|
1176
|
+
#########################################################################
|
|
1177
|
+
# LHS 3844
|
|
1178
|
+
tic = 410153553
|
|
1179
|
+
|
|
1180
|
+
# load QLP
|
|
1181
|
+
qlp_27_t, qlp_27_f = load_qlp(ld=local_directory, tic=tic, sector=27)
|
|
1182
|
+
qlp_28_t, qlp_28_f = load_qlp(ld=local_directory, tic=tic, sector=28)
|
|
1183
|
+
|
|
1184
|
+
# load eleanor
|
|
1185
|
+
eleanor_27_t, eleanor_27_f_pca, eleanor_27_f_psf = load_eleanor(ld=local_directory, tic=tic, sector=27)
|
|
1186
|
+
eleanor_28_t, eleanor_28_f_pca, eleanor_28_f_psf = load_eleanor(ld=local_directory, tic=tic, sector=28)
|
|
1187
|
+
|
|
1188
|
+
files = glob(local_directory + 'SPOC/LHS 3844/*.fits')
|
|
1189
|
+
index = np.where(data['pl_name'] == 'LHS 3844 b')
|
|
1190
|
+
period = float(data['pl_orbper'][index])
|
|
1191
|
+
t_0 = float(data['pl_tranmid'][index])
|
|
1192
|
+
phase_fold_mid = (t_0 - 2457000) % period / period
|
|
1193
|
+
ax2_1 = fig.add_subplot(gs[1, :3])
|
|
1194
|
+
ax2_2 = fig.add_subplot(gs[1, 3:6])
|
|
1195
|
+
ax2_3 = fig.add_subplot(gs[1, 6:9])
|
|
1196
|
+
ax2_4 = fig.add_subplot(gs[1, 9:])
|
|
1197
|
+
|
|
1198
|
+
for i in range(len(files)):
|
|
1199
|
+
with fits.open(files[i], mode='denywrite') as hdul:
|
|
1200
|
+
if hdul[0].header['sector'] == 1:
|
|
1201
|
+
continue
|
|
1202
|
+
spoc_t = hdul[1].data['TIME']
|
|
1203
|
+
spoc_f = hdul[1].data['PDCSAP_FLUX']
|
|
1204
|
+
spoc_t = np.mean(spoc_t[:len(spoc_t) // 15 * 15].reshape(-1, 15), axis=1)
|
|
1205
|
+
spoc_f = np.mean(spoc_f[:len(spoc_f) // 15 * 15].reshape(-1, 15), axis=1)
|
|
1206
|
+
ax2_1.plot(spoc_t % period / period - phase_fold_mid, spoc_f / np.nanmedian(spoc_f), '.', c=color[i - 1],
|
|
1207
|
+
ms=2,
|
|
1208
|
+
label=str(hdul[0].header['sector']))
|
|
1209
|
+
ax2_2.plot(eleanor_27_t % period / period - phase_fold_mid, eleanor_27_f_pca, '.', c=color[0], markersize=2,
|
|
1210
|
+
label='27')
|
|
1211
|
+
ax2_2.plot(eleanor_28_t % period / period - phase_fold_mid, eleanor_28_f_pca, '.', c=color[1], markersize=2,
|
|
1212
|
+
label='28')
|
|
1213
|
+
ax2_3.plot(eleanor_27_t % period / period - phase_fold_mid, eleanor_27_f_psf, '.', c=color[0], markersize=2,
|
|
1214
|
+
label='27')
|
|
1215
|
+
ax2_3.plot(eleanor_28_t % period / period - phase_fold_mid, eleanor_28_f_psf, '.', c=color[1], markersize=2,
|
|
1216
|
+
label='28')
|
|
1217
|
+
ax2_4.plot(qlp_27_t % period / period - phase_fold_mid, qlp_27_f, '.', c=color[0], markersize=2, label='27')
|
|
1218
|
+
ax2_4.plot(qlp_28_t % period / period - phase_fold_mid, qlp_28_f, '.', c=color[1], markersize=2, label='28')
|
|
1219
|
+
|
|
1220
|
+
ax2_1.legend(loc=3, fontsize=6)
|
|
1221
|
+
ax2_2.legend(loc=3, fontsize=6)
|
|
1222
|
+
ax2_3.legend(loc=3, fontsize=6)
|
|
1223
|
+
ax2_4.legend(loc=3, fontsize=6)
|
|
1224
|
+
ax2_1.set_ylim(0.988, 1.007)
|
|
1225
|
+
ax2_2.set_ylim(0.988, 1.007)
|
|
1226
|
+
ax2_3.set_ylim(0.988, 1.007)
|
|
1227
|
+
ax2_4.set_ylim(0.988, 1.007)
|
|
1228
|
+
ax2_1.set_xlim(- 0.07, 0.07)
|
|
1229
|
+
ax2_2.set_xlim(- 0.07, 0.07)
|
|
1230
|
+
ax2_3.set_xlim(- 0.07, 0.07)
|
|
1231
|
+
ax2_4.set_xlim(- 0.07, 0.07)
|
|
1232
|
+
ax2_2.set_yticklabels([])
|
|
1233
|
+
ax2_3.set_yticklabels([])
|
|
1234
|
+
ax2_4.set_yticklabels([])
|
|
1235
|
+
ax2_1.set_ylabel('Normalized Flux')
|
|
1236
|
+
ax2_3.text(2.25, 0.5, f'LHS 3844 b', horizontalalignment='center',
|
|
1237
|
+
verticalalignment='center', transform=ax2_3.transAxes, rotation=270, fontweight='semibold')
|
|
1238
|
+
ax2_3.text(2.15, 0.5, 'mag=11.92', horizontalalignment='center',
|
|
1239
|
+
verticalalignment='center', transform=ax2_3.transAxes, rotation=270)
|
|
1240
|
+
#########################################################################
|
|
1241
|
+
# TOI-530
|
|
1242
|
+
tic = 387690507
|
|
1243
|
+
|
|
1244
|
+
# load QLP
|
|
1245
|
+
qlp_6_t, qlp_6_f = load_qlp(ld=local_directory, tic=tic, sector=6)
|
|
1246
|
+
|
|
1247
|
+
# load eleanor
|
|
1248
|
+
eleanor_6_t, eleanor_6_f_pca, eleanor_6_f_psf = load_eleanor(ld=local_directory, tic=tic, sector=6)
|
|
1249
|
+
eleanor_44_t, eleanor_44_f_pca, eleanor_44_f_psf = load_eleanor(ld=local_directory, tic=tic, sector=44)
|
|
1250
|
+
eleanor_45_t, eleanor_45_f_pca, eleanor_45_f_psf = load_eleanor(ld=local_directory, tic=tic, sector=45)
|
|
1251
|
+
|
|
1252
|
+
files = glob(local_directory + 'SPOC/TOI-530/*.fits')
|
|
1253
|
+
index = np.where(data['pl_name'] == 'TOI-530 b')
|
|
1254
|
+
period = 6.387583
|
|
1255
|
+
t_0 = float(data['pl_tranmid'][index])
|
|
1256
|
+
phase_fold_mid = (t_0 - 2457000) % period / period
|
|
1257
|
+
ax3_1 = fig.add_subplot(gs[2, :3])
|
|
1258
|
+
ax3_2 = fig.add_subplot(gs[2, 3:6])
|
|
1259
|
+
ax3_3 = fig.add_subplot(gs[2, 6:9])
|
|
1260
|
+
ax3_4 = fig.add_subplot(gs[2, 9:])
|
|
1261
|
+
|
|
1262
|
+
for i in range(len(files)):
|
|
1263
|
+
with fits.open(files[i], mode='denywrite') as hdul:
|
|
1264
|
+
spoc_t = hdul[1].data['TIME']
|
|
1265
|
+
spoc_f = hdul[1].data['PDCSAP_FLUX']
|
|
1266
|
+
spoc_t = np.mean(spoc_t[:len(spoc_t) // 15 * 15].reshape(-1, 15), axis=1)
|
|
1267
|
+
spoc_f = np.mean(spoc_f[:len(spoc_f) // 15 * 15].reshape(-1, 15), axis=1)
|
|
1268
|
+
ax3_1.plot(spoc_t % period / period - phase_fold_mid, spoc_f / np.nanmedian(spoc_f), '.', c=color[i], ms=2,
|
|
1269
|
+
label=str(hdul[0].header['sector']))
|
|
1270
|
+
ax3_2.plot(eleanor_6_t % period / period - phase_fold_mid, eleanor_6_f_pca, '.', c=color[0], markersize=2,
|
|
1271
|
+
label='6')
|
|
1272
|
+
ax3_2.plot(eleanor_44_t % period / period - phase_fold_mid, eleanor_44_f_pca, '.', c=color[1], markersize=2,
|
|
1273
|
+
label='44')
|
|
1274
|
+
ax3_2.plot(eleanor_45_t % period / period - phase_fold_mid, eleanor_45_f_pca, '.', c=color[2], markersize=2,
|
|
1275
|
+
label='45')
|
|
1276
|
+
ax3_3.plot(eleanor_6_t % period / period - phase_fold_mid, eleanor_6_f_psf, '.', c=color[0], markersize=2,
|
|
1277
|
+
label='6')
|
|
1278
|
+
ax3_3.plot(eleanor_44_t % period / period - phase_fold_mid, eleanor_44_f_psf, '.', c=color[1], markersize=2,
|
|
1279
|
+
label='44')
|
|
1280
|
+
ax3_3.plot(eleanor_45_t % period / period - phase_fold_mid, eleanor_45_f_psf, '.', c=color[2], markersize=2,
|
|
1281
|
+
label='45')
|
|
1282
|
+
ax3_4.plot(qlp_6_t % period / period - phase_fold_mid, qlp_6_f, '.', c=color[0], markersize=2, label='6')
|
|
1283
|
+
|
|
1284
|
+
ax3_1.legend(loc=3, fontsize=6)
|
|
1285
|
+
ax3_2.legend(loc=3, fontsize=6)
|
|
1286
|
+
ax3_3.legend(loc=3, fontsize=6)
|
|
1287
|
+
ax3_4.legend(loc=3, fontsize=6)
|
|
1288
|
+
ax3_1.set_ylim(0.95, 1.03)
|
|
1289
|
+
ax3_2.set_ylim(0.95, 1.03)
|
|
1290
|
+
ax3_3.set_ylim(0.95, 1.03)
|
|
1291
|
+
ax3_4.set_ylim(0.95, 1.03)
|
|
1292
|
+
ax3_1.set_xlim(- 0.03, 0.03)
|
|
1293
|
+
ax3_2.set_xlim(- 0.03, 0.03)
|
|
1294
|
+
ax3_3.set_xlim(- 0.03, 0.03)
|
|
1295
|
+
ax3_4.set_xlim(- 0.03, 0.03)
|
|
1296
|
+
ax3_2.set_yticklabels([])
|
|
1297
|
+
ax3_3.set_yticklabels([])
|
|
1298
|
+
ax3_4.set_yticklabels([])
|
|
1299
|
+
ax3_1.set_ylabel('Normalized Flux')
|
|
1300
|
+
ax3_3.text(2.25, 0.5, 'TOI-530 b', horizontalalignment='center',
|
|
1301
|
+
verticalalignment='center', transform=ax3_3.transAxes, rotation=270, fontweight='semibold')
|
|
1302
|
+
ax3_3.text(2.15, 0.5, 'mag=13.53', horizontalalignment='center',
|
|
1303
|
+
verticalalignment='center', transform=ax3_3.transAxes, rotation=270)
|
|
1304
|
+
#########################################################################
|
|
1305
|
+
# TOI-2406
|
|
1306
|
+
tic = 212957629
|
|
1307
|
+
|
|
1308
|
+
# load QLP
|
|
1309
|
+
qlp_30_t, qlp_30_f = load_qlp(ld=local_directory, tic=tic, sector=30)
|
|
1310
|
+
|
|
1311
|
+
# load eleanor
|
|
1312
|
+
eleanor_3_t, eleanor_3_f_pca, eleanor_3_f_psf = load_eleanor(ld=local_directory, tic=tic, sector=3)
|
|
1313
|
+
eleanor_42_t, eleanor_42_f_pca, eleanor_42_f_psf = load_eleanor(ld=local_directory, tic=tic, sector=42)
|
|
1314
|
+
eleanor_43_t, eleanor_43_f_pca, eleanor_43_f_psf = load_eleanor(ld=local_directory, tic=tic, sector=43)
|
|
1315
|
+
|
|
1316
|
+
files = glob(local_directory + 'SPOC/TOI-2406/*.fits')
|
|
1317
|
+
index = np.where(data['pl_name'] == 'TOI-2406 b')
|
|
1318
|
+
period = 3.076676
|
|
1319
|
+
t_0 = float(data['pl_tranmid'][index])
|
|
1320
|
+
phase_fold_mid = (t_0 - 2457000) % period / period
|
|
1321
|
+
ax4_1 = fig.add_subplot(gs[3, :3])
|
|
1322
|
+
ax4_2 = fig.add_subplot(gs[3, 3:6])
|
|
1323
|
+
ax4_3 = fig.add_subplot(gs[3, 6:9])
|
|
1324
|
+
ax4_4 = fig.add_subplot(gs[3, 9:])
|
|
1325
|
+
|
|
1326
|
+
for i in range(len(files)):
|
|
1327
|
+
with fits.open(files[i], mode='denywrite') as hdul:
|
|
1328
|
+
spoc_t = hdul[1].data['TIME']
|
|
1329
|
+
spoc_f = hdul[1].data['PDCSAP_FLUX']
|
|
1330
|
+
spoc_t = np.mean(spoc_t[:len(spoc_t) // 15 * 15].reshape(-1, 15), axis=1)
|
|
1331
|
+
spoc_f = np.mean(spoc_f[:len(spoc_f) // 15 * 15].reshape(-1, 15), axis=1)
|
|
1332
|
+
ax4_1.plot(spoc_t % period / period - phase_fold_mid, spoc_f / np.nanmedian(spoc_f), '.', c=color[i + 1],
|
|
1333
|
+
ms=2,
|
|
1334
|
+
label=str(hdul[0].header['sector']))
|
|
1335
|
+
ax4_2.plot(eleanor_3_t % period / period - phase_fold_mid, eleanor_3_f_pca, '.', c=color[0], markersize=2,
|
|
1336
|
+
label='3')
|
|
1337
|
+
ax4_2.plot(eleanor_42_t % period / period - phase_fold_mid, eleanor_42_f_pca, '.', c=color[1], markersize=2,
|
|
1338
|
+
label='42')
|
|
1339
|
+
ax4_2.plot(eleanor_43_t % period / period - phase_fold_mid, eleanor_43_f_pca, '.', c=color[2], markersize=2,
|
|
1340
|
+
label='43')
|
|
1341
|
+
ax4_3.plot(eleanor_3_t % period / period - phase_fold_mid, eleanor_3_f_psf, '.', c=color[0], markersize=2,
|
|
1342
|
+
label='3')
|
|
1343
|
+
ax4_3.plot(eleanor_42_t % period / period - phase_fold_mid, eleanor_42_f_psf, '.', c=color[1], markersize=2,
|
|
1344
|
+
label='42')
|
|
1345
|
+
ax4_3.plot(eleanor_43_t % period / period - phase_fold_mid, eleanor_43_f_psf, '.', c=color[2], markersize=2,
|
|
1346
|
+
label='43')
|
|
1347
|
+
ax4_4.plot(qlp_30_t % period / period - phase_fold_mid, qlp_30_f, '.', c=color[0], markersize=2, label='30')
|
|
1348
|
+
|
|
1349
|
+
ax4_1.legend(loc=3, fontsize=6)
|
|
1350
|
+
ax4_2.legend(loc=3, fontsize=6)
|
|
1351
|
+
ax4_3.legend(loc=3, fontsize=6)
|
|
1352
|
+
ax4_4.legend(loc=3, fontsize=6)
|
|
1353
|
+
ax4_1.set_ylim(0.945, 1.04)
|
|
1354
|
+
ax4_2.set_ylim(0.945, 1.04)
|
|
1355
|
+
ax4_3.set_ylim(0.945, 1.04)
|
|
1356
|
+
ax4_4.set_ylim(0.945, 1.04)
|
|
1357
|
+
ax4_1.set_xlim(- 0.04, 0.04)
|
|
1358
|
+
ax4_2.set_xlim(- 0.04, 0.04)
|
|
1359
|
+
ax4_3.set_xlim(- 0.04, 0.04)
|
|
1360
|
+
ax4_4.set_xlim(- 0.04, 0.04)
|
|
1361
|
+
ax4_1.set_xticks([-0.03, 0, 0.03])
|
|
1362
|
+
ax4_1.set_xticklabels(['\N{MINUS SIGN}0.03', '0', '0.03'])
|
|
1363
|
+
ax4_2.set_xticks([-0.03, 0, 0.03])
|
|
1364
|
+
ax4_2.set_xticklabels(['\N{MINUS SIGN}0.03', '0', '0.03'])
|
|
1365
|
+
ax4_3.set_xticks([-0.03, 0, 0.03])
|
|
1366
|
+
ax4_3.set_xticklabels(['\N{MINUS SIGN}0.03', '0', '0.03'])
|
|
1367
|
+
ax4_4.set_xticks([-0.03, 0, 0.03])
|
|
1368
|
+
ax4_4.set_xticklabels(['\N{MINUS SIGN}0.03', '0', '0.03'])
|
|
1369
|
+
ax4_4.set_xlabel('Phase')
|
|
1370
|
+
ax4_2.set_yticklabels([])
|
|
1371
|
+
ax4_3.set_yticklabels([])
|
|
1372
|
+
ax4_4.set_yticklabels([])
|
|
1373
|
+
ax4_1.set_ylabel('Normalized Flux')
|
|
1374
|
+
ax4_3.text(2.25, 0.5, 'TOI-2406 b', horizontalalignment='center',
|
|
1375
|
+
verticalalignment='center', transform=ax4_3.transAxes, rotation=270, fontweight='semibold')
|
|
1376
|
+
ax4_3.text(2.15, 0.5, 'mag=14.31', horizontalalignment='center',
|
|
1377
|
+
verticalalignment='center', transform=ax4_3.transAxes, rotation=270)
|
|
1378
|
+
|
|
1379
|
+
#########################################################################
|
|
1380
|
+
# TOI-519
|
|
1381
|
+
tic = 218795833
|
|
1382
|
+
|
|
1383
|
+
# load eleanor
|
|
1384
|
+
eleanor_7_t, eleanor_7_f_aper, eleanor_7_f_psf = load_eleanor(ld=local_directory, tic=tic, sector=7)
|
|
1385
|
+
eleanor_8_t, eleanor_8_f_aper, eleanor_8_f_psf = load_eleanor(ld=local_directory, tic=tic, sector=8)
|
|
1386
|
+
eleanor_34_t, eleanor_34_f_aper, eleanor_34_f_psf = load_eleanor(ld=local_directory, tic=tic, sector=34)
|
|
1387
|
+
|
|
1388
|
+
files = glob(local_directory + 'SPOC/TOI-519/*.fits')
|
|
1389
|
+
index = np.where(data['pl_name'] == 'TOI-519 b')
|
|
1390
|
+
period = 1.265232
|
|
1391
|
+
t_0 = float(data['pl_tranmid'][index])
|
|
1392
|
+
phase_fold_mid = (t_0 - 2457000) % period / period
|
|
1393
|
+
ax5_1 = fig.add_subplot(gs[4, :3])
|
|
1394
|
+
ax5_2 = fig.add_subplot(gs[4, 3:6])
|
|
1395
|
+
ax5_3 = fig.add_subplot(gs[4, 6:9])
|
|
1396
|
+
# ax5_4 = fig.add_subplot(gs[4, 9:])
|
|
1397
|
+
|
|
1398
|
+
for i in range(len(files)):
|
|
1399
|
+
with fits.open(files[i], mode='denywrite') as hdul:
|
|
1400
|
+
if hdul[0].header['sector'] == 34:
|
|
1401
|
+
i = i + 1
|
|
1402
|
+
spoc_t = hdul[1].data['TIME']
|
|
1403
|
+
spoc_f = hdul[1].data['PDCSAP_FLUX']
|
|
1404
|
+
spoc_t = np.mean(spoc_t[:len(spoc_t) // 15 * 15].reshape(-1, 15), axis=1)
|
|
1405
|
+
spoc_f = np.mean(spoc_f[:len(spoc_f) // 15 * 15].reshape(-1, 15), axis=1)
|
|
1406
|
+
ax5_1.plot(spoc_t % period / period - phase_fold_mid, spoc_f / np.nanmedian(spoc_f), '.', c=color[i], ms=2,
|
|
1407
|
+
label=str(hdul[0].header['sector']))
|
|
1408
|
+
ax5_2.plot(eleanor_7_t % period / period - phase_fold_mid, eleanor_7_f_aper, '.', c=color[0], markersize=2,
|
|
1409
|
+
label='7')
|
|
1410
|
+
ax5_2.plot(eleanor_8_t % period / period - phase_fold_mid, eleanor_8_f_aper, '.', c=color[1], markersize=2,
|
|
1411
|
+
label='8')
|
|
1412
|
+
ax5_2.plot(eleanor_34_t % period / period - phase_fold_mid, eleanor_34_f_aper, '.', c=color[2], markersize=2,
|
|
1413
|
+
label='34')
|
|
1414
|
+
# ax5_3.plot(eleanor_7_t % period / period - phase_fold_mid, eleanor_7_f_psf, '.', c=color[0], markersize=2,
|
|
1415
|
+
# label='7')
|
|
1416
|
+
# ax5_3.plot(eleanor_8_t % period / period - phase_fold_mid, eleanor_8_f_psf, '.', c=color[1], markersize=2,
|
|
1417
|
+
# label='8')
|
|
1418
|
+
ax5_3.plot(eleanor_34_t % period / period - phase_fold_mid, eleanor_34_f_psf, '.', c=color[2], markersize=2,
|
|
1419
|
+
label='34')
|
|
1420
|
+
|
|
1421
|
+
ax5_1.legend(loc=3, fontsize=6)
|
|
1422
|
+
ax5_2.legend(loc=3, fontsize=6)
|
|
1423
|
+
ax5_3.legend(loc=3, fontsize=6)
|
|
1424
|
+
ax5_1.set_ylim(0.83, 1.05)
|
|
1425
|
+
ax5_2.set_ylim(0.83, 1.05)
|
|
1426
|
+
ax5_3.set_ylim(0.83, 1.05)
|
|
1427
|
+
ax5_1.set_xlim(- 0.05, 0.05)
|
|
1428
|
+
ax5_2.set_xlim(- 0.05, 0.05)
|
|
1429
|
+
ax5_3.set_xlim(- 0.05, 0.05)
|
|
1430
|
+
ax5_1.set_yticks([0.9, 1.0])
|
|
1431
|
+
ax5_1.set_yticklabels(['0.90', '1.00'])
|
|
1432
|
+
ax5_1.set_xticks([-0.03, 0, 0.03])
|
|
1433
|
+
ax5_1.set_xticklabels(['\N{MINUS SIGN}0.03', '0', '0.03'])
|
|
1434
|
+
ax5_2.set_xticks([-0.03, 0, 0.03])
|
|
1435
|
+
ax5_2.set_xticklabels(['\N{MINUS SIGN}0.03', '0', '0.03'])
|
|
1436
|
+
ax5_3.set_xticks([-0.03, 0, 0.03])
|
|
1437
|
+
ax5_3.set_xticklabels(['\N{MINUS SIGN}0.03', '0', '0.03'])
|
|
1438
|
+
ax5_2.set_yticklabels([])
|
|
1439
|
+
ax5_3.set_yticklabels([])
|
|
1440
|
+
ax5_1.set_xlabel('Phase')
|
|
1441
|
+
ax5_2.set_xlabel('Phase')
|
|
1442
|
+
ax5_3.set_xlabel('Phase')
|
|
1443
|
+
ax5_1.set_ylabel('Normalized Flux')
|
|
1444
|
+
ax5_3.text(2.25, 0.5, 'TOI-519 b', horizontalalignment='center',
|
|
1445
|
+
verticalalignment='center', transform=ax5_3.transAxes, rotation=270, fontweight='semibold')
|
|
1446
|
+
ax5_3.text(2.15, 0.5, 'mag=14.43', horizontalalignment='center',
|
|
1447
|
+
verticalalignment='center', transform=ax5_3.transAxes, rotation=270)
|
|
1448
|
+
# ax5_1.set_yticklabels([])
|
|
1449
|
+
|
|
1450
|
+
# plt.savefig('/mnt/c/users/tehan/desktop/known_exoplanets_other.png', bbox_inches='tight', dpi=300)
|
|
1451
|
+
plt.show()
|
|
1452
|
+
|
|
1453
|
+
|
|
1454
|
+
def figure_8():
|
|
1455
|
+
local_directory = '/mnt/c/users/tehan/desktop/NGC 7654/'
|
|
1456
|
+
fig = plt.figure(constrained_layout=False, figsize=(10, 7))
|
|
1457
|
+
gs = fig.add_gridspec(5, 12)
|
|
1458
|
+
gs.update(wspace=0.2, hspace=0.2)
|
|
1459
|
+
index = [77, 469, 699, 1251, 1585]
|
|
1460
|
+
# TIC 270022476
|
|
1461
|
+
tic = 270022476
|
|
1462
|
+
with fits.open(f'{local_directory}lc/hlsp_tglc_tess_ffi_gaiaid-2015669349341459328-s0017_tess_v1_llc.fits',
|
|
1463
|
+
mode='denywrite') as hdul:
|
|
1464
|
+
q = hdul[1].data['TGLC_flags'] == 0
|
|
1465
|
+
t = hdul[1].data['time'][q]
|
|
1466
|
+
f = hdul[1].data['cal_psf_flux'][q]
|
|
1467
|
+
|
|
1468
|
+
eleanor_t, eleanor_f_pca, eleanor_f_psf = load_eleanor(ld=local_directory, tic=tic, sector=17)
|
|
1469
|
+
qlp_t, qlp_f = load_qlp(ld=local_directory, tic=tic, sector=17)
|
|
1470
|
+
ztf_g_t, ztf_g_flux = load_ztf(ld=local_directory, index=index[0])
|
|
1471
|
+
|
|
1472
|
+
period = 1.9221
|
|
1473
|
+
ax1_1 = fig.add_subplot(gs[0, :3])
|
|
1474
|
+
ax1_2 = fig.add_subplot(gs[0, 3:6])
|
|
1475
|
+
ax1_3 = fig.add_subplot(gs[0, 6:9])
|
|
1476
|
+
ax1_4 = fig.add_subplot(gs[0, 9:])
|
|
1477
|
+
ax1_1.plot(t % period / period, f, '.', c='k', markersize=1, zorder=3)
|
|
1478
|
+
ax1_1.plot(ztf_g_t % period / period, ztf_g_flux / np.median(ztf_g_flux), 'x', color='green', ms=2,
|
|
1479
|
+
label='ZTF g-band')
|
|
1480
|
+
ax1_2.plot(eleanor_t % period / period, eleanor_f_pca, '.', c='k', markersize=1)
|
|
1481
|
+
ax1_3.plot(eleanor_t % period / period, eleanor_f_psf, '.', c='k', markersize=1)
|
|
1482
|
+
ax1_4.plot(qlp_t % period / period, qlp_f, '.', c='k', markersize=1)
|
|
1483
|
+
|
|
1484
|
+
ax1_1.set_xticklabels([])
|
|
1485
|
+
ax1_2.set_xticklabels([])
|
|
1486
|
+
ax1_3.set_xticklabels([])
|
|
1487
|
+
ax1_4.set_xticklabels([])
|
|
1488
|
+
ax1_2.set_yticklabels([])
|
|
1489
|
+
ax1_3.set_yticklabels([])
|
|
1490
|
+
ax1_4.set_yticklabels([])
|
|
1491
|
+
ax1_1.set_ylim(0.88, 1.03)
|
|
1492
|
+
ax1_2.set_ylim(0.88, 1.03)
|
|
1493
|
+
ax1_3.set_ylim(0.88, 1.03)
|
|
1494
|
+
ax1_4.set_ylim(0.88, 1.03)
|
|
1495
|
+
ax1_1.set_title('TGLC PSF')
|
|
1496
|
+
ax1_2.set_title('eleanor CORR')
|
|
1497
|
+
ax1_3.set_title('eleanor PSF')
|
|
1498
|
+
ax1_4.set_title('QLP')
|
|
1499
|
+
ax1_1.set_ylabel('Norm Flux')
|
|
1500
|
+
ax1_3.text(2.25, 0.5, f'TIC \n{tic}', horizontalalignment='center',
|
|
1501
|
+
verticalalignment='center', transform=ax1_3.transAxes, rotation=270, fontweight='semibold')
|
|
1502
|
+
ax1_3.text(2.12, 0.5, 'mag=11.52', horizontalalignment='center',
|
|
1503
|
+
verticalalignment='center', transform=ax1_3.transAxes, rotation=270)
|
|
1504
|
+
|
|
1505
|
+
# TIC 270140796
|
|
1506
|
+
tic = 270140796
|
|
1507
|
+
with fits.open(f'{local_directory}lc/hlsp_tglc_tess_ffi_gaiaid-2015671415229352192-s0017_tess_v1_llc.fits',
|
|
1508
|
+
mode='denywrite') as hdul:
|
|
1509
|
+
q = hdul[1].data['TGLC_flags'] == 0
|
|
1510
|
+
t = hdul[1].data['time'][q]
|
|
1511
|
+
f = hdul[1].data['cal_psf_flux'][q]
|
|
1512
|
+
eleanor_t, eleanor_f_pca, eleanor_f_psf = load_eleanor(ld=local_directory, tic=tic, sector=17)
|
|
1513
|
+
qlp_t, qlp_f = load_qlp(ld=local_directory, tic=tic, sector=17)
|
|
1514
|
+
ztf_g_t, ztf_g_flux, ztf_r_t, ztf_r_flux = load_ztf(ld=local_directory, index=index[1])
|
|
1515
|
+
|
|
1516
|
+
period = 6.126
|
|
1517
|
+
ax2_1 = fig.add_subplot(gs[1, :3])
|
|
1518
|
+
ax2_2 = fig.add_subplot(gs[1, 3:6])
|
|
1519
|
+
ax2_3 = fig.add_subplot(gs[1, 6:9])
|
|
1520
|
+
ax2_4 = fig.add_subplot(gs[1, 9:])
|
|
1521
|
+
ax2_1.plot(t % period / period, f, '.', c='k', markersize=1, zorder=3)
|
|
1522
|
+
ax2_1.plot(ztf_g_t % period / period, ztf_g_flux / np.median(ztf_g_flux), 'x', color='green', ms=2,
|
|
1523
|
+
label='ZTF g-band')
|
|
1524
|
+
ax2_1.scatter(ztf_r_t % period / period, ztf_r_flux / np.median(ztf_r_flux), facecolors='none',
|
|
1525
|
+
edgecolors='orangered', s=3, label='ZTF r-band')
|
|
1526
|
+
ax2_2.plot(eleanor_t % period / period, eleanor_f_pca, '.', c='k', markersize=1)
|
|
1527
|
+
ax2_3.plot(eleanor_t % period / period, eleanor_f_psf, '.', c='k', markersize=1)
|
|
1528
|
+
ax2_4.plot(qlp_t % period / period, qlp_f, '.', c='k', markersize=1)
|
|
1529
|
+
|
|
1530
|
+
ax2_1.set_xticklabels([])
|
|
1531
|
+
ax2_2.set_xticklabels([])
|
|
1532
|
+
ax2_3.set_xticklabels([])
|
|
1533
|
+
ax2_2.set_yticklabels([])
|
|
1534
|
+
ax2_3.set_yticklabels([])
|
|
1535
|
+
ax2_4.set_yticklabels([])
|
|
1536
|
+
ax2_1.set_ylim(0.80, 1.05)
|
|
1537
|
+
ax2_2.set_ylim(0.80, 1.05)
|
|
1538
|
+
ax2_3.set_ylim(0.80, 1.05)
|
|
1539
|
+
ax2_4.set_ylim(0.80, 1.05)
|
|
1540
|
+
ax2_4.set_xlabel('Phase')
|
|
1541
|
+
ax2_1.set_ylabel('Norm Flux')
|
|
1542
|
+
ax2_3.text(2.25, 0.5, f'TIC \n{tic}', horizontalalignment='center',
|
|
1543
|
+
verticalalignment='center', transform=ax2_3.transAxes, rotation=270, fontweight='semibold')
|
|
1544
|
+
ax2_3.text(2.12, 0.5, 'mag=13.44', horizontalalignment='center',
|
|
1545
|
+
verticalalignment='center', transform=ax2_3.transAxes, rotation=270)
|
|
1546
|
+
|
|
1547
|
+
# TIC 269820902
|
|
1548
|
+
tic = 269820902
|
|
1549
|
+
with fits.open(f'{local_directory}lc/hlsp_tglc_tess_ffi_gaiaid-2015648943960251008-s0017_tess_v1_llc.fits',
|
|
1550
|
+
mode='denywrite') as hdul:
|
|
1551
|
+
q = hdul[1].data['TGLC_flags'] == 0
|
|
1552
|
+
t = hdul[1].data['time'][q]
|
|
1553
|
+
f = hdul[1].data['cal_psf_flux'][q]
|
|
1554
|
+
eleanor_t, eleanor_f_pca, eleanor_f_psf = load_eleanor(ld=local_directory, tic=tic, sector=17)
|
|
1555
|
+
ztf_g_t, ztf_g_flux, ztf_r_t, ztf_r_flux = load_ztf(ld=local_directory, index=index[2])
|
|
1556
|
+
period = 1.01968
|
|
1557
|
+
ax3_1 = fig.add_subplot(gs[2, :3])
|
|
1558
|
+
ax3_2 = fig.add_subplot(gs[2, 3:6])
|
|
1559
|
+
ax3_3 = fig.add_subplot(gs[2, 6:9])
|
|
1560
|
+
# ax3_4 = fig.add_subplot(gs[2, 9:])
|
|
1561
|
+
ax3_1.plot(t % period / period, f, '.', c='k', markersize=1, zorder=3)
|
|
1562
|
+
ax3_1.plot(ztf_g_t % period / period, ztf_g_flux / np.median(ztf_g_flux), 'x', color='green', ms=2,
|
|
1563
|
+
label='ZTF g-band')
|
|
1564
|
+
ax3_1.scatter(ztf_r_t % period / period, ztf_r_flux / np.median(ztf_r_flux), facecolors='none',
|
|
1565
|
+
edgecolors='orangered', s=3, label='ZTF r-band')
|
|
1566
|
+
ax3_2.plot(eleanor_t % period / period, eleanor_f_pca, '.', c='k', markersize=1)
|
|
1567
|
+
ax3_3.plot(eleanor_t % period / period, eleanor_f_psf, '.', c='k', markersize=1)
|
|
1568
|
+
|
|
1569
|
+
ax3_1.set_xticklabels([])
|
|
1570
|
+
ax3_2.set_xticklabels([])
|
|
1571
|
+
ax3_3.set_xticklabels([])
|
|
1572
|
+
ax3_2.set_yticklabels([])
|
|
1573
|
+
ax3_3.set_yticklabels([])
|
|
1574
|
+
# ax3_4.set_yticklabels([])
|
|
1575
|
+
ax3_1.set_ylim(0.85, 1.05)
|
|
1576
|
+
ax3_2.set_ylim(0.85, 1.05)
|
|
1577
|
+
ax3_3.set_ylim(0.85, 1.05)
|
|
1578
|
+
ax3_1.set_ylabel('Norm Flux')
|
|
1579
|
+
ax3_3.text(2.25, 0.5, f'TIC \n{tic}', horizontalalignment='center',
|
|
1580
|
+
verticalalignment='center', transform=ax3_3.transAxes, rotation=270, fontweight='semibold')
|
|
1581
|
+
ax3_3.text(2.12, 0.5, 'mag=13.90', horizontalalignment='center',
|
|
1582
|
+
verticalalignment='center', transform=ax3_3.transAxes, rotation=270)
|
|
1583
|
+
|
|
1584
|
+
# TIC 270023061
|
|
1585
|
+
tic = 270023061
|
|
1586
|
+
with fits.open(f'{local_directory}lc/hlsp_tglc_tess_ffi_gaiaid-2015656743621212928-s0017_tess_v1_llc.fits',
|
|
1587
|
+
mode='denywrite') as hdul:
|
|
1588
|
+
q = hdul[1].data['TGLC_flags'] == 0
|
|
1589
|
+
t = hdul[1].data['time'][q]
|
|
1590
|
+
f = hdul[1].data['cal_psf_flux'][q]
|
|
1591
|
+
eleanor_t, eleanor_f_pca, eleanor_f_psf = load_eleanor(ld=local_directory, tic=tic, sector=17)
|
|
1592
|
+
ztf_g_t, ztf_g_flux, ztf_r_t, ztf_r_flux = load_ztf(ld=local_directory, index=index[3])
|
|
1593
|
+
period = 2.2895
|
|
1594
|
+
ax4_1 = fig.add_subplot(gs[3, :3])
|
|
1595
|
+
ax4_2 = fig.add_subplot(gs[3, 3:6])
|
|
1596
|
+
ax4_3 = fig.add_subplot(gs[3, 6:9])
|
|
1597
|
+
# ax4_4 = fig.add_subplot(gs[3, 9:])
|
|
1598
|
+
ax4_1.plot(t % period / period, f, '.', c='k', markersize=1, zorder=3)
|
|
1599
|
+
ax4_1.plot(ztf_g_t % period / period, ztf_g_flux / np.median(ztf_g_flux), 'x', color='green', ms=2,
|
|
1600
|
+
label='ZTF g-band')
|
|
1601
|
+
ax4_1.scatter(ztf_r_t % period / period, ztf_r_flux / np.median(ztf_r_flux), facecolors='none',
|
|
1602
|
+
edgecolors='orangered', s=3, label='ZTF r-band')
|
|
1603
|
+
ax4_2.plot(eleanor_t % period / period, eleanor_f_pca, '.', c='k', markersize=1)
|
|
1604
|
+
ax4_3.plot(eleanor_t % period / period, eleanor_f_psf, '.', c='k', markersize=1)
|
|
1605
|
+
|
|
1606
|
+
ax4_1.set_xticklabels([])
|
|
1607
|
+
ax4_2.set_xticklabels([])
|
|
1608
|
+
ax4_3.set_xticklabels([])
|
|
1609
|
+
ax4_2.set_yticklabels([])
|
|
1610
|
+
ax4_3.set_yticklabels([])
|
|
1611
|
+
# ax4_4.set_yticklabels([])
|
|
1612
|
+
ax4_1.set_ylim(0.6, 1.12)
|
|
1613
|
+
ax4_2.set_ylim(0.6, 1.12)
|
|
1614
|
+
ax4_3.set_ylim(0.6, 1.12)
|
|
1615
|
+
ax4_1.set_ylabel('Norm Flux')
|
|
1616
|
+
ax4_3.text(2.25, 0.5, f'TIC \n{tic}', horizontalalignment='center',
|
|
1617
|
+
verticalalignment='center', transform=ax4_3.transAxes, rotation=270, fontweight='semibold')
|
|
1618
|
+
ax4_3.text(2.12, 0.5, 'mag=14.71', horizontalalignment='center',
|
|
1619
|
+
verticalalignment='center', transform=ax4_3.transAxes, rotation=270)
|
|
1620
|
+
|
|
1621
|
+
# TIC 269820513
|
|
1622
|
+
tic = 269820513
|
|
1623
|
+
with fits.open(f'{local_directory}lc/hlsp_tglc_tess_ffi_gaiaid-2015457010457210752-s0017_tess_v1_llc.fits',
|
|
1624
|
+
mode='denywrite') as hdul:
|
|
1625
|
+
q = hdul[1].data['TGLC_flags'] == 0
|
|
1626
|
+
t = hdul[1].data['time'][q]
|
|
1627
|
+
f = hdul[1].data['cal_psf_flux'][q]
|
|
1628
|
+
eleanor_t, eleanor_f_pca, eleanor_f_psf = load_eleanor(ld=local_directory, tic=tic, sector=17)
|
|
1629
|
+
ztf_g_t, ztf_g_flux, ztf_r_t, ztf_r_flux = load_ztf(ld=local_directory, index=index[4])
|
|
1630
|
+
period = 6.558
|
|
1631
|
+
ax5_1 = fig.add_subplot(gs[4, :3])
|
|
1632
|
+
ax5_2 = fig.add_subplot(gs[4, 3:6])
|
|
1633
|
+
ax5_3 = fig.add_subplot(gs[4, 6:9])
|
|
1634
|
+
# ax5_4 = fig.add_subplot(gs[4, 9:])
|
|
1635
|
+
ax5_1.plot(t % period / period, f, '.', c='k', markersize=1, zorder=3, label='TESS FFI')
|
|
1636
|
+
ax5_1.plot(ztf_g_t % period / period, ztf_g_flux / np.median(ztf_g_flux), 'x', color='green', ms=2,
|
|
1637
|
+
label='ZTF g-band')
|
|
1638
|
+
ax5_1.scatter(ztf_r_t % period / period, ztf_r_flux / np.median(ztf_r_flux), facecolors='none',
|
|
1639
|
+
edgecolors='orangered', s=3, label='ZTF r-band')
|
|
1640
|
+
ax5_2.plot(eleanor_t % period / period, eleanor_f_pca, '.', c='k', markersize=1)
|
|
1641
|
+
ax5_3.plot(eleanor_t % period / period, eleanor_f_psf, '.', c='k', markersize=1)
|
|
1642
|
+
|
|
1643
|
+
ax5_2.set_yticklabels([])
|
|
1644
|
+
ax5_3.set_yticklabels([])
|
|
1645
|
+
# ax5_4.set_yticklabels([])
|
|
1646
|
+
ax5_1.set_ylim(0.72, 1.06)
|
|
1647
|
+
ax5_2.set_ylim(0.72, 1.06)
|
|
1648
|
+
ax5_3.set_ylim(0.72, 1.06)
|
|
1649
|
+
ax5_1.set_xlabel('Phase')
|
|
1650
|
+
ax5_2.set_xlabel('Phase')
|
|
1651
|
+
ax5_3.set_xlabel('Phase')
|
|
1652
|
+
ax5_1.set_ylabel('Norm Flux')
|
|
1653
|
+
ax5_3.text(2.25, 0.5, f'TIC \n{tic}', horizontalalignment='center',
|
|
1654
|
+
verticalalignment='center', transform=ax5_3.transAxes, rotation=270, fontweight='semibold')
|
|
1655
|
+
ax5_3.text(2.12, 0.5, 'mag=15.03', horizontalalignment='center',
|
|
1656
|
+
verticalalignment='center', transform=ax5_3.transAxes, rotation=270)
|
|
1657
|
+
ax5_1.legend(bbox_to_anchor=(3.3, 0), loc=3, markerscale=2)
|
|
1658
|
+
# plt.savefig('/mnt/c/users/tehan/desktop/EB_comparison.png', bbox_inches='tight', dpi=300)
|
|
1659
|
+
plt.show()
|
|
1660
|
+
|
|
1661
|
+
|
|
1662
|
+
def figure_9():
|
|
1663
|
+
local_directory = '/mnt/c/users/tehan/desktop/known_exoplanet/'
|
|
1664
|
+
data = ascii.read(local_directory + 'PS_2022.04.17_18.23.57_.csv')
|
|
1665
|
+
fig = plt.figure(constrained_layout=False, figsize=(10, 8))
|
|
1666
|
+
gs = fig.add_gridspec(5, 10)
|
|
1667
|
+
gs.update(wspace=0.1, hspace=0.3)
|
|
1668
|
+
color = ['C0', 'C1', 'C3']
|
|
1669
|
+
|
|
1670
|
+
#########################################################################
|
|
1671
|
+
# TOI-674
|
|
1672
|
+
tic = 158588995
|
|
1673
|
+
|
|
1674
|
+
# load QLP
|
|
1675
|
+
qlp_9_t, qlp_9_f = load_qlp(ld=local_directory, tic=tic, sector=9)
|
|
1676
|
+
qlp_10_t, qlp_10_f = load_qlp(ld=local_directory, tic=tic, sector=10)
|
|
1677
|
+
qlp_36_t, qlp_36_f = load_qlp(ld=local_directory, tic=tic, sector=36)
|
|
1678
|
+
|
|
1679
|
+
# load eleanor
|
|
1680
|
+
eleanor_9_t, eleanor_9_f_pca, eleanor_9_f_psf = load_eleanor(ld=local_directory, tic=tic, sector=9)
|
|
1681
|
+
eleanor_10_t, eleanor_10_f_pca, eleanor_10_f_psf = load_eleanor(ld=local_directory, tic=tic, sector=10)
|
|
1682
|
+
eleanor_36_t, eleanor_36_f_pca, eleanor_36_f_psf = load_eleanor(ld=local_directory, tic=tic, sector=36)
|
|
1683
|
+
|
|
1684
|
+
# load TGLC
|
|
1685
|
+
with fits.open(glob(f'{local_directory}lc/hlsp_tglc_tess_ffi_gaiaid-5400949450924312576-s0009*.fits')[0],
|
|
1686
|
+
mode='denywrite') as hdul:
|
|
1687
|
+
q = list(hdul[1].data['TESS_flags'] == 0) and list(hdul[1].data['TGLC_flags'] == 0)
|
|
1688
|
+
t_09 = hdul[1].data['time'][q]
|
|
1689
|
+
f_psf_09 = hdul[1].data['cal_psf_flux'][q]
|
|
1690
|
+
f_aper_09 = hdul[1].data['cal_aper_flux'][q]
|
|
1691
|
+
with fits.open(glob(f'{local_directory}lc/hlsp_tglc_tess_ffi_gaiaid-5400949450924312576-s0010*.fits')[0],
|
|
1692
|
+
mode='denywrite') as hdul:
|
|
1693
|
+
q = list(hdul[1].data['TESS_flags'] == 0) and list(hdul[1].data['TGLC_flags'] == 0)
|
|
1694
|
+
t_10 = hdul[1].data['time'][q]
|
|
1695
|
+
f_psf_10 = hdul[1].data['cal_psf_flux'][q]
|
|
1696
|
+
f_aper_10 = hdul[1].data['cal_aper_flux'][q]
|
|
1697
|
+
with fits.open(glob(f'{local_directory}lc/hlsp_tglc_tess_ffi_gaiaid-5400949450924312576-s0036*.fits')[0],
|
|
1698
|
+
mode='denywrite') as hdul:
|
|
1699
|
+
q = list(hdul[1].data['TESS_flags'] == 0) and list(hdul[1].data['TGLC_flags'] == 0)
|
|
1700
|
+
t_36 = hdul[1].data['time'][q]
|
|
1701
|
+
f_psf_36 = hdul[1].data['cal_psf_flux'][q]
|
|
1702
|
+
f_aper_36 = hdul[1].data['cal_aper_flux'][q]
|
|
1703
|
+
t_36 = np.mean(t_36[:len(t_36) // 3 * 3].reshape(-1, 3), axis=1)
|
|
1704
|
+
f_psf_36 = np.mean(f_psf_36[:len(f_psf_36) // 3 * 3].reshape(-1, 3), axis=1)
|
|
1705
|
+
f_aper_36 = np.mean(f_aper_36[:len(f_aper_36) // 3 * 3].reshape(-1, 3), axis=1)
|
|
1706
|
+
|
|
1707
|
+
files = glob(local_directory + 'SPOC/TOI-674/*.fits')
|
|
1708
|
+
index = np.where(data['pl_name'] == 'TOI-674 b')
|
|
1709
|
+
period = 1.977165
|
|
1710
|
+
t_0 = float(data['pl_tranmid'][index])
|
|
1711
|
+
phase_fold_mid = (t_0 - 2457000) % period / period
|
|
1712
|
+
ax1_1 = fig.add_subplot(gs[0, :2])
|
|
1713
|
+
ax1_2 = fig.add_subplot(gs[0, 2:4])
|
|
1714
|
+
# ax1_3 = fig.add_subplot(gs[0, 6:9])
|
|
1715
|
+
ax1_4 = fig.add_subplot(gs[0, 4:6])
|
|
1716
|
+
ax1_5 = fig.add_subplot(gs[0, 6:8])
|
|
1717
|
+
ax1_6 = fig.add_subplot(gs[0, 8:])
|
|
1718
|
+
|
|
1719
|
+
for i in range(len(files)):
|
|
1720
|
+
with fits.open(files[i], mode='denywrite') as hdul:
|
|
1721
|
+
spoc_t = hdul[1].data['TIME']
|
|
1722
|
+
spoc_f = hdul[1].data['PDCSAP_FLUX']
|
|
1723
|
+
spoc_t = np.mean(spoc_t[:len(spoc_t) // 15 * 15].reshape(-1, 15), axis=1)
|
|
1724
|
+
spoc_f = np.mean(spoc_f[:len(spoc_f) // 15 * 15].reshape(-1, 15), axis=1)
|
|
1725
|
+
ax1_1.plot(spoc_t % period / period - phase_fold_mid, spoc_f / np.nanmedian(spoc_f), '.', c=color[i], ms=2,
|
|
1726
|
+
label=str(hdul[0].header['sector']))
|
|
1727
|
+
ax1_2.plot(eleanor_9_t % period / period - phase_fold_mid, eleanor_9_f_pca, '.', c=color[0], markersize=2,
|
|
1728
|
+
label='9')
|
|
1729
|
+
ax1_2.plot(eleanor_10_t % period / period - phase_fold_mid, eleanor_10_f_pca, '.', c=color[1], markersize=2,
|
|
1730
|
+
label='10')
|
|
1731
|
+
ax1_2.plot(eleanor_36_t % period / period - phase_fold_mid, eleanor_36_f_pca, '.', c=color[2], markersize=2,
|
|
1732
|
+
label='36')
|
|
1733
|
+
# ax1_3.plot(eleanor_9_t % period / period - phase_fold_mid, eleanor_9_f_psf, '.', c=color[0], markersize=2,
|
|
1734
|
+
# label='9')
|
|
1735
|
+
# ax1_3.plot(eleanor_10_t % period / period - phase_fold_mid, eleanor_10_f_psf, '.', c=color[1], markersize=2,
|
|
1736
|
+
# label='10')
|
|
1737
|
+
# ax1_3.plot(eleanor_36_t % period / period - phase_fold_mid, eleanor_36_f_psf, '.', c=color[2], markersize=2,
|
|
1738
|
+
# label='36')
|
|
1739
|
+
ax1_4.plot(qlp_9_t % period / period - phase_fold_mid, qlp_9_f, '.', c=color[0], markersize=2, label='9')
|
|
1740
|
+
ax1_4.plot(qlp_10_t % period / period - phase_fold_mid, qlp_10_f, '.', c=color[1], markersize=2, label='10')
|
|
1741
|
+
ax1_4.plot(qlp_36_t % period / period - phase_fold_mid, qlp_36_f, '.', c=color[2], markersize=2, label='36')
|
|
1742
|
+
|
|
1743
|
+
ax1_5.plot(t_09 % period / period - phase_fold_mid, f_aper_09, '.', c=color[0], markersize=2, label='9')
|
|
1744
|
+
ax1_5.plot(t_10 % period / period - phase_fold_mid, f_aper_10, '.', c=color[1], markersize=2, label='10')
|
|
1745
|
+
ax1_5.plot(t_36 % period / period - phase_fold_mid, f_aper_36, '.', c=color[2], markersize=2, label='36')
|
|
1746
|
+
|
|
1747
|
+
ax1_6.plot(t_09 % period / period - phase_fold_mid, f_psf_09, '.', c=color[0], markersize=2, label='9')
|
|
1748
|
+
ax1_6.plot(t_10 % period / period - phase_fold_mid, f_psf_10, '.', c=color[1], markersize=2, label='10')
|
|
1749
|
+
ax1_6.plot(t_36 % period / period - phase_fold_mid, f_psf_36, '.', c=color[2], markersize=2, label='36')
|
|
1750
|
+
|
|
1751
|
+
ax1_1.legend(loc=3, fontsize=6)
|
|
1752
|
+
ax1_2.legend(loc=3, fontsize=6)
|
|
1753
|
+
# ax1_3.legend(loc=3, fontsize=6)
|
|
1754
|
+
ax1_4.legend(loc=3, fontsize=6)
|
|
1755
|
+
ax1_5.legend(loc=3, fontsize=6)
|
|
1756
|
+
ax1_6.legend(loc=3, fontsize=6)
|
|
1757
|
+
ax1_1.set_ylim(0.975, 1.01)
|
|
1758
|
+
ax1_2.set_ylim(0.975, 1.01)
|
|
1759
|
+
# ax1_3.set_ylim(0.975, 1.01)
|
|
1760
|
+
ax1_4.set_ylim(0.975, 1.01)
|
|
1761
|
+
ax1_5.set_ylim(0.975, 1.01)
|
|
1762
|
+
ax1_6.set_ylim(0.975, 1.01)
|
|
1763
|
+
ax1_1.set_xlim(- 0.03, 0.03)
|
|
1764
|
+
ax1_2.set_xlim(- 0.03, 0.03)
|
|
1765
|
+
# ax1_3.set_xlim(- 0.03, 0.03)
|
|
1766
|
+
ax1_4.set_xlim(- 0.03, 0.03)
|
|
1767
|
+
ax1_5.set_xlim(- 0.03, 0.03)
|
|
1768
|
+
ax1_6.set_xlim(- 0.03, 0.03)
|
|
1769
|
+
ax1_2.set_yticklabels([])
|
|
1770
|
+
# ax1_3.set_yticklabels([])
|
|
1771
|
+
ax1_4.set_yticklabels([])
|
|
1772
|
+
ax1_5.set_yticklabels([])
|
|
1773
|
+
ax1_6.set_yticklabels([])
|
|
1774
|
+
|
|
1775
|
+
ax1_1.set_title('SPOC 2-min')
|
|
1776
|
+
ax1_2.set_title('eleanor CORR')
|
|
1777
|
+
# ax1_3.set_title('eleanor PSF')
|
|
1778
|
+
ax1_4.set_title('QLP')
|
|
1779
|
+
ax1_5.set_title('TGLC aperture', weight='bold')
|
|
1780
|
+
ax1_6.set_title('TGLC PSF', weight='bold')
|
|
1781
|
+
ax1_1.set_ylabel('Normalized Flux')
|
|
1782
|
+
ax1_5.text(2.25, 0.5, f'TOI-674 b', horizontalalignment='center',
|
|
1783
|
+
verticalalignment='center', transform=ax1_5.transAxes, rotation=270, fontweight='semibold')
|
|
1784
|
+
ax1_5.text(2.15, 0.5, 'mag=11.88', horizontalalignment='center',
|
|
1785
|
+
verticalalignment='center', transform=ax1_5.transAxes, rotation=270)
|
|
1786
|
+
|
|
1787
|
+
#########################################################################
|
|
1788
|
+
# LHS 3844
|
|
1789
|
+
tic = 410153553
|
|
1790
|
+
|
|
1791
|
+
# load QLP
|
|
1792
|
+
qlp_27_t, qlp_27_f = load_qlp(ld=local_directory, tic=tic, sector=27)
|
|
1793
|
+
qlp_28_t, qlp_28_f = load_qlp(ld=local_directory, tic=tic, sector=28)
|
|
1794
|
+
|
|
1795
|
+
# load eleanor
|
|
1796
|
+
eleanor_27_t, eleanor_27_f_pca, eleanor_27_f_psf = load_eleanor(ld=local_directory, tic=tic, sector=27)
|
|
1797
|
+
eleanor_28_t, eleanor_28_f_pca, eleanor_28_f_psf = load_eleanor(ld=local_directory, tic=tic, sector=28)
|
|
1798
|
+
|
|
1799
|
+
# load TGLC
|
|
1800
|
+
with fits.open(glob(f'{local_directory}lc/hlsp_tglc_tess_ffi_gaiaid-6385548541499112448-s0027*.fits')[0],
|
|
1801
|
+
mode='denywrite') as hdul:
|
|
1802
|
+
q = list(hdul[1].data['TESS_flags'] == 0) and list(hdul[1].data['TGLC_flags'] == 0)
|
|
1803
|
+
t_27 = hdul[1].data['time'][q]
|
|
1804
|
+
f_aper_27 = hdul[1].data['cal_aper_flux'][q]
|
|
1805
|
+
f_psf_27 = hdul[1].data['cal_psf_flux'][q]
|
|
1806
|
+
t_27 = np.mean(t_27[:len(t_27) // 3 * 3].reshape(-1, 3), axis=1)
|
|
1807
|
+
f_aper_27 = np.mean(f_aper_27[:len(f_aper_27) // 3 * 3].reshape(-1, 3), axis=1)
|
|
1808
|
+
f_psf_27 = np.mean(f_psf_27[:len(f_psf_27) // 3 * 3].reshape(-1, 3), axis=1)
|
|
1809
|
+
with fits.open(glob(f'{local_directory}lc/hlsp_tglc_tess_ffi_gaiaid-6385548541499112448-s0028*.fits')[0],
|
|
1810
|
+
mode='denywrite') as hdul:
|
|
1811
|
+
q = list(hdul[1].data['TESS_flags'] == 0) and list(hdul[1].data['TGLC_flags'] == 0)
|
|
1812
|
+
t_28 = hdul[1].data['time'][q]
|
|
1813
|
+
f_aper_28 = hdul[1].data['cal_aper_flux'][q]
|
|
1814
|
+
f_psf_28 = hdul[1].data['cal_psf_flux'][q]
|
|
1815
|
+
t_28 = np.mean(t_28[:len(t_28) // 3 * 3].reshape(-1, 3), axis=1)
|
|
1816
|
+
f_aper_28 = np.mean(f_aper_28[:len(f_aper_28) // 3 * 3].reshape(-1, 3), axis=1)
|
|
1817
|
+
f_psf_28 = np.mean(f_psf_28[:len(f_psf_28) // 3 * 3].reshape(-1, 3), axis=1)
|
|
1818
|
+
|
|
1819
|
+
files = glob(local_directory + 'SPOC/LHS 3844/*.fits')
|
|
1820
|
+
index = np.where(data['pl_name'] == 'LHS 3844 b')
|
|
1821
|
+
period = float(data['pl_orbper'][index])
|
|
1822
|
+
t_0 = float(data['pl_tranmid'][index])
|
|
1823
|
+
phase_fold_mid = (t_0 - 2457000) % period / period
|
|
1824
|
+
ax2_1 = fig.add_subplot(gs[1, :2])
|
|
1825
|
+
ax2_2 = fig.add_subplot(gs[1, 2:4])
|
|
1826
|
+
# ax1_3 = fig.add_subplot(gs[0, 6:9])
|
|
1827
|
+
ax2_4 = fig.add_subplot(gs[1, 4:6])
|
|
1828
|
+
ax2_5 = fig.add_subplot(gs[1, 6:8])
|
|
1829
|
+
ax2_6 = fig.add_subplot(gs[1, 8:])
|
|
1830
|
+
|
|
1831
|
+
for i in range(len(files)):
|
|
1832
|
+
with fits.open(files[i], mode='denywrite') as hdul:
|
|
1833
|
+
if hdul[0].header['sector'] == 1:
|
|
1834
|
+
continue
|
|
1835
|
+
spoc_t = hdul[1].data['TIME']
|
|
1836
|
+
spoc_f = hdul[1].data['PDCSAP_FLUX']
|
|
1837
|
+
spoc_t = np.mean(spoc_t[:len(spoc_t) // 15 * 15].reshape(-1, 15), axis=1)
|
|
1838
|
+
spoc_f = np.mean(spoc_f[:len(spoc_f) // 15 * 15].reshape(-1, 15), axis=1)
|
|
1839
|
+
ax2_1.plot(spoc_t % period / period - phase_fold_mid, spoc_f / np.nanmedian(spoc_f), '.', c=color[i - 1],
|
|
1840
|
+
ms=2,
|
|
1841
|
+
label=str(hdul[0].header['sector']))
|
|
1842
|
+
ax2_2.plot(eleanor_27_t % period / period - phase_fold_mid, eleanor_27_f_pca, '.', c=color[0], markersize=2,
|
|
1843
|
+
label='27')
|
|
1844
|
+
ax2_2.plot(eleanor_28_t % period / period - phase_fold_mid, eleanor_28_f_pca, '.', c=color[1], markersize=2,
|
|
1845
|
+
label='28')
|
|
1846
|
+
# ax2_3.plot(eleanor_27_t % period / period - phase_fold_mid, eleanor_27_f_psf, '.', c=color[0], markersize=2,
|
|
1847
|
+
# label='27')
|
|
1848
|
+
# ax2_3.plot(eleanor_28_t % period / period - phase_fold_mid, eleanor_28_f_psf, '.', c=color[1], markersize=2,
|
|
1849
|
+
# label='28')
|
|
1850
|
+
ax2_4.plot(qlp_27_t % period / period - phase_fold_mid, qlp_27_f, '.', c=color[0], markersize=2, label='27')
|
|
1851
|
+
ax2_4.plot(qlp_28_t % period / period - phase_fold_mid, qlp_28_f, '.', c=color[1], markersize=2, label='28')
|
|
1852
|
+
|
|
1853
|
+
ax2_5.plot(t_27 % period / period - phase_fold_mid, f_aper_27, '.', c=color[0], markersize=2, label='27')
|
|
1854
|
+
ax2_5.plot(t_28 % period / period - phase_fold_mid, f_aper_28, '.', c=color[1], markersize=2, label='28')
|
|
1855
|
+
|
|
1856
|
+
ax2_6.plot(t_27 % period / period - phase_fold_mid, f_psf_27, '.', c=color[0], markersize=2, label='27')
|
|
1857
|
+
ax2_6.plot(t_28 % period / period - phase_fold_mid, f_psf_28, '.', c=color[1], markersize=2, label='28')
|
|
1858
|
+
ax2_1.legend(loc=3, fontsize=6)
|
|
1859
|
+
ax2_2.legend(loc=3, fontsize=6)
|
|
1860
|
+
# ax2_3.legend(loc=3, fontsize=6)
|
|
1861
|
+
ax2_4.legend(loc=3, fontsize=6)
|
|
1862
|
+
ax2_5.legend(loc=3, fontsize=6)
|
|
1863
|
+
ax2_6.legend(loc=3, fontsize=6)
|
|
1864
|
+
ax2_1.set_ylim(0.988, 1.007)
|
|
1865
|
+
ax2_2.set_ylim(0.988, 1.007)
|
|
1866
|
+
# ax2_3.set_ylim(0.988, 1.007)
|
|
1867
|
+
ax2_4.set_ylim(0.988, 1.007)
|
|
1868
|
+
ax2_5.set_ylim(0.988, 1.007)
|
|
1869
|
+
ax2_6.set_ylim(0.988, 1.007)
|
|
1870
|
+
ax2_1.set_xlim(- 0.07, 0.07)
|
|
1871
|
+
ax2_2.set_xlim(- 0.07, 0.07)
|
|
1872
|
+
# ax2_3.set_xlim(- 0.07, 0.07)
|
|
1873
|
+
ax2_4.set_xlim(- 0.07, 0.07)
|
|
1874
|
+
ax2_5.set_xlim(- 0.07, 0.07)
|
|
1875
|
+
ax2_6.set_xlim(- 0.07, 0.07)
|
|
1876
|
+
ax2_2.set_yticklabels([])
|
|
1877
|
+
# ax2_3.set_yticklabels([])
|
|
1878
|
+
ax2_4.set_yticklabels([])
|
|
1879
|
+
ax2_5.set_yticklabels([])
|
|
1880
|
+
ax2_6.set_yticklabels([])
|
|
1881
|
+
ax2_1.set_ylabel('Normalized Flux')
|
|
1882
|
+
ax2_5.text(2.25, 0.5, f'LHS 3844 b', horizontalalignment='center',
|
|
1883
|
+
verticalalignment='center', transform=ax2_5.transAxes, rotation=270, fontweight='semibold')
|
|
1884
|
+
ax2_5.text(2.15, 0.5, 'mag=11.92', horizontalalignment='center',
|
|
1885
|
+
verticalalignment='center', transform=ax2_5.transAxes, rotation=270)
|
|
1886
|
+
#########################################################################
|
|
1887
|
+
# TOI-530
|
|
1888
|
+
tic = 387690507
|
|
1889
|
+
|
|
1890
|
+
# load QLP
|
|
1891
|
+
qlp_6_t, qlp_6_f = load_qlp(ld=local_directory, tic=tic, sector=6)
|
|
1892
|
+
|
|
1893
|
+
# load eleanor
|
|
1894
|
+
eleanor_6_t, eleanor_6_f_pca, eleanor_6_f_psf = load_eleanor(ld=local_directory, tic=tic, sector=6)
|
|
1895
|
+
eleanor_44_t, eleanor_44_f_pca, eleanor_44_f_psf = load_eleanor(ld=local_directory, tic=tic, sector=44)
|
|
1896
|
+
eleanor_45_t, eleanor_45_f_pca, eleanor_45_f_psf = load_eleanor(ld=local_directory, tic=tic, sector=45)
|
|
1897
|
+
|
|
1898
|
+
# load TGLC
|
|
1899
|
+
with fits.open(glob(f'{local_directory}lc/hlsp_tglc_tess_ffi_gaiaid-3353218995355814656-s0006*.fits')[0],
|
|
1900
|
+
mode='denywrite') as hdul:
|
|
1901
|
+
q = list(hdul[1].data['TESS_flags'] == 0) and list(hdul[1].data['TGLC_flags'] == 0)
|
|
1902
|
+
t_06 = hdul[1].data['time'][q]
|
|
1903
|
+
f_aper_06 = hdul[1].data['cal_aper_flux'][q]
|
|
1904
|
+
f_psf_06 = hdul[1].data['cal_psf_flux'][q]
|
|
1905
|
+
with fits.open(glob(f'{local_directory}lc/hlsp_tglc_tess_ffi_gaiaid-3353218995355814656-s0044*.fits')[0],
|
|
1906
|
+
mode='denywrite') as hdul:
|
|
1907
|
+
q = list(hdul[1].data['TESS_flags'] == 0) and list(hdul[1].data['TGLC_flags'] == 0)
|
|
1908
|
+
t_44 = hdul[1].data['time'][q]
|
|
1909
|
+
f_aper_44 = hdul[1].data['cal_aper_flux'][q]
|
|
1910
|
+
f_psf_44 = hdul[1].data['cal_psf_flux'][q]
|
|
1911
|
+
t_44 = np.mean(t_44[:len(t_44) // 3 * 3].reshape(-1, 3), axis=1)
|
|
1912
|
+
f_aper_44 = np.mean(f_aper_44[:len(f_aper_44) // 3 * 3].reshape(-1, 3), axis=1)
|
|
1913
|
+
f_psf_44 = np.mean(f_psf_44[:len(f_psf_44) // 3 * 3].reshape(-1, 3), axis=1)
|
|
1914
|
+
with fits.open(glob(f'{local_directory}lc/hlsp_tglc_tess_ffi_gaiaid-3353218995355814656-s0045*.fits')[0],
|
|
1915
|
+
mode='denywrite') as hdul:
|
|
1916
|
+
q = list(hdul[1].data['TESS_flags'] == 0) and list(hdul[1].data['TGLC_flags'] == 0)
|
|
1917
|
+
t_45 = hdul[1].data['time'][q]
|
|
1918
|
+
f_aper_45 = hdul[1].data['cal_aper_flux'][q]
|
|
1919
|
+
f_psf_45 = hdul[1].data['cal_psf_flux'][q]
|
|
1920
|
+
t_45 = np.mean(t_45[:len(t_45) // 3 * 3].reshape(-1, 3), axis=1)
|
|
1921
|
+
f_aper_45 = np.mean(f_aper_45[:len(f_aper_45) // 3 * 3].reshape(-1, 3), axis=1)
|
|
1922
|
+
f_psf_45 = np.mean(f_psf_45[:len(f_psf_45) // 3 * 3].reshape(-1, 3), axis=1)
|
|
1923
|
+
|
|
1924
|
+
files = glob(local_directory + 'SPOC/TOI-530/*.fits')
|
|
1925
|
+
index = np.where(data['pl_name'] == 'TOI-530 b')
|
|
1926
|
+
period = 6.387583
|
|
1927
|
+
t_0 = float(data['pl_tranmid'][index])
|
|
1928
|
+
phase_fold_mid = (t_0 - 2457000) % period / period
|
|
1929
|
+
ax3_1 = fig.add_subplot(gs[2, :2])
|
|
1930
|
+
ax3_2 = fig.add_subplot(gs[2, 2:4])
|
|
1931
|
+
# ax1_3 = fig.add_subplot(gs[0, 6:9])
|
|
1932
|
+
ax3_4 = fig.add_subplot(gs[2, 4:6])
|
|
1933
|
+
ax3_5 = fig.add_subplot(gs[2, 6:8])
|
|
1934
|
+
ax3_6 = fig.add_subplot(gs[2, 8:])
|
|
1935
|
+
|
|
1936
|
+
for i in range(len(files)):
|
|
1937
|
+
with fits.open(files[i], mode='denywrite') as hdul:
|
|
1938
|
+
spoc_t = hdul[1].data['TIME']
|
|
1939
|
+
spoc_f = hdul[1].data['PDCSAP_FLUX']
|
|
1940
|
+
spoc_t = np.mean(spoc_t[:len(spoc_t) // 15 * 15].reshape(-1, 15), axis=1)
|
|
1941
|
+
spoc_f = np.mean(spoc_f[:len(spoc_f) // 15 * 15].reshape(-1, 15), axis=1)
|
|
1942
|
+
ax3_1.plot(spoc_t % period / period - phase_fold_mid, spoc_f / np.nanmedian(spoc_f), '.', c=color[i], ms=2,
|
|
1943
|
+
label=str(hdul[0].header['sector']))
|
|
1944
|
+
ax3_2.plot(eleanor_6_t % period / period - phase_fold_mid, eleanor_6_f_pca, '.', c=color[0], markersize=2,
|
|
1945
|
+
label='6')
|
|
1946
|
+
ax3_2.plot(eleanor_44_t % period / period - phase_fold_mid, eleanor_44_f_pca, '.', c=color[1], markersize=2,
|
|
1947
|
+
label='44')
|
|
1948
|
+
ax3_2.plot(eleanor_45_t % period / period - phase_fold_mid, eleanor_45_f_pca, '.', c=color[2], markersize=2,
|
|
1949
|
+
label='45')
|
|
1950
|
+
# ax3_3.plot(eleanor_6_t % period / period - phase_fold_mid, eleanor_6_f_psf, '.', c=color[0], markersize=2,
|
|
1951
|
+
# label='6')
|
|
1952
|
+
# ax3_3.plot(eleanor_44_t % period / period - phase_fold_mid, eleanor_44_f_psf, '.', c=color[1], markersize=2,
|
|
1953
|
+
# label='44')
|
|
1954
|
+
ax3_4.plot(qlp_6_t % period / period - phase_fold_mid, qlp_6_f, '.', c=color[0], markersize=2, label='6')
|
|
1955
|
+
|
|
1956
|
+
ax3_5.plot(t_06 % period / period - phase_fold_mid, f_aper_06, '.', c=color[0], markersize=2, label='6')
|
|
1957
|
+
ax3_5.plot(t_44 % period / period - phase_fold_mid, f_aper_44, '.', c=color[1], markersize=2, label='44')
|
|
1958
|
+
ax3_5.plot(t_45 % period / period - phase_fold_mid, f_aper_45, '.', c=color[2], markersize=2, label='45')
|
|
1959
|
+
|
|
1960
|
+
ax3_6.plot(t_06 % period / period - phase_fold_mid, f_psf_06, '.', c=color[0], markersize=2, label='6')
|
|
1961
|
+
ax3_6.plot(t_44 % period / period - phase_fold_mid, f_psf_44, '.', c=color[1], markersize=2, label='44')
|
|
1962
|
+
ax3_6.plot(t_45 % period / period - phase_fold_mid, f_psf_45, '.', c=color[2], markersize=2, label='45')
|
|
1963
|
+
|
|
1964
|
+
ax3_1.legend(loc=3, fontsize=6)
|
|
1965
|
+
ax3_2.legend(loc=3, fontsize=6)
|
|
1966
|
+
# ax3_3.legend(loc=3, fontsize=6)
|
|
1967
|
+
ax3_4.legend(loc=3, fontsize=6)
|
|
1968
|
+
ax3_5.legend(loc=3, fontsize=6)
|
|
1969
|
+
ax3_6.legend(loc=3, fontsize=6)
|
|
1970
|
+
ax3_1.set_ylim(0.95, 1.03)
|
|
1971
|
+
ax3_2.set_ylim(0.95, 1.03)
|
|
1972
|
+
# ax3_3.set_ylim(0.95, 1.03)
|
|
1973
|
+
ax3_4.set_ylim(0.95, 1.03)
|
|
1974
|
+
ax3_5.set_ylim(0.95, 1.03)
|
|
1975
|
+
ax3_6.set_ylim(0.95, 1.03)
|
|
1976
|
+
ax3_1.set_xlim(- 0.03, 0.03)
|
|
1977
|
+
ax3_2.set_xlim(- 0.03, 0.03)
|
|
1978
|
+
# ax3_3.set_xlim(- 0.03, 0.03)
|
|
1979
|
+
ax3_4.set_xlim(- 0.03, 0.03)
|
|
1980
|
+
ax3_5.set_xlim(- 0.03, 0.03)
|
|
1981
|
+
ax3_6.set_xlim(- 0.03, 0.03)
|
|
1982
|
+
ax3_2.set_yticklabels([])
|
|
1983
|
+
# ax3_3.set_yticklabels([])
|
|
1984
|
+
ax3_4.set_yticklabels([])
|
|
1985
|
+
ax3_5.set_yticklabels([])
|
|
1986
|
+
ax3_6.set_yticklabels([])
|
|
1987
|
+
ax3_1.set_ylabel('Normalized Flux')
|
|
1988
|
+
ax3_5.text(2.25, 0.5, 'TOI-530 b', horizontalalignment='center',
|
|
1989
|
+
verticalalignment='center', transform=ax3_5.transAxes, rotation=270, fontweight='semibold')
|
|
1990
|
+
ax3_5.text(2.15, 0.5, 'mag=13.53', horizontalalignment='center',
|
|
1991
|
+
verticalalignment='center', transform=ax3_5.transAxes, rotation=270)
|
|
1992
|
+
#########################################################################
|
|
1993
|
+
# TOI-2406
|
|
1994
|
+
tic = 212957629
|
|
1995
|
+
|
|
1996
|
+
# load QLP
|
|
1997
|
+
qlp_30_t, qlp_30_f = load_qlp(ld=local_directory, tic=tic, sector=30)
|
|
1998
|
+
|
|
1999
|
+
# load eleanor
|
|
2000
|
+
eleanor_3_t, eleanor_3_f_pca, eleanor_3_f_psf = load_eleanor(ld=local_directory, tic=tic, sector=3)
|
|
2001
|
+
eleanor_42_t, eleanor_42_f_pca, eleanor_42_f_psf = load_eleanor(ld=local_directory, tic=tic, sector=42)
|
|
2002
|
+
eleanor_43_t, eleanor_43_f_pca, eleanor_43_f_psf = load_eleanor(ld=local_directory, tic=tic, sector=43)
|
|
2003
|
+
|
|
2004
|
+
# load TGLC
|
|
2005
|
+
with fits.open(glob(f'{local_directory}lc/hlsp_tglc_tess_ffi_gaiaid-2528453161326406016-s0003*.fits')[0],
|
|
2006
|
+
mode='denywrite') as hdul:
|
|
2007
|
+
q = list(hdul[1].data['TESS_flags'] == 0) and list(hdul[1].data['TGLC_flags'] == 0)
|
|
2008
|
+
t_03 = hdul[1].data['time'][q]
|
|
2009
|
+
f_aper_03 = hdul[1].data['cal_aper_flux'][q]
|
|
2010
|
+
f_psf_03 = hdul[1].data['cal_psf_flux'][q]
|
|
2011
|
+
with fits.open(glob(f'{local_directory}lc/hlsp_tglc_tess_ffi_gaiaid-2528453161326406016-s0042*.fits')[0],
|
|
2012
|
+
mode='denywrite') as hdul:
|
|
2013
|
+
q = list(hdul[1].data['TESS_flags'] == 0) and list(hdul[1].data['TGLC_flags'] == 0)
|
|
2014
|
+
t_42 = hdul[1].data['time'][q]
|
|
2015
|
+
f_aper_42 = hdul[1].data['cal_aper_flux'][q]
|
|
2016
|
+
f_psf_42 = hdul[1].data['cal_psf_flux'][q]
|
|
2017
|
+
t_42 = np.mean(t_42[:len(t_42) // 3 * 3].reshape(-1, 3), axis=1)
|
|
2018
|
+
f_aper_42 = np.mean(f_aper_42[:len(f_aper_42) // 3 * 3].reshape(-1, 3), axis=1)
|
|
2019
|
+
f_psf_42 = np.mean(f_psf_42[:len(f_psf_42) // 3 * 3].reshape(-1, 3), axis=1)
|
|
2020
|
+
with fits.open(glob(f'{local_directory}lc/hlsp_tglc_tess_ffi_gaiaid-2528453161326406016-s0043*.fits')[0],
|
|
2021
|
+
mode='denywrite') as hdul:
|
|
2022
|
+
q = list(hdul[1].data['TESS_flags'] == 0) and list(hdul[1].data['TGLC_flags'] == 0)
|
|
2023
|
+
t_43 = hdul[1].data['time'][q]
|
|
2024
|
+
f_aper_43 = hdul[1].data['cal_aper_flux'][q]
|
|
2025
|
+
f_psf_43 = hdul[1].data['cal_psf_flux'][q]
|
|
2026
|
+
t_43 = np.mean(t_43[:len(t_43) // 3 * 3].reshape(-1, 3), axis=1)
|
|
2027
|
+
f_aper_43 = np.mean(f_aper_43[:len(f_aper_43) // 3 * 3].reshape(-1, 3), axis=1)
|
|
2028
|
+
f_psf_43 = np.mean(f_psf_43[:len(f_psf_43) // 3 * 3].reshape(-1, 3), axis=1)
|
|
2029
|
+
|
|
2030
|
+
files = glob(local_directory + 'SPOC/TOI-2406/*.fits')
|
|
2031
|
+
index = np.where(data['pl_name'] == 'TOI-2406 b')
|
|
2032
|
+
period = 3.076676
|
|
2033
|
+
t_0 = float(data['pl_tranmid'][index])
|
|
2034
|
+
phase_fold_mid = (t_0 - 2457000) % period / period
|
|
2035
|
+
ax4_1 = fig.add_subplot(gs[3, :2])
|
|
2036
|
+
ax4_2 = fig.add_subplot(gs[3, 2:4])
|
|
2037
|
+
# ax4_3 = fig.add_subplot(gs[3, 6:9])
|
|
2038
|
+
ax4_4 = fig.add_subplot(gs[3, 4:6])
|
|
2039
|
+
ax4_5 = fig.add_subplot(gs[3, 6:8])
|
|
2040
|
+
ax4_6 = fig.add_subplot(gs[3, 8:])
|
|
2041
|
+
|
|
2042
|
+
for i in range(len(files)):
|
|
2043
|
+
with fits.open(files[i], mode='denywrite') as hdul:
|
|
2044
|
+
spoc_t = hdul[1].data['TIME']
|
|
2045
|
+
spoc_f = hdul[1].data['PDCSAP_FLUX']
|
|
2046
|
+
spoc_t = np.mean(spoc_t[:len(spoc_t) // 15 * 15].reshape(-1, 15), axis=1)
|
|
2047
|
+
spoc_f = np.mean(spoc_f[:len(spoc_f) // 15 * 15].reshape(-1, 15), axis=1)
|
|
2048
|
+
ax4_1.plot(spoc_t % period / period - phase_fold_mid, spoc_f / np.nanmedian(spoc_f), '.', c=color[i + 1],
|
|
2049
|
+
ms=2,
|
|
2050
|
+
label=str(hdul[0].header['sector']))
|
|
2051
|
+
ax4_2.plot(eleanor_3_t % period / period - phase_fold_mid, eleanor_3_f_pca, '.', c=color[0], markersize=2,
|
|
2052
|
+
label='3')
|
|
2053
|
+
ax4_2.plot(eleanor_42_t % period / period - phase_fold_mid, eleanor_42_f_pca, '.', c=color[1], markersize=2,
|
|
2054
|
+
label='42')
|
|
2055
|
+
ax4_2.plot(eleanor_43_t % period / period - phase_fold_mid, eleanor_43_f_pca, '.', c=color[2], markersize=2,
|
|
2056
|
+
label='43')
|
|
2057
|
+
# ax4_3.plot(eleanor_3_t % period / period - phase_fold_mid, eleanor_3_f_psf, '.', c=color[0], markersize=2,
|
|
2058
|
+
# label='3')
|
|
2059
|
+
# ax4_3.plot(eleanor_42_t % period / period - phase_fold_mid, eleanor_42_f_psf, '.', c=color[1], markersize=2,
|
|
2060
|
+
# label='42')
|
|
2061
|
+
# ax4_3.plot(eleanor_43_t % period / period - phase_fold_mid, eleanor_43_f_psf, '.', c=color[2], markersize=2,
|
|
2062
|
+
# label='43')
|
|
2063
|
+
ax4_4.plot(qlp_30_t % period / period - phase_fold_mid, qlp_30_f, '.', c=color[0], markersize=2, label='30')
|
|
2064
|
+
|
|
2065
|
+
ax4_5.plot(t_03 % period / period - phase_fold_mid, f_aper_03, '.', c=color[0], markersize=2,
|
|
2066
|
+
label='3')
|
|
2067
|
+
ax4_5.plot(t_42 % period / period - phase_fold_mid, f_aper_42, '.', c=color[1], markersize=2,
|
|
2068
|
+
label='42')
|
|
2069
|
+
ax4_5.plot(t_43 % period / period - phase_fold_mid, f_aper_43, '.', c=color[2], markersize=2,
|
|
2070
|
+
label='43')
|
|
2071
|
+
|
|
2072
|
+
ax4_6.plot(t_03 % period / period - phase_fold_mid, f_psf_03, '.', c=color[0], markersize=2,
|
|
2073
|
+
label='3')
|
|
2074
|
+
ax4_6.plot(t_42 % period / period - phase_fold_mid, f_psf_42, '.', c=color[1], markersize=2,
|
|
2075
|
+
label='42')
|
|
2076
|
+
ax4_6.plot(t_43 % period / period - phase_fold_mid, f_psf_43, '.', c=color[2], markersize=2,
|
|
2077
|
+
label='43')
|
|
2078
|
+
|
|
2079
|
+
ax4_1.legend(loc=3, fontsize=6)
|
|
2080
|
+
ax4_2.legend(loc=3, fontsize=6)
|
|
2081
|
+
# ax4_3.legend(loc=3, fontsize=6)
|
|
2082
|
+
ax4_4.legend(loc=3, fontsize=6)
|
|
2083
|
+
ax4_5.legend(loc=3, fontsize=6)
|
|
2084
|
+
ax4_6.legend(loc=3, fontsize=6)
|
|
2085
|
+
ax4_1.set_ylim(0.945, 1.04)
|
|
2086
|
+
ax4_2.set_ylim(0.945, 1.04)
|
|
2087
|
+
# ax4_3.set_ylim(0.945, 1.04)
|
|
2088
|
+
ax4_4.set_ylim(0.945, 1.04)
|
|
2089
|
+
ax4_5.set_ylim(0.945, 1.04)
|
|
2090
|
+
ax4_6.set_ylim(0.945, 1.04)
|
|
2091
|
+
ax4_1.set_xlim(- 0.04, 0.04)
|
|
2092
|
+
ax4_2.set_xlim(- 0.04, 0.04)
|
|
2093
|
+
# ax4_3.set_xlim(- 0.04, 0.04)
|
|
2094
|
+
ax4_4.set_xlim(- 0.04, 0.04)
|
|
2095
|
+
ax4_5.set_xlim(- 0.04, 0.04)
|
|
2096
|
+
ax4_6.set_xlim(- 0.04, 0.04)
|
|
2097
|
+
ax4_1.set_xticks([-0.03, 0, 0.03])
|
|
2098
|
+
ax4_1.set_xticklabels(['\N{MINUS SIGN}0.03', '0', '0.03'])
|
|
2099
|
+
ax4_2.set_xticks([-0.03, 0, 0.03])
|
|
2100
|
+
ax4_2.set_xticklabels(['\N{MINUS SIGN}0.03', '0', '0.03'])
|
|
2101
|
+
# ax4_3.set_xticks([-0.03, 0, 0.03])
|
|
2102
|
+
# ax4_3.set_xticklabels(['\N{MINUS SIGN}0.03', '0', '0.03'])
|
|
2103
|
+
ax4_4.set_xticks([-0.03, 0, 0.03])
|
|
2104
|
+
ax4_4.set_xticklabels(['\N{MINUS SIGN}0.03', '0', '0.03'])
|
|
2105
|
+
ax4_4.set_xlabel('Phase')
|
|
2106
|
+
ax4_5.set_xticks([-0.03, 0, 0.03])
|
|
2107
|
+
ax4_5.set_xticklabels(['\N{MINUS SIGN}0.03', '0', '0.03'])
|
|
2108
|
+
ax4_6.set_xticks([-0.03, 0, 0.03])
|
|
2109
|
+
ax4_6.set_xticklabels(['\N{MINUS SIGN}0.03', '0', '0.03'])
|
|
2110
|
+
ax4_2.set_yticklabels([])
|
|
2111
|
+
# ax4_3.set_yticklabels([])
|
|
2112
|
+
ax4_4.set_yticklabels([])
|
|
2113
|
+
ax4_5.set_yticklabels([])
|
|
2114
|
+
ax4_6.set_yticklabels([])
|
|
2115
|
+
ax4_1.set_ylabel('Normalized Flux')
|
|
2116
|
+
ax4_5.text(2.25, 0.5, 'TOI-2406 b', horizontalalignment='center',
|
|
2117
|
+
verticalalignment='center', transform=ax4_5.transAxes, rotation=270, fontweight='semibold')
|
|
2118
|
+
ax4_5.text(2.15, 0.5, 'mag=14.31', horizontalalignment='center',
|
|
2119
|
+
verticalalignment='center', transform=ax4_5.transAxes, rotation=270)
|
|
2120
|
+
|
|
2121
|
+
#########################################################################
|
|
2122
|
+
# TOI-519
|
|
2123
|
+
tic = 218795833
|
|
2124
|
+
|
|
2125
|
+
# load eleanor
|
|
2126
|
+
eleanor_7_t, eleanor_7_f_aper, eleanor_7_f_psf = load_eleanor(ld=local_directory, tic=tic, sector=7)
|
|
2127
|
+
eleanor_8_t, eleanor_8_f_aper, eleanor_8_f_psf = load_eleanor(ld=local_directory, tic=tic, sector=8)
|
|
2128
|
+
eleanor_34_t, eleanor_34_f_aper, eleanor_34_f_psf = load_eleanor(ld=local_directory, tic=tic, sector=34)
|
|
2129
|
+
|
|
2130
|
+
# load TGLC
|
|
2131
|
+
with fits.open(glob(f'{local_directory}lc/hlsp_tglc_tess_ffi_gaiaid-5707485527450614656-s0007*.fits')[0],
|
|
2132
|
+
mode='denywrite') as hdul:
|
|
2133
|
+
q = list(hdul[1].data['TESS_flags'] == 0) and list(hdul[1].data['TGLC_flags'] == 0)
|
|
2134
|
+
t_07 = hdul[1].data['time'][q]
|
|
2135
|
+
f_aper_07 = hdul[1].data['cal_aper_flux'][q]
|
|
2136
|
+
f_psf_07 = hdul[1].data['cal_psf_flux'][q]
|
|
2137
|
+
with fits.open(glob(f'{local_directory}lc/hlsp_tglc_tess_ffi_gaiaid-5707485527450614656-s0008*.fits')[0],
|
|
2138
|
+
mode='denywrite') as hdul:
|
|
2139
|
+
q = list(hdul[1].data['TESS_flags'] == 0) and list(hdul[1].data['TGLC_flags'] == 0)
|
|
2140
|
+
t_08 = hdul[1].data['time'][q]
|
|
2141
|
+
f_aper_08 = hdul[1].data['cal_aper_flux'][q]
|
|
2142
|
+
f_psf_08 = hdul[1].data['cal_psf_flux'][q]
|
|
2143
|
+
with fits.open(glob(f'{local_directory}lc/hlsp_tglc_tess_ffi_gaiaid-5707485527450614656-s0034*.fits')[0],
|
|
2144
|
+
mode='denywrite') as hdul:
|
|
2145
|
+
q = list(hdul[1].data['TESS_flags'] == 0) and list(hdul[1].data['TGLC_flags'] == 0)
|
|
2146
|
+
t_34 = hdul[1].data['time'][q]
|
|
2147
|
+
f_aper_34 = hdul[1].data['cal_aper_flux'][q]
|
|
2148
|
+
f_psf_34 = hdul[1].data['cal_psf_flux'][q]
|
|
2149
|
+
t_34 = np.mean(t_34[:len(t_34) // 3 * 3].reshape(-1, 3), axis=1)
|
|
2150
|
+
f_aper_34 = np.mean(f_aper_34[:len(f_aper_34) // 3 * 3].reshape(-1, 3), axis=1)
|
|
2151
|
+
f_psf_34 = np.mean(f_psf_34[:len(f_psf_34) // 3 * 3].reshape(-1, 3), axis=1)
|
|
2152
|
+
|
|
2153
|
+
files = glob(local_directory + 'SPOC/TOI-519/*.fits')
|
|
2154
|
+
index = np.where(data['pl_name'] == 'TOI-519 b')
|
|
2155
|
+
period = 1.265232
|
|
2156
|
+
t_0 = float(data['pl_tranmid'][index])
|
|
2157
|
+
phase_fold_mid = (t_0 - 2457000) % period / period
|
|
2158
|
+
ax5_1 = fig.add_subplot(gs[4, :2])
|
|
2159
|
+
ax5_2 = fig.add_subplot(gs[4, 2:4])
|
|
2160
|
+
# ax5_3 = fig.add_subplot(gs[4, 6:9])
|
|
2161
|
+
# ax5_4 = fig.add_subplot(gs[4, 9:])
|
|
2162
|
+
ax5_5 = fig.add_subplot(gs[4, 6:8])
|
|
2163
|
+
ax5_6 = fig.add_subplot(gs[4, 8:])
|
|
2164
|
+
|
|
2165
|
+
for i in range(len(files)):
|
|
2166
|
+
with fits.open(files[i], mode='denywrite') as hdul:
|
|
2167
|
+
if hdul[0].header['sector'] == 34:
|
|
2168
|
+
i = i + 1
|
|
2169
|
+
spoc_t = hdul[1].data['TIME']
|
|
2170
|
+
spoc_f = hdul[1].data['PDCSAP_FLUX']
|
|
2171
|
+
spoc_t = np.mean(spoc_t[:len(spoc_t) // 15 * 15].reshape(-1, 15), axis=1)
|
|
2172
|
+
spoc_f = np.mean(spoc_f[:len(spoc_f) // 15 * 15].reshape(-1, 15), axis=1)
|
|
2173
|
+
ax5_1.plot(spoc_t % period / period - phase_fold_mid, spoc_f / np.nanmedian(spoc_f), '.', c=color[i], ms=2,
|
|
2174
|
+
label=str(hdul[0].header['sector']))
|
|
2175
|
+
ax5_2.plot(eleanor_7_t % period / period - phase_fold_mid, eleanor_7_f_aper, '.', c=color[0], markersize=2,
|
|
2176
|
+
label='7')
|
|
2177
|
+
ax5_2.plot(eleanor_8_t % period / period - phase_fold_mid, eleanor_8_f_aper, '.', c=color[1], markersize=2,
|
|
2178
|
+
label='8')
|
|
2179
|
+
ax5_2.plot(eleanor_34_t % period / period - phase_fold_mid, eleanor_34_f_aper, '.', c=color[2], markersize=2,
|
|
2180
|
+
label='34')
|
|
2181
|
+
# ax5_3.plot(eleanor_7_t % period / period - phase_fold_mid, eleanor_7_f_psf, '.', c=color[0], markersize=2,
|
|
2182
|
+
# label='7')
|
|
2183
|
+
# ax5_3.plot(eleanor_8_t % period / period - phase_fold_mid, eleanor_8_f_psf, '.', c=color[1], markersize=2,
|
|
2184
|
+
# label='8')
|
|
2185
|
+
# ax5_3.plot(eleanor_34_t % period / period - phase_fold_mid, eleanor_34_f_psf, '.', c=color[2], markersize=2,
|
|
2186
|
+
# label='34')
|
|
2187
|
+
|
|
2188
|
+
ax5_5.plot(t_07 % period / period - phase_fold_mid, f_aper_07, '.', c=color[0], markersize=2,
|
|
2189
|
+
label='7')
|
|
2190
|
+
ax5_5.plot(t_08 % period / period - phase_fold_mid, f_aper_08, '.', c=color[1], markersize=2,
|
|
2191
|
+
label='8')
|
|
2192
|
+
ax5_5.plot(t_34 % period / period - phase_fold_mid, f_aper_34, '.', c=color[2], markersize=2,
|
|
2193
|
+
label='34')
|
|
2194
|
+
|
|
2195
|
+
ax5_6.plot(t_07 % period / period - phase_fold_mid, f_psf_07, '.', c=color[0], markersize=2,
|
|
2196
|
+
label='7')
|
|
2197
|
+
ax5_6.plot(t_08 % period / period - phase_fold_mid, f_psf_08, '.', c=color[1], markersize=2,
|
|
2198
|
+
label='8')
|
|
2199
|
+
ax5_6.plot(t_34 % period / period - phase_fold_mid, f_psf_34, '.', c=color[2], markersize=2,
|
|
2200
|
+
label='34')
|
|
2201
|
+
|
|
2202
|
+
ax5_1.legend(loc=3, fontsize=6)
|
|
2203
|
+
ax5_2.legend(loc=3, fontsize=6)
|
|
2204
|
+
# ax5_3.legend(loc=3, fontsize=6)
|
|
2205
|
+
ax5_5.legend(loc=3, fontsize=6)
|
|
2206
|
+
ax5_6.legend(loc=3, fontsize=6)
|
|
2207
|
+
ax5_1.set_ylim(0.83, 1.05)
|
|
2208
|
+
ax5_2.set_ylim(0.83, 1.05)
|
|
2209
|
+
# ax5_3.set_ylim(0.83, 1.05)
|
|
2210
|
+
ax5_5.set_ylim(0.83, 1.05)
|
|
2211
|
+
ax5_6.set_ylim(0.83, 1.05)
|
|
2212
|
+
ax5_1.set_xlim(- 0.05, 0.05)
|
|
2213
|
+
ax5_2.set_xlim(- 0.05, 0.05)
|
|
2214
|
+
# ax5_3.set_xlim(- 0.05, 0.05)
|
|
2215
|
+
ax5_5.set_xlim(- 0.05, 0.05)
|
|
2216
|
+
ax5_6.set_xlim(- 0.05, 0.05)
|
|
2217
|
+
ax5_1.set_yticks([0.9, 1.0])
|
|
2218
|
+
ax5_1.set_yticklabels(['0.90', '1.00'])
|
|
2219
|
+
ax5_1.set_xticks([-0.03, 0, 0.03])
|
|
2220
|
+
ax5_1.set_xticklabels(['\N{MINUS SIGN}0.03', '0', '0.03'])
|
|
2221
|
+
ax5_2.set_xticks([-0.03, 0, 0.03])
|
|
2222
|
+
ax5_2.set_xticklabels(['\N{MINUS SIGN}0.03', '0', '0.03'])
|
|
2223
|
+
# ax5_3.set_xticks([-0.03, 0, 0.03])
|
|
2224
|
+
# ax5_3.set_xticklabels(['\N{MINUS SIGN}0.03', '0', '0.03'])
|
|
2225
|
+
ax5_5.set_xticks([-0.03, 0, 0.03])
|
|
2226
|
+
ax5_5.set_xticklabels(['\N{MINUS SIGN}0.03', '0', '0.03'])
|
|
2227
|
+
ax5_6.set_xticks([-0.03, 0, 0.03])
|
|
2228
|
+
ax5_6.set_xticklabels(['\N{MINUS SIGN}0.03', '0', '0.03'])
|
|
2229
|
+
ax5_2.set_yticklabels([])
|
|
2230
|
+
# ax5_3.set_yticklabels([])
|
|
2231
|
+
ax5_5.set_yticklabels([])
|
|
2232
|
+
ax5_6.set_yticklabels([])
|
|
2233
|
+
ax5_1.set_xlabel('Phase')
|
|
2234
|
+
ax5_2.set_xlabel('Phase')
|
|
2235
|
+
# ax5_3.set_xlabel('Phase')
|
|
2236
|
+
ax5_5.set_xlabel('Phase')
|
|
2237
|
+
ax5_6.set_xlabel('Phase')
|
|
2238
|
+
ax5_1.set_ylabel('Normalized Flux')
|
|
2239
|
+
ax5_5.text(2.25, 0.5, 'TOI-519 b', horizontalalignment='center',
|
|
2240
|
+
verticalalignment='center', transform=ax5_5.transAxes, rotation=270, fontweight='semibold')
|
|
2241
|
+
ax5_5.text(2.15, 0.5, 'mag=14.43', horizontalalignment='center',
|
|
2242
|
+
verticalalignment='center', transform=ax5_5.transAxes, rotation=270)
|
|
2243
|
+
# ax5_1.set_yticklabels([])
|
|
2244
|
+
|
|
2245
|
+
plt.savefig('/mnt/c/users/tehan/desktop/known_exoplanets_all.png', bbox_inches='tight', dpi=300)
|
|
2246
|
+
plt.show()
|
|
2247
|
+
|
|
2248
|
+
|
|
2249
|
+
def figure_10():
|
|
2250
|
+
size = 90
|
|
2251
|
+
local_directory = '/home/tehan/data/variables/'
|
|
2252
|
+
os.makedirs(local_directory + f'lc/', exist_ok=True)
|
|
2253
|
+
os.makedirs(local_directory + f'epsf/', exist_ok=True)
|
|
2254
|
+
os.makedirs(local_directory + f'source/', exist_ok=True)
|
|
2255
|
+
hosts = [
|
|
2256
|
+
('SX Dor', 'Gaia DR2 4662259606266850944'), # Molnar: RR Lyrae, hard to disdinguish for eleanor
|
|
2257
|
+
('TIC 177309964', 'Gaia DR2 5260885172921947008'), # Zhan: Faint rotator
|
|
2258
|
+
('AV Gru', 'Gaia DR2 6512192214932460416') # Plachy: Cepheid, dim and kind of noisy
|
|
2259
|
+
]
|
|
2260
|
+
#####################
|
|
2261
|
+
# 3 6 7 8 9 10 17 27 28 34 36 42 43 44 45
|
|
2262
|
+
sectors = [2, 11, 38]
|
|
2263
|
+
for sector in sectors:
|
|
2264
|
+
source = ffi_cut(target=hosts[0][0], size=size, local_directory=local_directory, sector=sector)
|
|
2265
|
+
epsf(source, factor=2, sector=source.sector, target=hosts[0][0], local_directory=local_directory,
|
|
2266
|
+
name=hosts[0][1], save_aper=True)
|
|
2267
|
+
|
|
2268
|
+
#####################
|
|
2269
|
+
sectors = [4, 12, 31]
|
|
2270
|
+
for sector in sectors:
|
|
2271
|
+
source = ffi_cut(target=hosts[1][0], size=size, local_directory=local_directory, sector=sector)
|
|
2272
|
+
epsf(source, factor=2, sector=source.sector, target=hosts[1][0], local_directory=local_directory,
|
|
2273
|
+
name=hosts[1][1], save_aper=True)
|
|
2274
|
+
|
|
2275
|
+
#####################
|
|
2276
|
+
sectors = [1, 28]
|
|
2277
|
+
for sector in sectors:
|
|
2278
|
+
source = ffi_cut(target=hosts[2][0], size=size, local_directory=local_directory, sector=sector)
|
|
2279
|
+
epsf(source, factor=2, sector=source.sector, target=hosts[2][0], local_directory=local_directory,
|
|
2280
|
+
name=hosts[2][1], save_aper=True)
|
|
2281
|
+
|
|
2282
|
+
fig = plt.figure(constrained_layout=False, figsize=(10, 6))
|
|
2283
|
+
gs = fig.add_gridspec(8, 9, wspace=0.2, hspace=0, height_ratios=[1, 1, 0.8, 1, 1, 0.8, 1, 1])
|
|
2284
|
+
local_directory = '/home/tehan/data/variables/'
|
|
2285
|
+
# local_directory = '/mnt/c/users/tehan/desktop/variables/'
|
|
2286
|
+
##########
|
|
2287
|
+
period = 0.63150
|
|
2288
|
+
with fits.open(glob(f'{local_directory}lc/hlsp_tglc_tess_ffi_gaiaid-4662259606266850944-s0002*.fits')[0],
|
|
2289
|
+
mode='denywrite') as hdul:
|
|
2290
|
+
q = list(hdul[1].data['TESS_flags'] == 0) and list(hdul[1].data['TGLC_flags'] == 0)
|
|
2291
|
+
t_02 = hdul[1].data['time'][q]
|
|
2292
|
+
f_psf_02 = hdul[1].data['cal_psf_flux'][q]
|
|
2293
|
+
f_aper_02 = hdul[1].data['cal_aper_flux'][q]
|
|
2294
|
+
|
|
2295
|
+
with fits.open(glob(f'{local_directory}lc/hlsp_tglc_tess_ffi_gaiaid-4662259606266850944-s0011*.fits')[0],
|
|
2296
|
+
mode='denywrite') as hdul:
|
|
2297
|
+
q = list(hdul[1].data['TESS_flags'] == 0) and list(hdul[1].data['TGLC_flags'] == 0)
|
|
2298
|
+
t_11 = hdul[1].data['time'][q]
|
|
2299
|
+
f_psf_11 = hdul[1].data['cal_psf_flux'][q]
|
|
2300
|
+
f_aper_11 = hdul[1].data['cal_aper_flux'][q]
|
|
2301
|
+
|
|
2302
|
+
with fits.open(glob(f'{local_directory}lc/hlsp_tglc_tess_ffi_gaiaid-4662259606266850944-s0038*.fits')[0],
|
|
2303
|
+
mode='denywrite') as hdul:
|
|
2304
|
+
q = list(hdul[1].data['TESS_flags'] == 0) and list(hdul[1].data['TGLC_flags'] == 0)
|
|
2305
|
+
t_38 = hdul[1].data['time'][q]
|
|
2306
|
+
f_psf_38 = hdul[1].data['cal_psf_flux'][q]
|
|
2307
|
+
f_aper_38 = hdul[1].data['cal_aper_flux'][q]
|
|
2308
|
+
t_38 = np.mean(t_38[:len(t_38) // 3 * 3].reshape(-1, 3), axis=1)
|
|
2309
|
+
f_psf_38 = np.mean(f_psf_38[:len(f_psf_38) // 3 * 3].reshape(-1, 3), axis=1)
|
|
2310
|
+
f_aper_38 = np.mean(f_aper_38[:len(f_aper_38) // 3 * 3].reshape(-1, 3), axis=1)
|
|
2311
|
+
|
|
2312
|
+
ax0_1 = fig.add_subplot(gs[0, :3])
|
|
2313
|
+
ax0_2 = fig.add_subplot(gs[0, 3:6])
|
|
2314
|
+
ax0_3 = fig.add_subplot(gs[0, 6:9])
|
|
2315
|
+
ax1_1 = fig.add_subplot(gs[1, :3])
|
|
2316
|
+
ax1_2 = fig.add_subplot(gs[1, 3:6])
|
|
2317
|
+
ax1_3 = fig.add_subplot(gs[1, 6:9])
|
|
2318
|
+
|
|
2319
|
+
ax0_1.plot(t_02, f_aper_02, '.', c='k', markersize=1, label='2')
|
|
2320
|
+
ax0_2.plot(t_11, f_aper_11, '.', c='k', markersize=1, label='11')
|
|
2321
|
+
ax0_3.plot(t_38, f_aper_38, '.', c='k', markersize=1, label='38')
|
|
2322
|
+
|
|
2323
|
+
ax1_1.plot(t_02, f_psf_02, '.', c='k', markersize=1, label='2')
|
|
2324
|
+
ax1_2.plot(t_11, f_psf_11, '.', c='k', markersize=1, label='11')
|
|
2325
|
+
ax1_3.plot(t_38, f_psf_38, '.', c='k', markersize=1, label='38')
|
|
2326
|
+
|
|
2327
|
+
# split
|
|
2328
|
+
low = 0.5
|
|
2329
|
+
high = 1.95
|
|
2330
|
+
ax0_1.spines['right'].set_visible(False)
|
|
2331
|
+
ax0_2.spines['left'].set_visible(False)
|
|
2332
|
+
ax0_2.spines['right'].set_visible(False)
|
|
2333
|
+
ax0_3.spines['left'].set_visible(False)
|
|
2334
|
+
d = .7 # proportion of vertical to horizontal extent of the slanted line
|
|
2335
|
+
kwargs = dict(marker=[(-1, -d), (1, d)], markersize=12,
|
|
2336
|
+
linestyle="none", color='k', mec='k', mew=1, clip_on=False)
|
|
2337
|
+
ax0_1.plot([1, 1], [0, 1], transform=ax0_1.transAxes, **kwargs)
|
|
2338
|
+
ax0_2.plot([0, 0], [0, 1], transform=ax0_2.transAxes, **kwargs)
|
|
2339
|
+
ax0_2.plot([1, 1], [0, 1], transform=ax0_2.transAxes, **kwargs)
|
|
2340
|
+
ax0_3.plot([0, 0], [0, 1], transform=ax0_3.transAxes, **kwargs)
|
|
2341
|
+
ax0_1.set_xticklabels([])
|
|
2342
|
+
ax0_2.set_yticklabels([])
|
|
2343
|
+
ax0_2.set_xticklabels([])
|
|
2344
|
+
ax0_2.tick_params(axis='y', left=False)
|
|
2345
|
+
ax0_3.set_yticklabels([])
|
|
2346
|
+
ax0_3.set_xticklabels([])
|
|
2347
|
+
ax0_3.tick_params(axis='y', left=False)
|
|
2348
|
+
ax0_1.set_ylim(low, high)
|
|
2349
|
+
ax0_2.set_ylim(low, high)
|
|
2350
|
+
ax0_3.set_ylim(low, high)
|
|
2351
|
+
ax0_1.set_title('Sector 2')
|
|
2352
|
+
ax0_2.set_title('Sector 11')
|
|
2353
|
+
ax0_3.set_title('Sector 38')
|
|
2354
|
+
ax0_1.text(-0.2, 0.5, 'aperture', horizontalalignment='center',
|
|
2355
|
+
verticalalignment='center', transform=ax0_1.transAxes, rotation=90)
|
|
2356
|
+
ax0_2.text(2.18, 0, f'{hosts[0][0]}', horizontalalignment='center',
|
|
2357
|
+
verticalalignment='center', transform=ax0_2.transAxes, rotation=270, fontweight='semibold')
|
|
2358
|
+
ax0_2.text(2.1, 0, 'RR Lyrae', horizontalalignment='center',
|
|
2359
|
+
verticalalignment='center', transform=ax0_2.transAxes, rotation=270)
|
|
2360
|
+
|
|
2361
|
+
ax1_1.spines['right'].set_visible(False)
|
|
2362
|
+
ax1_2.spines['left'].set_visible(False)
|
|
2363
|
+
ax1_2.spines['right'].set_visible(False)
|
|
2364
|
+
ax1_3.spines['left'].set_visible(False)
|
|
2365
|
+
d = .7 # proportion of vertical to horizontal extent of the slanted line
|
|
2366
|
+
kwargs = dict(marker=[(-1, -d), (1, d)], markersize=12,
|
|
2367
|
+
linestyle="none", color='k', mec='k', mew=1, clip_on=False)
|
|
2368
|
+
ax1_1.plot([1, 1], [0, 1], transform=ax1_1.transAxes, **kwargs)
|
|
2369
|
+
ax1_2.plot([0, 0], [0, 1], transform=ax1_2.transAxes, **kwargs)
|
|
2370
|
+
ax1_2.plot([1, 1], [0, 1], transform=ax1_2.transAxes, **kwargs)
|
|
2371
|
+
ax1_3.plot([0, 0], [0, 1], transform=ax1_3.transAxes, **kwargs)
|
|
2372
|
+
ax1_2.set_yticklabels([])
|
|
2373
|
+
ax1_2.tick_params(axis='y', left=False)
|
|
2374
|
+
ax1_3.set_yticklabels([])
|
|
2375
|
+
ax1_3.tick_params(axis='y', left=False)
|
|
2376
|
+
ax1_1.set_ylim(low, high)
|
|
2377
|
+
ax1_2.set_ylim(low, high)
|
|
2378
|
+
ax1_3.set_ylim(low, high)
|
|
2379
|
+
ax1_1.text(-0.2, 0.5, 'PSF', horizontalalignment='center',
|
|
2380
|
+
verticalalignment='center', transform=ax1_1.transAxes, rotation=90)
|
|
2381
|
+
|
|
2382
|
+
##########
|
|
2383
|
+
period = 10.881 / 24
|
|
2384
|
+
with fits.open(glob(f'{local_directory}lc/hlsp_tglc_tess_ffi_gaiaid-5260885172921947008-s0004*.fits')[0],
|
|
2385
|
+
mode='denywrite') as hdul:
|
|
2386
|
+
q = list(hdul[1].data['TESS_flags'] == 0) and list(hdul[1].data['TGLC_flags'] == 0)
|
|
2387
|
+
t_04 = hdul[1].data['time'][q]
|
|
2388
|
+
f_psf_04 = hdul[1].data['cal_psf_flux'][q]
|
|
2389
|
+
f_aper_04 = hdul[1].data['cal_aper_flux'][q]
|
|
2390
|
+
|
|
2391
|
+
with fits.open(glob(f'{local_directory}lc/hlsp_tglc_tess_ffi_gaiaid-5260885172921947008-s0012*.fits')[0],
|
|
2392
|
+
mode='denywrite') as hdul:
|
|
2393
|
+
q = list(hdul[1].data['TESS_flags'] == 0) and list(hdul[1].data['TGLC_flags'] == 0)
|
|
2394
|
+
t_12 = hdul[1].data['time'][q]
|
|
2395
|
+
f_psf_12 = hdul[1].data['cal_psf_flux'][q]
|
|
2396
|
+
f_aper_12 = hdul[1].data['cal_aper_flux'][q]
|
|
2397
|
+
|
|
2398
|
+
with fits.open(glob(f'{local_directory}lc/hlsp_tglc_tess_ffi_gaiaid-5260885172921947008-s0031*.fits')[0],
|
|
2399
|
+
mode='denywrite') as hdul:
|
|
2400
|
+
q = list(hdul[1].data['TESS_flags'] == 0) and list(hdul[1].data['TGLC_flags'] == 0)
|
|
2401
|
+
t_31 = hdul[1].data['time'][q]
|
|
2402
|
+
f_psf_31 = hdul[1].data['cal_psf_flux'][q]
|
|
2403
|
+
f_aper_31 = hdul[1].data['cal_aper_flux'][q]
|
|
2404
|
+
t_31 = np.mean(t_31[:len(t_31) // 3 * 3].reshape(-1, 3), axis=1)
|
|
2405
|
+
f_psf_31 = np.mean(f_psf_31[:len(f_psf_31) // 3 * 3].reshape(-1, 3), axis=1)
|
|
2406
|
+
f_aper_31 = np.mean(f_aper_31[:len(f_aper_31) // 3 * 3].reshape(-1, 3), axis=1)
|
|
2407
|
+
|
|
2408
|
+
ax3_1 = fig.add_subplot(gs[3, :3])
|
|
2409
|
+
ax3_2 = fig.add_subplot(gs[3, 3:6])
|
|
2410
|
+
ax3_3 = fig.add_subplot(gs[3, 6:])
|
|
2411
|
+
|
|
2412
|
+
ax4_1 = fig.add_subplot(gs[4, :3])
|
|
2413
|
+
ax4_2 = fig.add_subplot(gs[4, 3:6])
|
|
2414
|
+
ax4_3 = fig.add_subplot(gs[4, 6:])
|
|
2415
|
+
|
|
2416
|
+
ax3_1.plot(t_04, f_aper_04, '.', c='k', markersize=1, label='4')
|
|
2417
|
+
ax3_2.plot(t_12, f_aper_12, '.', c='k', markersize=1, label='12')
|
|
2418
|
+
ax3_3.plot(t_31, f_aper_31, '.', c='k', markersize=1, label='31')
|
|
2419
|
+
|
|
2420
|
+
ax4_1.plot(t_04, f_psf_04, '.', c='k', markersize=1, label='4')
|
|
2421
|
+
ax4_2.plot(t_12, f_psf_12, '.', c='k', markersize=1, label='12')
|
|
2422
|
+
ax4_3.plot(t_31, f_psf_31, '.', c='k', markersize=1, label='31')
|
|
2423
|
+
|
|
2424
|
+
# split
|
|
2425
|
+
low = 0.88
|
|
2426
|
+
high = 1.09
|
|
2427
|
+
ax3_1.spines['right'].set_visible(False)
|
|
2428
|
+
ax3_2.spines['left'].set_visible(False)
|
|
2429
|
+
ax3_2.spines['right'].set_visible(False)
|
|
2430
|
+
ax3_3.spines['left'].set_visible(False)
|
|
2431
|
+
d = .7 # proportion of vertical to horizontal extent of the slanted line
|
|
2432
|
+
kwargs = dict(marker=[(-1, -d), (1, d)], markersize=12,
|
|
2433
|
+
linestyle="none", color='k', mec='k', mew=1, clip_on=False)
|
|
2434
|
+
ax3_1.plot([1, 1], [0, 1], transform=ax3_1.transAxes, **kwargs)
|
|
2435
|
+
ax3_2.plot([0, 0], [0, 1], transform=ax3_2.transAxes, **kwargs)
|
|
2436
|
+
ax3_2.plot([1, 1], [0, 1], transform=ax3_2.transAxes, **kwargs)
|
|
2437
|
+
ax3_3.plot([0, 0], [0, 1], transform=ax3_3.transAxes, **kwargs)
|
|
2438
|
+
ax3_1.set_xticklabels([])
|
|
2439
|
+
ax3_2.set_yticklabels([])
|
|
2440
|
+
ax3_2.set_xticklabels([])
|
|
2441
|
+
ax3_2.tick_params(axis='y', left=False)
|
|
2442
|
+
ax3_3.set_yticklabels([])
|
|
2443
|
+
ax3_3.set_xticklabels([])
|
|
2444
|
+
ax3_3.tick_params(axis='y', left=False)
|
|
2445
|
+
ax3_1.set_ylim(low, high)
|
|
2446
|
+
ax3_2.set_ylim(low, high)
|
|
2447
|
+
ax3_3.set_ylim(low, high)
|
|
2448
|
+
ax3_1.set_title('Sector 4')
|
|
2449
|
+
ax3_2.set_title('Sector 12')
|
|
2450
|
+
ax3_3.set_title('Sector 31')
|
|
2451
|
+
ax3_1.text(-0.2, 0.5, 'aperture', horizontalalignment='center',
|
|
2452
|
+
verticalalignment='center', transform=ax3_1.transAxes, rotation=90)
|
|
2453
|
+
ax3_2.text(2.18, 0, f'{hosts[1][0]}', horizontalalignment='center',
|
|
2454
|
+
verticalalignment='center', transform=ax3_2.transAxes, rotation=270, fontweight='semibold')
|
|
2455
|
+
ax3_2.text(2.1, 0, 'Rotator', horizontalalignment='center',
|
|
2456
|
+
verticalalignment='center', transform=ax3_2.transAxes, rotation=270)
|
|
2457
|
+
|
|
2458
|
+
ax4_1.spines['right'].set_visible(False)
|
|
2459
|
+
ax4_2.spines['left'].set_visible(False)
|
|
2460
|
+
ax4_2.spines['right'].set_visible(False)
|
|
2461
|
+
ax4_3.spines['left'].set_visible(False)
|
|
2462
|
+
d = .7 # proportion of vertical to horizontal extent of the slanted line
|
|
2463
|
+
kwargs = dict(marker=[(-1, -d), (1, d)], markersize=12,
|
|
2464
|
+
linestyle="none", color='k', mec='k', mew=1, clip_on=False)
|
|
2465
|
+
ax4_1.plot([1, 1], [0, 1], transform=ax4_1.transAxes, **kwargs)
|
|
2466
|
+
ax4_2.plot([0, 0], [0, 1], transform=ax4_2.transAxes, **kwargs)
|
|
2467
|
+
ax4_2.plot([1, 1], [0, 1], transform=ax4_2.transAxes, **kwargs)
|
|
2468
|
+
ax4_3.plot([0, 0], [0, 1], transform=ax4_3.transAxes, **kwargs)
|
|
2469
|
+
ax4_2.set_yticklabels([])
|
|
2470
|
+
ax4_2.tick_params(axis='y', left=False)
|
|
2471
|
+
ax4_3.set_yticklabels([])
|
|
2472
|
+
ax4_3.tick_params(axis='y', left=False)
|
|
2473
|
+
ax4_1.set_ylim(low, high)
|
|
2474
|
+
ax4_2.set_ylim(low, high)
|
|
2475
|
+
ax4_3.set_ylim(low, high)
|
|
2476
|
+
ax4_3.set_xlabel('TBJD')
|
|
2477
|
+
ax4_1.text(-0.2, 0.5, 'PSF', horizontalalignment='center',
|
|
2478
|
+
verticalalignment='center', transform=ax4_1.transAxes, rotation=90)
|
|
2479
|
+
|
|
2480
|
+
##########
|
|
2481
|
+
period = 1.00581
|
|
2482
|
+
with fits.open(glob(f'{local_directory}lc/hlsp_tglc_tess_ffi_gaiaid-6512192214932460416-s0001*.fits')[0],
|
|
2483
|
+
mode='denywrite') as hdul:
|
|
2484
|
+
q = list(hdul[1].data['TESS_flags'] == 0) and list(hdul[1].data['TGLC_flags'] == 0)
|
|
2485
|
+
t_01 = hdul[1].data['time'][q]
|
|
2486
|
+
f_psf_01 = hdul[1].data['cal_psf_flux'][q]
|
|
2487
|
+
# f_psf_01 = f_psf_01 + hdul[1].header['LOC_BG']
|
|
2488
|
+
# f_psf_01 = flatten(t_01, f_psf_01 / np.nanmedian(f_psf_01), window_length=1, method='biweight',
|
|
2489
|
+
# return_trend=False)
|
|
2490
|
+
f_aper_01 = hdul[1].data['cal_aper_flux'][q]
|
|
2491
|
+
|
|
2492
|
+
with fits.open(glob(f'{local_directory}lc/hlsp_tglc_tess_ffi_gaiaid-6512192214932460416-s0028*.fits')[0],
|
|
2493
|
+
mode='denywrite') as hdul:
|
|
2494
|
+
q = list(hdul[1].data['TESS_flags'] == 0) and list(hdul[1].data['TGLC_flags'] == 0)
|
|
2495
|
+
t_28 = hdul[1].data['time'][q]
|
|
2496
|
+
f_psf_28 = hdul[1].data['cal_psf_flux'][q]
|
|
2497
|
+
f_aper_28 = hdul[1].data['cal_aper_flux'][q]
|
|
2498
|
+
t_28 = np.mean(t_28[:len(t_28) // 3 * 3].reshape(-1, 3), axis=1)
|
|
2499
|
+
f_psf_28 = np.mean(f_psf_28[:len(f_psf_28) // 3 * 3].reshape(-1, 3), axis=1)
|
|
2500
|
+
f_aper_28 = np.mean(f_aper_28[:len(f_aper_28) // 3 * 3].reshape(-1, 3), axis=1)
|
|
2501
|
+
|
|
2502
|
+
ax6_1 = fig.add_subplot(gs[6, :3])
|
|
2503
|
+
ax6_2 = fig.add_subplot(gs[6, 3:6])
|
|
2504
|
+
ax7_1 = fig.add_subplot(gs[7, :3])
|
|
2505
|
+
ax7_2 = fig.add_subplot(gs[7, 3:6])
|
|
2506
|
+
|
|
2507
|
+
ax6_1.plot(t_01, f_aper_01, '.', c='k', markersize=1, label='1')
|
|
2508
|
+
ax6_2.plot(t_28, f_aper_28, '.', c='k', markersize=1, label='28')
|
|
2509
|
+
|
|
2510
|
+
ax7_1.plot(t_01, f_psf_01, '.', c='k', markersize=1, label='1')
|
|
2511
|
+
ax7_2.plot(t_28, f_psf_28, '.', c='k', markersize=1, label='28')
|
|
2512
|
+
|
|
2513
|
+
# split
|
|
2514
|
+
low = 0.45
|
|
2515
|
+
high = 2.4
|
|
2516
|
+
ax6_1.spines['right'].set_visible(False)
|
|
2517
|
+
ax6_2.spines['left'].set_visible(False)
|
|
2518
|
+
d = .7 # proportion of vertical to horizontal extent of the slanted line
|
|
2519
|
+
kwargs = dict(marker=[(-1, -d), (1, d)], markersize=12,
|
|
2520
|
+
linestyle="none", color='k', mec='k', mew=1, clip_on=False)
|
|
2521
|
+
ax6_1.plot([1, 1], [0, 1], transform=ax6_1.transAxes, **kwargs)
|
|
2522
|
+
ax6_2.plot([0, 0], [0, 1], transform=ax6_2.transAxes, **kwargs)
|
|
2523
|
+
ax6_1.set_xticklabels([])
|
|
2524
|
+
ax6_2.set_yticklabels([])
|
|
2525
|
+
ax6_2.set_xticklabels([])
|
|
2526
|
+
ax6_2.tick_params(axis='y', left=False)
|
|
2527
|
+
ax6_1.set_ylim(low, high)
|
|
2528
|
+
ax6_2.set_ylim(low, high)
|
|
2529
|
+
ax6_1.set_title('Sector 1')
|
|
2530
|
+
ax6_2.set_title('Sector 28')
|
|
2531
|
+
ax6_1.text(-0.2, 0.5, 'aperture', horizontalalignment='center',
|
|
2532
|
+
verticalalignment='center', transform=ax6_1.transAxes, rotation=90)
|
|
2533
|
+
ax6_2.text(2.18, 0, f'{hosts[2][0]}', horizontalalignment='center',
|
|
2534
|
+
verticalalignment='center', transform=ax6_2.transAxes, rotation=270, fontweight='semibold')
|
|
2535
|
+
ax6_2.text(2.1, 0, 'Cepheid', horizontalalignment='center',
|
|
2536
|
+
verticalalignment='center', transform=ax6_2.transAxes, rotation=270)
|
|
2537
|
+
|
|
2538
|
+
ax7_1.spines['right'].set_visible(False)
|
|
2539
|
+
ax7_2.spines['left'].set_visible(False)
|
|
2540
|
+
d = .7 # proportion of vertical to horizontal extent of the slanted line
|
|
2541
|
+
kwargs = dict(marker=[(-1, -d), (1, d)], markersize=12,
|
|
2542
|
+
linestyle="none", color='k', mec='k', mew=1, clip_on=False)
|
|
2543
|
+
ax7_1.plot([1, 1], [0, 1], transform=ax7_1.transAxes, **kwargs)
|
|
2544
|
+
ax7_2.plot([0, 0], [0, 1], transform=ax7_2.transAxes, **kwargs)
|
|
2545
|
+
ax7_2.set_yticklabels([])
|
|
2546
|
+
ax7_2.tick_params(axis='y', left=False)
|
|
2547
|
+
ax7_1.set_ylim(low, high)
|
|
2548
|
+
ax7_2.set_ylim(low, high)
|
|
2549
|
+
ax7_1.set_xlabel('TBJD')
|
|
2550
|
+
ax7_2.set_xlabel('TBJD')
|
|
2551
|
+
ax7_1.text(-0.2, 0.5, 'PSF', horizontalalignment='center',
|
|
2552
|
+
verticalalignment='center', transform=ax7_1.transAxes, rotation=90)
|
|
2553
|
+
|
|
2554
|
+
plt.savefig(f'{local_directory}variables.png', bbox_inches='tight', dpi=300)
|
|
2555
|
+
plt.show()
|
|
2556
|
+
|
|
2557
|
+
|
|
2558
|
+
def figure_11():
|
|
2559
|
+
with open(f'/mnt/c/users/tehan/desktop/source_00_03.pkl', 'rb') as input_:
|
|
2560
|
+
source = pickle.load(input_)
|
|
2561
|
+
fig = plt.figure(constrained_layout=False, figsize=(13, 4))
|
|
2562
|
+
gs = fig.add_gridspec(1, 35)
|
|
2563
|
+
gs.update(wspace=1, hspace=0.1)
|
|
2564
|
+
vmax = 140
|
|
2565
|
+
vmin = 100
|
|
2566
|
+
|
|
2567
|
+
ax1 = fig.add_subplot(gs[0, 0:10])
|
|
2568
|
+
ax1.imshow(np.nanmedian(source.flux, axis=0), vmin=vmin, vmax=vmax, origin='lower', cmap='viridis')
|
|
2569
|
+
ax1.set_title('TESS FFI cutout')
|
|
2570
|
+
ax1.set_xticklabels([])
|
|
2571
|
+
ax1.set_yticklabels([])
|
|
2572
|
+
ax1.tick_params(axis='x', bottom=False)
|
|
2573
|
+
ax1.tick_params(axis='y', left=False)
|
|
2574
|
+
# ax1.set_ylabel('Pixels')
|
|
2575
|
+
# ax1.set_xlabel('Pixels')
|
|
2576
|
+
# ax1.set_xlim(50,75)
|
|
2577
|
+
# ax1.set_ylim(80,105)
|
|
2578
|
+
mask = source.mask.data
|
|
2579
|
+
mask[source.mask.mask] = 0
|
|
2580
|
+
# ax2.set_xlim(50,75)
|
|
2581
|
+
# ax2.set_ylim(80,105)
|
|
2582
|
+
|
|
2583
|
+
bg = np.load('/mnt/c/users/tehan/desktop/bg_00_03_sector_2.npy')
|
|
2584
|
+
ax2 = fig.add_subplot(gs[0, 10:20])
|
|
2585
|
+
im2 = ax2.imshow(bg[:150 ** 2, 0].reshape(150, 150), vmin=vmin, vmax=vmax, origin='lower', cmap='viridis')
|
|
2586
|
+
ax2.set_title('Simulated background')
|
|
2587
|
+
# ax2.set_xlabel('Pixels')
|
|
2588
|
+
ax2.set_xticklabels([])
|
|
2589
|
+
ax2.set_yticklabels([])
|
|
2590
|
+
ax2.tick_params(axis='x', bottom=False)
|
|
2591
|
+
ax2.tick_params(axis='y', left=False)
|
|
2592
|
+
|
|
2593
|
+
ax_cb = fig.colorbar(im2, cax=fig.add_subplot(gs[0, 20]), orientation='vertical',
|
|
2594
|
+
boundaries=np.linspace(vmin, vmax, 1000),
|
|
2595
|
+
ticks=[100, 110, 120, 130, 140], aspect=50, shrink=0.7)
|
|
2596
|
+
ax_cb.ax.set_yticklabels(['100', '110', '120', '130', r'$\geq 140$'])
|
|
2597
|
+
|
|
2598
|
+
# ax_cb.ax.set_ylabel(r'TESS Flux ($\mathrm{e^-}$/ s) ')
|
|
2599
|
+
vmin = 0
|
|
2600
|
+
vmax = 40
|
|
2601
|
+
ax3 = fig.add_subplot(gs[0, 24:34])
|
|
2602
|
+
im3 = ax3.imshow(np.nanmedian(source.flux, axis=0) - bg[:150 ** 2, 0].reshape(150, 150), vmin=vmin, vmax=vmax,
|
|
2603
|
+
origin='lower', cmap='viridis')
|
|
2604
|
+
ax3.set_xticklabels([])
|
|
2605
|
+
ax3.set_yticklabels([])
|
|
2606
|
+
ax3.tick_params(axis='x', bottom=False)
|
|
2607
|
+
ax3.tick_params(axis='y', left=False)
|
|
2608
|
+
ax3.set_title('Background removed FFI')
|
|
2609
|
+
# ax3.set_xlabel('Pixels')
|
|
2610
|
+
|
|
2611
|
+
ax_cb = fig.colorbar(im3, cax=fig.add_subplot(gs[0, 34]), orientation='vertical',
|
|
2612
|
+
boundaries=np.linspace(vmin, vmax, 1000),
|
|
2613
|
+
ticks=[0, 10, 20, 30, 40], aspect=50, shrink=0.7)
|
|
2614
|
+
ax_cb.ax.set_yticklabels(['0', '10', '20', '30', r'$\geq 40$'])
|
|
2615
|
+
ax_cb.ax.set_ylabel(r'TESS Flux ($\mathrm{e^-}$/ s) ')
|
|
2616
|
+
# plt.savefig('/mnt/c/users/tehan/desktop/cal_bg.png', bbox_inches='tight', dpi=300)
|
|
2617
|
+
plt.show()
|
|
2618
|
+
|
|
2619
|
+
|
|
2620
|
+
def figure_12():
|
|
2621
|
+
local_directory = '/home/tehan/data/sector0001/'
|
|
2622
|
+
camccd = '4-3'
|
|
2623
|
+
sector = 1
|
|
2624
|
+
fig = plt.figure(constrained_layout=False, figsize=(9, 9))
|
|
2625
|
+
gs = fig.add_gridspec(14, 14)
|
|
2626
|
+
gs.update(wspace=0.05, hspace=0.05)
|
|
2627
|
+
for i in range(196):
|
|
2628
|
+
cut_x = i // 14
|
|
2629
|
+
cut_y = i % 14
|
|
2630
|
+
psf = np.load(f'{local_directory}epsf/{camccd}/epsf_{cut_x:02d}_{cut_y:02d}_sector_{sector}_{camccd}.npy')
|
|
2631
|
+
cmap = 'bone'
|
|
2632
|
+
if np.isnan(psf).any():
|
|
2633
|
+
cmap = 'inferno'
|
|
2634
|
+
ax = fig.add_subplot(gs[13 - cut_y, cut_x])
|
|
2635
|
+
ax.imshow(psf[0, :23 ** 2].reshape(23, 23), cmap=cmap, origin='lower')
|
|
2636
|
+
ax.set_yticklabels([])
|
|
2637
|
+
ax.set_xticklabels([])
|
|
2638
|
+
ax.tick_params(axis='x', bottom=False)
|
|
2639
|
+
ax.tick_params(axis='y', left=False)
|
|
2640
|
+
plt.savefig(f'{local_directory}/epsf_examples.png', bbox_inches='tight', dpi=300)
|
|
2641
|
+
|
|
2642
|
+
|
|
2643
|
+
def figure_13():
|
|
2644
|
+
files = glob.glob('/mnt/c/users/tehan/desktop/powers/*.npy')
|
|
2645
|
+
med_mad = np.load('/mnt/c/users/tehan/desktop/median_mad.npy')
|
|
2646
|
+
powers = np.linspace(0.4, 2, 30)
|
|
2647
|
+
plt.figure(constrained_layout=False, figsize=(5, 4))
|
|
2648
|
+
for i in range(196):
|
|
2649
|
+
residual = np.load(files[i])
|
|
2650
|
+
plt.plot(powers, residual / np.median(residual), c='C0', alpha=0.1)
|
|
2651
|
+
plt.plot(1, 0, c='C0', alpha=1, label='MAD of each cutout')
|
|
2652
|
+
plt.plot(powers, med_mad / np.median(med_mad), c='C1', lw=2.5, label='MAD of all cutouts')
|
|
2653
|
+
plt.legend()
|
|
2654
|
+
plt.xlabel(r'weighting power $l$')
|
|
2655
|
+
plt.ylabel('Normalized MAD of residual image')
|
|
2656
|
+
plt.ylim(0.86, 1.8)
|
|
2657
|
+
plt.savefig(f'/mnt/c/users/tehan/desktop/powers.png', bbox_inches='tight', dpi=300)
|
|
2658
|
+
plt.show()
|
|
2659
|
+
|
|
2660
|
+
|
|
2661
|
+
if __name__ == '__main__':
|
|
2662
|
+
figure_3()
|