quicklook-package 1.1.2__tar.gz → 1.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {quicklook_package-1.1.2/quicklook_package.egg-info → quicklook_package-1.2}/PKG-INFO +17 -18
- {quicklook_package-1.1.2 → quicklook_package-1.2}/README.md +16 -17
- {quicklook_package-1.1.2 → quicklook_package-1.2}/quicklook/tql.py +116 -100
- {quicklook_package-1.1.2 → quicklook_package-1.2/quicklook_package.egg-info}/PKG-INFO +17 -18
- {quicklook_package-1.1.2 → quicklook_package-1.2}/setup.py +1 -1
- quicklook_package-1.2/tests/test_tql.py +39 -0
- quicklook_package-1.1.2/tests/test_tql.py +0 -21
- {quicklook_package-1.1.2 → quicklook_package-1.2}/LICENSE +0 -0
- {quicklook_package-1.1.2 → quicklook_package-1.2}/pyproject.toml +0 -0
- {quicklook_package-1.1.2 → quicklook_package-1.2}/quicklook/__init__.py +0 -0
- {quicklook_package-1.1.2 → quicklook_package-1.2}/quicklook/gls.py +0 -0
- {quicklook_package-1.1.2 → quicklook_package-1.2}/quicklook/measure.py +0 -0
- {quicklook_package-1.1.2 → quicklook_package-1.2}/quicklook/plot.py +0 -0
- {quicklook_package-1.1.2 → quicklook_package-1.2}/quicklook/utils.py +0 -0
- {quicklook_package-1.1.2 → quicklook_package-1.2}/quicklook_package.egg-info/SOURCES.txt +0 -0
- {quicklook_package-1.1.2 → quicklook_package-1.2}/quicklook_package.egg-info/dependency_links.txt +0 -0
- {quicklook_package-1.1.2 → quicklook_package-1.2}/quicklook_package.egg-info/requires.txt +0 -0
- {quicklook_package-1.1.2 → quicklook_package-1.2}/quicklook_package.egg-info/top_level.txt +0 -0
- {quicklook_package-1.1.2 → quicklook_package-1.2}/scripts/ql +0 -0
- {quicklook_package-1.1.2 → quicklook_package-1.2}/scripts/read_tls +0 -0
- {quicklook_package-1.1.2 → quicklook_package-1.2}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: quicklook-package
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.2
|
|
4
4
|
Summary: Quicklook lightcurve plot generator
|
|
5
5
|
Home-page: https://github.com/jpdeleon/quicklook
|
|
6
6
|
Author-email: jpdeleon <jpdeleon.bsap@gmail.com>
|
|
@@ -25,30 +25,29 @@ Requires-Dist: astroplan==0.9
|
|
|
25
25
|
Requires-Dist: loguru
|
|
26
26
|
|
|
27
27
|
# QuickLook
|
|
28
|
-
`quicklook` is a Python program that runs a simple pipeline to search for transit signal in TESS (and Kepler soon) light curves. This program can be run in a jupyter notebook
|
|
28
|
+
`quicklook` is a Python program that runs a simple pipeline to search for transit signal in TESS (and Kepler soon) light curves. This program can be run in a jupyter notebook or from the terminal using the `ql` script.
|
|
29
29
|
|
|
30
30
|
## Use case
|
|
31
31
|
Given target name, run periodograms on a TESS or Kepler lightcurve (if it exists) to measure the stellar rotation period and the orbital period of a potential companion i.e. planet, brown dwarf, or star.
|
|
32
32
|
Although `quicklook` is optimized to find transiting exoplanets, this tool can also find eclipsing binaries and many other periodic signals.
|
|
33
33
|
|
|
34
|
-
## Try it on Google colab
|
|
35
|
-
|
|
36
|
-
<a href="https://colab.research.google.com/github/jpdeleon/quicklook/blob/main/notebook/examples.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
|
|
37
|
-
|
|
38
|
-
|
|
39
34
|
## Installation
|
|
40
|
-
Create a conda environment called, say `my_env`, and install there
|
|
35
|
+
Create a conda environment called, say `my_env`, and install there the latest version of `quicklook-package`
|
|
41
36
|
```bash
|
|
42
37
|
$ conda create -n my_env python=3.10
|
|
43
38
|
$ conda activate my_env
|
|
44
|
-
(my_env) $
|
|
45
|
-
(my_env) $ python -m pip install -e git+https://github.com/jpdeleon/quicklook.git#egg=quicklook
|
|
39
|
+
(my_env) $ pip install -U quicklook-package
|
|
46
40
|
```
|
|
47
41
|
|
|
48
|
-
If you want to run `quicklook` in a notebook, you also need to install jupyter
|
|
42
|
+
If you want to run `quicklook` locally in a notebook, you also need to install jupyter
|
|
49
43
|
```
|
|
50
|
-
(my_env) $
|
|
44
|
+
(my_env) $ pip install jupyter notebook
|
|
51
45
|
```
|
|
46
|
+
See [example notebook](https://github.com/jpdeleon/quicklook/blob/main/notebook/examples.ipynb).
|
|
47
|
+
|
|
48
|
+
## Try it on Google colab
|
|
49
|
+
|
|
50
|
+
<a href="https://colab.research.google.com/github/jpdeleon/quicklook/blob/main/notebook/examples.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
|
|
52
51
|
|
|
53
52
|
## Command line script
|
|
54
53
|
```bash
|
|
@@ -63,7 +62,7 @@ Notes:
|
|
|
63
62
|
* use single hyphen (-flag) if no value is needed.
|
|
64
63
|
* use double hyphen (--flag value) if value is needed.
|
|
65
64
|
|
|
66
|
-
Example: ql --name TOI-
|
|
65
|
+
Example: ql --name TOI-5071 --sector 46 -save -verbose
|
|
67
66
|
|
|
68
67
|
options:
|
|
69
68
|
-h, --help show this help message and exit
|
|
@@ -101,12 +100,12 @@ options:
|
|
|
101
100
|
|
|
102
101
|
## Examples
|
|
103
102
|
|
|
104
|
-
1. Run `quicklook` on the most recent TESS lightcurve of TOI
|
|
103
|
+
1. Run `quicklook` on the most recent TESS lightcurve of TOI-5071 (aka K2-100).
|
|
105
104
|
|
|
106
105
|
```shell
|
|
107
106
|
(my_env) $ ql --name TOI-5071
|
|
108
107
|
```
|
|
109
|
-

|
|
110
109
|
|
|
111
110
|
The figure above shows 9 panels. Let's break them down.
|
|
112
111
|
* top row
|
|
@@ -124,7 +123,7 @@ The figure above shows 9 panels. Let's break them down.
|
|
|
124
123
|
|
|
125
124
|
Try changing the parameters:
|
|
126
125
|
```shell
|
|
127
|
-
(my_env) $ ql --name
|
|
126
|
+
(my_env) $ ql --name TIC-52368076 -verbose -save | tee output.log
|
|
128
127
|
(my_env) $ ql --name TOI-125.01 --pipeline qlp #specific pipeline
|
|
129
128
|
(my_env) $ ql --name TOI-125.01 --sector 2 #specific TESS sector
|
|
130
129
|
(my_env) $ ql --name TOI-125.01 --flatten_method cosine #specific function to detrend baseline
|
|
@@ -133,10 +132,10 @@ Try changing the parameters:
|
|
|
133
132
|
|
|
134
133
|
## Advanced usage
|
|
135
134
|
|
|
136
|
-
If you would like to run `ql` on a list of TIC IDs (saved as `tic_ids.txt`), then you can make a batch script named `run_ql_given_tic.batch`. The output files containing the plots (*.png) and periodogram results (*_tls.h5) will be saved in `tic_dir` directory:
|
|
135
|
+
If you would like to run `ql` on a list of TIC IDs (saved as `tic_ids.txt`), then you can make a batch script named `run_ql_given_tic.batch`. The output files containing the logs (*.log), plots (*.png), and periodogram results (*_tls.h5) will be saved in `tic_dir` directory:
|
|
137
136
|
|
|
138
137
|
```shell
|
|
139
|
-
(my_env) $ cat tic_ids.txt | while read tic; do echo ql --name TIC$tic -save --outdir tic_dir
|
|
138
|
+
(my_env) $ cat tic_ids.txt | while read tic; do echo ql --name TIC$tic -save --outdir tic_dir | tee TIC$tic.log; done > run_ql_given_tic.batch
|
|
140
139
|
```
|
|
141
140
|
|
|
142
141
|
To test the Nth line of the batch script,
|
|
@@ -1,28 +1,27 @@
|
|
|
1
1
|
# QuickLook
|
|
2
|
-
`quicklook` is a Python program that runs a simple pipeline to search for transit signal in TESS (and Kepler soon) light curves. This program can be run in a jupyter notebook
|
|
2
|
+
`quicklook` is a Python program that runs a simple pipeline to search for transit signal in TESS (and Kepler soon) light curves. This program can be run in a jupyter notebook or from the terminal using the `ql` script.
|
|
3
3
|
|
|
4
4
|
## Use case
|
|
5
5
|
Given target name, run periodograms on a TESS or Kepler lightcurve (if it exists) to measure the stellar rotation period and the orbital period of a potential companion i.e. planet, brown dwarf, or star.
|
|
6
6
|
Although `quicklook` is optimized to find transiting exoplanets, this tool can also find eclipsing binaries and many other periodic signals.
|
|
7
7
|
|
|
8
|
-
## Try it on Google colab
|
|
9
|
-
|
|
10
|
-
<a href="https://colab.research.google.com/github/jpdeleon/quicklook/blob/main/notebook/examples.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
|
|
11
|
-
|
|
12
|
-
|
|
13
8
|
## Installation
|
|
14
|
-
Create a conda environment called, say `my_env`, and install there
|
|
9
|
+
Create a conda environment called, say `my_env`, and install there the latest version of `quicklook-package`
|
|
15
10
|
```bash
|
|
16
11
|
$ conda create -n my_env python=3.10
|
|
17
12
|
$ conda activate my_env
|
|
18
|
-
(my_env) $
|
|
19
|
-
(my_env) $ python -m pip install -e git+https://github.com/jpdeleon/quicklook.git#egg=quicklook
|
|
13
|
+
(my_env) $ pip install -U quicklook-package
|
|
20
14
|
```
|
|
21
15
|
|
|
22
|
-
If you want to run `quicklook` in a notebook, you also need to install jupyter
|
|
16
|
+
If you want to run `quicklook` locally in a notebook, you also need to install jupyter
|
|
23
17
|
```
|
|
24
|
-
(my_env) $
|
|
18
|
+
(my_env) $ pip install jupyter notebook
|
|
25
19
|
```
|
|
20
|
+
See [example notebook](https://github.com/jpdeleon/quicklook/blob/main/notebook/examples.ipynb).
|
|
21
|
+
|
|
22
|
+
## Try it on Google colab
|
|
23
|
+
|
|
24
|
+
<a href="https://colab.research.google.com/github/jpdeleon/quicklook/blob/main/notebook/examples.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
|
|
26
25
|
|
|
27
26
|
## Command line script
|
|
28
27
|
```bash
|
|
@@ -37,7 +36,7 @@ Notes:
|
|
|
37
36
|
* use single hyphen (-flag) if no value is needed.
|
|
38
37
|
* use double hyphen (--flag value) if value is needed.
|
|
39
38
|
|
|
40
|
-
Example: ql --name TOI-
|
|
39
|
+
Example: ql --name TOI-5071 --sector 46 -save -verbose
|
|
41
40
|
|
|
42
41
|
options:
|
|
43
42
|
-h, --help show this help message and exit
|
|
@@ -75,12 +74,12 @@ options:
|
|
|
75
74
|
|
|
76
75
|
## Examples
|
|
77
76
|
|
|
78
|
-
1. Run `quicklook` on the most recent TESS lightcurve of TOI
|
|
77
|
+
1. Run `quicklook` on the most recent TESS lightcurve of TOI-5071 (aka K2-100).
|
|
79
78
|
|
|
80
79
|
```shell
|
|
81
80
|
(my_env) $ ql --name TOI-5071
|
|
82
81
|
```
|
|
83
|
-

|
|
84
83
|
|
|
85
84
|
The figure above shows 9 panels. Let's break them down.
|
|
86
85
|
* top row
|
|
@@ -98,7 +97,7 @@ The figure above shows 9 panels. Let's break them down.
|
|
|
98
97
|
|
|
99
98
|
Try changing the parameters:
|
|
100
99
|
```shell
|
|
101
|
-
(my_env) $ ql --name
|
|
100
|
+
(my_env) $ ql --name TIC-52368076 -verbose -save | tee output.log
|
|
102
101
|
(my_env) $ ql --name TOI-125.01 --pipeline qlp #specific pipeline
|
|
103
102
|
(my_env) $ ql --name TOI-125.01 --sector 2 #specific TESS sector
|
|
104
103
|
(my_env) $ ql --name TOI-125.01 --flatten_method cosine #specific function to detrend baseline
|
|
@@ -107,10 +106,10 @@ Try changing the parameters:
|
|
|
107
106
|
|
|
108
107
|
## Advanced usage
|
|
109
108
|
|
|
110
|
-
If you would like to run `ql` on a list of TIC IDs (saved as `tic_ids.txt`), then you can make a batch script named `run_ql_given_tic.batch`. The output files containing the plots (*.png) and periodogram results (*_tls.h5) will be saved in `tic_dir` directory:
|
|
109
|
+
If you would like to run `ql` on a list of TIC IDs (saved as `tic_ids.txt`), then you can make a batch script named `run_ql_given_tic.batch`. The output files containing the logs (*.log), plots (*.png), and periodogram results (*_tls.h5) will be saved in `tic_dir` directory:
|
|
111
110
|
|
|
112
111
|
```shell
|
|
113
|
-
(my_env) $ cat tic_ids.txt | while read tic; do echo ql --name TIC$tic -save --outdir tic_dir
|
|
112
|
+
(my_env) $ cat tic_ids.txt | while read tic; do echo ql --name TIC$tic -save --outdir tic_dir | tee TIC$tic.log; done > run_ql_given_tic.batch
|
|
114
113
|
```
|
|
115
114
|
|
|
116
115
|
To test the Nth line of the batch script,
|
|
@@ -80,41 +80,11 @@ class TessQuickLook:
|
|
|
80
80
|
):
|
|
81
81
|
# start timer
|
|
82
82
|
self.timer_start = timer()
|
|
83
|
-
self.verbose = verbose
|
|
84
83
|
self.target_name = target_name
|
|
85
|
-
logger.info(f"Generating
|
|
84
|
+
logger.info(f"Generating quicklook for {self.target_name}...")
|
|
85
|
+
self.verbose = verbose
|
|
86
86
|
self.tfop_info = get_tfop_info(target_name)
|
|
87
|
-
self.
|
|
88
|
-
self.tfop_info.get("basic_info")["star_names"].split(", ")
|
|
89
|
-
)
|
|
90
|
-
if self.verbose:
|
|
91
|
-
print(f"Catalog names:")
|
|
92
|
-
for n in self.star_names:
|
|
93
|
-
print(f"\t{n}")
|
|
94
|
-
self.gaia_name = self.star_names[
|
|
95
|
-
np.array([i[:4].lower() == "gaia" for i in self.star_names])
|
|
96
|
-
][0]
|
|
97
|
-
self.gaiaid = int(self.gaia_name.split()[-1])
|
|
98
|
-
ra, dec = (
|
|
99
|
-
self.tfop_info.get("coordinates")["ra"],
|
|
100
|
-
self.tfop_info.get("coordinates")["dec"],
|
|
101
|
-
)
|
|
102
|
-
self.target_coord = SkyCoord(ra=ra, dec=dec, unit="degree")
|
|
103
|
-
|
|
104
|
-
if target_name.lower()[:3] == "toi":
|
|
105
|
-
toiid = int(float(target_name.split("-")[-1]))
|
|
106
|
-
else:
|
|
107
|
-
idx = [i[:3].lower() == "toi" for i in self.star_names]
|
|
108
|
-
if sum(idx) > 0:
|
|
109
|
-
toiid = int(self.star_names[idx][0].split("-")[-1])
|
|
110
|
-
else:
|
|
111
|
-
toiid = None
|
|
112
|
-
self.toiid = toiid
|
|
113
|
-
self.ticid = int(self.tfop_info.get("basic_info")["tic_id"])
|
|
114
|
-
if self.ticid is not None:
|
|
115
|
-
self.query_name = f"TIC{self.ticid}"
|
|
116
|
-
else:
|
|
117
|
-
self.query_name = self.target_name.replace("-", " ")
|
|
87
|
+
self.parse_tfop_info()
|
|
118
88
|
self.simbad_obj_type = self.get_simbad_obj_type()
|
|
119
89
|
self.flux_type = flux_type
|
|
120
90
|
self.exptime = exptime
|
|
@@ -135,49 +105,8 @@ class TessQuickLook:
|
|
|
135
105
|
)
|
|
136
106
|
self.gp_kernel_size = gp_kernel_size
|
|
137
107
|
self.edge_cutoff = edge_cutoff
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
err_msg = (
|
|
141
|
-
"Custom ephem must be a tuple: (t0,t0err,P,Perr,t14,t14err)"
|
|
142
|
-
)
|
|
143
|
-
if len(custom_ephem) != 6:
|
|
144
|
-
logger.error(f"Error: {err_msg}")
|
|
145
|
-
sys.exit()
|
|
146
|
-
if self.verbose:
|
|
147
|
-
print(
|
|
148
|
-
f"Using ephemeris mask:\nP={custom_ephem[0]}d\nt0={custom_ephem[2]}BJD\nt14={custom_ephem[4]}d"
|
|
149
|
-
)
|
|
150
|
-
# TODO: using tfop in variable name is misleading
|
|
151
|
-
if custom_ephem[0] > TESS_TIME_OFFSET:
|
|
152
|
-
if self.verbose:
|
|
153
|
-
print(
|
|
154
|
-
"Custom transit epoch given in JD. Converting to BTJD = JD-{TESS_TIME_OFFSET:,}."
|
|
155
|
-
)
|
|
156
|
-
custom_ephem[0] -= TESS_TIME_OFFSET
|
|
157
|
-
self.tfop_epoch = (custom_ephem[0], custom_ephem[1])
|
|
158
|
-
self.tfop_period = (custom_ephem[2], custom_ephem[3])
|
|
159
|
-
if custom_ephem[4] > 1:
|
|
160
|
-
if self.verbose:
|
|
161
|
-
print(
|
|
162
|
-
"Custom transit duration given in hours. Converting to days."
|
|
163
|
-
)
|
|
164
|
-
custom_ephem[4] /= 24
|
|
165
|
-
custom_ephem[5] /= 24
|
|
166
|
-
self.tfop_dur = (custom_ephem[4], custom_ephem[5])
|
|
167
|
-
self.tfop_depth = None
|
|
168
|
-
else:
|
|
169
|
-
# use tfop ephem if available
|
|
170
|
-
(
|
|
171
|
-
self.tfop_epoch,
|
|
172
|
-
self.tfop_period,
|
|
173
|
-
self.tfop_dur,
|
|
174
|
-
self.tfop_depth,
|
|
175
|
-
) = (
|
|
176
|
-
self.get_toi_ephem()
|
|
177
|
-
if len(self.tfop_info.get("planet_parameters")) != 0
|
|
178
|
-
else (None, None, None, None)
|
|
179
|
-
)
|
|
180
|
-
self.ephem_source = "tfop" if self.tfop_epoch[0] else None
|
|
108
|
+
self.custom_ephem = custom_ephem
|
|
109
|
+
self.parse_custom_ephem()
|
|
181
110
|
|
|
182
111
|
if window_length is None:
|
|
183
112
|
self.window_length = (
|
|
@@ -191,13 +120,13 @@ class TessQuickLook:
|
|
|
191
120
|
|
|
192
121
|
self.tmask = self.get_transit_mask()
|
|
193
122
|
err_msg = "No masked transits"
|
|
194
|
-
if self.tmask.sum() == 0:
|
|
123
|
+
if self.tfop_epoch is not None and self.tmask.sum() == 0:
|
|
195
124
|
logger.error(f"Error: {err_msg}")
|
|
196
125
|
sys.exit()
|
|
197
126
|
if mask_ephem:
|
|
198
127
|
if self.verbose:
|
|
199
128
|
logger.info(
|
|
200
|
-
f"Masking transits in raw lightcurve using {self.ephem_source} ephem
|
|
129
|
+
f"Masking transits in raw lightcurve using {self.ephem_source} ephem..."
|
|
201
130
|
)
|
|
202
131
|
self.raw_lc = self.raw_lc[~self.tmask]
|
|
203
132
|
# update tmask
|
|
@@ -258,6 +187,90 @@ class TessQuickLook:
|
|
|
258
187
|
args = ", ".join(args)
|
|
259
188
|
return f"{type(self).__name__}({args})"
|
|
260
189
|
|
|
190
|
+
def parse_tfop_info(self):
|
|
191
|
+
"""
|
|
192
|
+
Parse the TFOP info to get the star names, Gaia name, Gaia ID, and target coordinates.
|
|
193
|
+
"""
|
|
194
|
+
self.star_names = np.array(
|
|
195
|
+
self.tfop_info.get("basic_info")["star_names"].split(", ")
|
|
196
|
+
)
|
|
197
|
+
if self.verbose:
|
|
198
|
+
print(f"Catalog names:")
|
|
199
|
+
for n in self.star_names:
|
|
200
|
+
print(f"\t{n}")
|
|
201
|
+
self.gaia_name = self.star_names[
|
|
202
|
+
np.array([i[:4].lower() == "gaia" for i in self.star_names])
|
|
203
|
+
][0]
|
|
204
|
+
self.gaiaid = int(self.gaia_name.split()[-1])
|
|
205
|
+
ra, dec = (
|
|
206
|
+
self.tfop_info.get("coordinates")["ra"],
|
|
207
|
+
self.tfop_info.get("coordinates")["dec"],
|
|
208
|
+
)
|
|
209
|
+
self.target_coord = SkyCoord(ra=ra, dec=dec, unit="degree")
|
|
210
|
+
|
|
211
|
+
if self.target_name.lower()[:3] == "toi":
|
|
212
|
+
self.toiid = int(float(self.target_name.split("-")[-1]))
|
|
213
|
+
else:
|
|
214
|
+
idx = [i[:3].lower() == "toi" for i in self.star_names]
|
|
215
|
+
if sum(idx) > 0:
|
|
216
|
+
toiid = int(self.star_names[idx][0].split("-")[-1])
|
|
217
|
+
else:
|
|
218
|
+
toiid = None
|
|
219
|
+
self.toiid = toiid
|
|
220
|
+
self.ticid = int(self.tfop_info.get("basic_info")["tic_id"])
|
|
221
|
+
if self.ticid is not None:
|
|
222
|
+
self.query_name = f"TIC{self.ticid}"
|
|
223
|
+
else:
|
|
224
|
+
self.query_name = self.target_name.replace("-", " ")
|
|
225
|
+
|
|
226
|
+
def parse_custom_ephem(self):
|
|
227
|
+
"""
|
|
228
|
+
Parse the custom ephem to get the ephemeris source and parameters.
|
|
229
|
+
"""
|
|
230
|
+
if self.custom_ephem:
|
|
231
|
+
self.ephem_source = "custom"
|
|
232
|
+
err_msg = (
|
|
233
|
+
"Custom ephem must be a tuple: (t0,t0err,P,Perr,t14,t14err)"
|
|
234
|
+
)
|
|
235
|
+
if len(self.custom_ephem) != 6:
|
|
236
|
+
logger.error(f"Error: {err_msg}")
|
|
237
|
+
sys.exit()
|
|
238
|
+
if self.verbose:
|
|
239
|
+
logger.info(
|
|
240
|
+
f"Using ephemeris mask:\nP={self.custom_ephem[0]}d\nt0={self.custom_ephem[2]}BJD\nt14={self.custom_ephem[4]}d"
|
|
241
|
+
)
|
|
242
|
+
# TODO: using tfop in variable name is misleading
|
|
243
|
+
if self.custom_ephem[0] > TESS_TIME_OFFSET:
|
|
244
|
+
if self.verbose:
|
|
245
|
+
logger.info(
|
|
246
|
+
"Custom transit epoch given in JD. Converting to BTJD = JD-{TESS_TIME_OFFSET:,}."
|
|
247
|
+
)
|
|
248
|
+
self.custom_ephem[0] -= TESS_TIME_OFFSET
|
|
249
|
+
self.tfop_epoch = (self.custom_ephem[0], self.custom_ephem[1])
|
|
250
|
+
self.tfop_period = (self.custom_ephem[2], self.custom_ephem[3])
|
|
251
|
+
if self.custom_ephem[4] > 1:
|
|
252
|
+
if self.verbose:
|
|
253
|
+
logger.info(
|
|
254
|
+
"Custom transit duration given in hours. Converting to days."
|
|
255
|
+
)
|
|
256
|
+
self.custom_ephem[4] /= 24
|
|
257
|
+
self.custom_ephem[5] /= 24
|
|
258
|
+
self.tfop_dur = (self.custom_ephem[4], self.custom_ephem[5])
|
|
259
|
+
self.tfop_depth = None
|
|
260
|
+
else:
|
|
261
|
+
# use tfop ephem if available
|
|
262
|
+
(
|
|
263
|
+
self.tfop_epoch,
|
|
264
|
+
self.tfop_period,
|
|
265
|
+
self.tfop_dur,
|
|
266
|
+
self.tfop_depth,
|
|
267
|
+
) = (
|
|
268
|
+
self.get_toi_ephem()
|
|
269
|
+
if len(self.tfop_info.get("planet_parameters")) != 0
|
|
270
|
+
else (None, None, None, None)
|
|
271
|
+
)
|
|
272
|
+
self.ephem_source = "tfop" if self.tfop_epoch is not None else None
|
|
273
|
+
|
|
261
274
|
def check_file_exists(self):
|
|
262
275
|
name = self.target_name.replace(" ", "")
|
|
263
276
|
if name.lower()[:3] == "toi":
|
|
@@ -361,7 +374,7 @@ class TessQuickLook:
|
|
|
361
374
|
sector_orig = None
|
|
362
375
|
else:
|
|
363
376
|
sector_orig = kwargs.pop("sector")
|
|
364
|
-
sector = None if sector_orig in ["all", -1] else sector_orig
|
|
377
|
+
sector = None if sector_orig in ["all", -1] else int(sector_orig)
|
|
365
378
|
kwargs["sector"] = sector
|
|
366
379
|
|
|
367
380
|
if sector_orig == "all":
|
|
@@ -423,6 +436,9 @@ class TessQuickLook:
|
|
|
423
436
|
if self.verbose:
|
|
424
437
|
print(f"Filtered lightcurves based on query ({kwargs}):")
|
|
425
438
|
print(search_result.table.to_pandas()[cols])
|
|
439
|
+
msg = f"Downloading all {kwargs.get('author')} lcs..."
|
|
440
|
+
if self.verbose:
|
|
441
|
+
logger.info(msg)
|
|
426
442
|
filtered_sectors = self.get_unique_sectors(search_result)
|
|
427
443
|
if len(filtered_sectors) <= 1:
|
|
428
444
|
logger.error(
|
|
@@ -430,17 +446,20 @@ class TessQuickLook:
|
|
|
430
446
|
)
|
|
431
447
|
sys.exit()
|
|
432
448
|
lc = search_result.download_all().stitch()
|
|
433
|
-
|
|
449
|
+
self.sector = self.all_sectors
|
|
450
|
+
exptime = int(lc.meta["EXPOSURE"] / 10) * 10
|
|
451
|
+
msg = f"Downloaded all {kwargs.get('author')} (exp={exptime} s) lcs in sectors {', '.join([str(s) for s in self.all_sectors])}."
|
|
434
452
|
if self.verbose:
|
|
435
453
|
logger.info(msg)
|
|
436
|
-
exptime = int(lc.meta["EXPOSURE"] / 10) * 10
|
|
437
|
-
self.sector = self.all_sectors
|
|
438
454
|
else:
|
|
439
455
|
# Download the light curve for the specified sector
|
|
456
|
+
msg = f"Downloading {kwargs.get('author').upper()} lc..."
|
|
457
|
+
if self.verbose:
|
|
458
|
+
logger.info(msg)
|
|
440
459
|
idx = sector_orig if sector_orig == -1 else 0
|
|
441
460
|
lc = search_result[idx].download()
|
|
442
|
-
exptime =
|
|
443
|
-
msg = f"Downloaded {
|
|
461
|
+
exptime = int(lc.meta["EXPOSURE"] / 10) * 10
|
|
462
|
+
msg = f"Downloaded {lc.meta['AUTHOR'].upper()} (exp={exptime} s) lc in sector {lc.sector}."
|
|
444
463
|
if self.verbose:
|
|
445
464
|
logger.info(msg)
|
|
446
465
|
self.sector = lc.sector
|
|
@@ -452,6 +471,7 @@ class TessQuickLook:
|
|
|
452
471
|
# Set exposure time and cadence
|
|
453
472
|
if self.exptime is None:
|
|
454
473
|
self.exptime = exptime
|
|
474
|
+
# assert self.exptime == search_result.exptime[idx].value
|
|
455
475
|
self.cadence = "short" if self.exptime < 1800 else "long"
|
|
456
476
|
|
|
457
477
|
# Apply sigma clipping if specified
|
|
@@ -491,7 +511,7 @@ class TessQuickLook:
|
|
|
491
511
|
sector_orig = None
|
|
492
512
|
else:
|
|
493
513
|
sector_orig = kwargs.pop("sector")
|
|
494
|
-
sector = None if sector_orig in ["all", -1] else sector_orig
|
|
514
|
+
sector = None if sector_orig in ["all", -1] else int(sector_orig)
|
|
495
515
|
kwargs["sector"] = sector
|
|
496
516
|
|
|
497
517
|
if kwargs.get("author") is None:
|
|
@@ -520,7 +540,7 @@ class TessQuickLook:
|
|
|
520
540
|
tpf_authors[i] for i in range(len(tpf_authors)) if i != "QLP"
|
|
521
541
|
][0]
|
|
522
542
|
if self.verbose:
|
|
523
|
-
logger.info(f"Using {kwargs.get('author').upper()} TPF
|
|
543
|
+
logger.info(f"Using {kwargs.get('author').upper()} TPF...")
|
|
524
544
|
|
|
525
545
|
# Search using the specified author and sector
|
|
526
546
|
search_result = lk.search_targetpixelfile(self.query_name, **kwargs)
|
|
@@ -529,13 +549,16 @@ class TessQuickLook:
|
|
|
529
549
|
if len(search_result) == 0:
|
|
530
550
|
logger.error(f"Error: {err_msg}")
|
|
531
551
|
sys.exit()
|
|
552
|
+
msg = f"Downloading TPF..."
|
|
553
|
+
if self.verbose:
|
|
554
|
+
logger.info(msg)
|
|
532
555
|
idx = sector_orig if sector_orig == -1 else 0
|
|
533
556
|
tpf = search_result[idx].download()
|
|
534
557
|
# FIXME: What is the correct tpf aperture for other pipeline?
|
|
535
558
|
# author = tpf.meta['PROCVER'].split('-')[0]
|
|
536
559
|
author = search_result.author[idx].upper()
|
|
537
560
|
exptime = search_result.exptime[idx].value
|
|
538
|
-
msg = f"Downloaded {author
|
|
561
|
+
msg = f"Downloaded {author} (exp={exptime} s) TPF "
|
|
539
562
|
msg += f"in sector {tpf.meta['SECTOR']}."
|
|
540
563
|
if self.verbose:
|
|
541
564
|
logger.info(msg)
|
|
@@ -673,7 +696,7 @@ class TessQuickLook:
|
|
|
673
696
|
)
|
|
674
697
|
if self.verbose:
|
|
675
698
|
logger.info(
|
|
676
|
-
"Estimating rotation period using Generalized Lomb-Scargle (GLS) periodogram
|
|
699
|
+
"Estimating rotation period using Generalized Lomb-Scargle (GLS) periodogram..."
|
|
677
700
|
)
|
|
678
701
|
return Gls(
|
|
679
702
|
data, Pbeg=self.Porb_min, Pend=self.Porb_max, verbose=self.verbose
|
|
@@ -790,7 +813,7 @@ class TessQuickLook:
|
|
|
790
813
|
try:
|
|
791
814
|
# Convert to float or int as needed
|
|
792
815
|
params[name] = (
|
|
793
|
-
int(star_params.get(name))
|
|
816
|
+
int(float(star_params.get(name)))
|
|
794
817
|
if name == "teff"
|
|
795
818
|
else float(star_params.get(name))
|
|
796
819
|
)
|
|
@@ -1004,11 +1027,9 @@ class TessQuickLook:
|
|
|
1004
1027
|
self.trend_lc.plot(ax=ax, color="r", lw=2, label="trend")
|
|
1005
1028
|
|
|
1006
1029
|
if self.verbose:
|
|
1007
|
-
logger.info("
|
|
1030
|
+
logger.info("Running Lomb-Scargle periodogram...")
|
|
1008
1031
|
ax = axes.flatten()[1]
|
|
1009
1032
|
if self.pg_method == "gls":
|
|
1010
|
-
if self.verbose:
|
|
1011
|
-
logger.info("Initializing GLS...")
|
|
1012
1033
|
self.gls = self.init_gls()
|
|
1013
1034
|
ax = plot_gls_periodogram(
|
|
1014
1035
|
self.gls,
|
|
@@ -1023,7 +1044,7 @@ class TessQuickLook:
|
|
|
1023
1044
|
self.Prot_ls = self.gls.best["P"]
|
|
1024
1045
|
if math.isnan(self.gls.power.max()):
|
|
1025
1046
|
logger.error(
|
|
1026
|
-
"GLS power
|
|
1047
|
+
"GLS power is NaN, switching to astropy's Lomb-Scargle..."
|
|
1027
1048
|
)
|
|
1028
1049
|
ax.clear()
|
|
1029
1050
|
self.pg_method = "lombscargle"
|
|
@@ -1035,8 +1056,6 @@ class TessQuickLook:
|
|
|
1035
1056
|
)
|
|
1036
1057
|
self.Prot_ls = pg.period_at_max_power.value
|
|
1037
1058
|
else:
|
|
1038
|
-
if self.verbose:
|
|
1039
|
-
logger.info(f"Using periodogram method: {self.pg_method}...")
|
|
1040
1059
|
self.gls = None
|
|
1041
1060
|
pg = plot_periodogram(
|
|
1042
1061
|
self.raw_lc[~self.tmask],
|
|
@@ -1045,7 +1064,6 @@ class TessQuickLook:
|
|
|
1045
1064
|
ax=ax,
|
|
1046
1065
|
)
|
|
1047
1066
|
self.Prot_ls = pg.period_at_max_power.value
|
|
1048
|
-
|
|
1049
1067
|
if self.verbose:
|
|
1050
1068
|
logger.info("Appending TLS results...")
|
|
1051
1069
|
self.append_tls_results()
|
|
@@ -1125,8 +1143,6 @@ class TessQuickLook:
|
|
|
1125
1143
|
self.tpf = self.get_tpf_tesscut()
|
|
1126
1144
|
self.sap_mask = "square"
|
|
1127
1145
|
else:
|
|
1128
|
-
if self.verbose:
|
|
1129
|
-
logger.info("Getting TPF...")
|
|
1130
1146
|
self.tpf = self.get_tpf(
|
|
1131
1147
|
sector=self.sector,
|
|
1132
1148
|
author=self.pipeline,
|
|
@@ -1204,13 +1220,13 @@ class TessQuickLook:
|
|
|
1204
1220
|
title = ""
|
|
1205
1221
|
if self.toiid is not None:
|
|
1206
1222
|
title = f"TOI {self.toiid} | "
|
|
1207
|
-
title += f"TIC {self.ticid} "
|
|
1223
|
+
title += f"TIC {self.ticid} | sector {self.sector} | "
|
|
1208
1224
|
lctype = (
|
|
1209
1225
|
f"{self.pipeline.upper()}/{self.flux_type}"
|
|
1210
1226
|
if self.pipeline == "spoc"
|
|
1211
1227
|
else self.pipeline.upper()
|
|
1212
1228
|
)
|
|
1213
|
-
title += f"
|
|
1229
|
+
title += f"{lctype.upper()} lightcurve"
|
|
1214
1230
|
fig.suptitle(title, y=1.0, fontsize=20)
|
|
1215
1231
|
|
|
1216
1232
|
if (self.outdir is not None) & (not Path(self.outdir).exists()):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: quicklook-package
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.2
|
|
4
4
|
Summary: Quicklook lightcurve plot generator
|
|
5
5
|
Home-page: https://github.com/jpdeleon/quicklook
|
|
6
6
|
Author-email: jpdeleon <jpdeleon.bsap@gmail.com>
|
|
@@ -25,30 +25,29 @@ Requires-Dist: astroplan==0.9
|
|
|
25
25
|
Requires-Dist: loguru
|
|
26
26
|
|
|
27
27
|
# QuickLook
|
|
28
|
-
`quicklook` is a Python program that runs a simple pipeline to search for transit signal in TESS (and Kepler soon) light curves. This program can be run in a jupyter notebook
|
|
28
|
+
`quicklook` is a Python program that runs a simple pipeline to search for transit signal in TESS (and Kepler soon) light curves. This program can be run in a jupyter notebook or from the terminal using the `ql` script.
|
|
29
29
|
|
|
30
30
|
## Use case
|
|
31
31
|
Given target name, run periodograms on a TESS or Kepler lightcurve (if it exists) to measure the stellar rotation period and the orbital period of a potential companion i.e. planet, brown dwarf, or star.
|
|
32
32
|
Although `quicklook` is optimized to find transiting exoplanets, this tool can also find eclipsing binaries and many other periodic signals.
|
|
33
33
|
|
|
34
|
-
## Try it on Google colab
|
|
35
|
-
|
|
36
|
-
<a href="https://colab.research.google.com/github/jpdeleon/quicklook/blob/main/notebook/examples.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
|
|
37
|
-
|
|
38
|
-
|
|
39
34
|
## Installation
|
|
40
|
-
Create a conda environment called, say `my_env`, and install there
|
|
35
|
+
Create a conda environment called, say `my_env`, and install there the latest version of `quicklook-package`
|
|
41
36
|
```bash
|
|
42
37
|
$ conda create -n my_env python=3.10
|
|
43
38
|
$ conda activate my_env
|
|
44
|
-
(my_env) $
|
|
45
|
-
(my_env) $ python -m pip install -e git+https://github.com/jpdeleon/quicklook.git#egg=quicklook
|
|
39
|
+
(my_env) $ pip install -U quicklook-package
|
|
46
40
|
```
|
|
47
41
|
|
|
48
|
-
If you want to run `quicklook` in a notebook, you also need to install jupyter
|
|
42
|
+
If you want to run `quicklook` locally in a notebook, you also need to install jupyter
|
|
49
43
|
```
|
|
50
|
-
(my_env) $
|
|
44
|
+
(my_env) $ pip install jupyter notebook
|
|
51
45
|
```
|
|
46
|
+
See [example notebook](https://github.com/jpdeleon/quicklook/blob/main/notebook/examples.ipynb).
|
|
47
|
+
|
|
48
|
+
## Try it on Google colab
|
|
49
|
+
|
|
50
|
+
<a href="https://colab.research.google.com/github/jpdeleon/quicklook/blob/main/notebook/examples.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
|
|
52
51
|
|
|
53
52
|
## Command line script
|
|
54
53
|
```bash
|
|
@@ -63,7 +62,7 @@ Notes:
|
|
|
63
62
|
* use single hyphen (-flag) if no value is needed.
|
|
64
63
|
* use double hyphen (--flag value) if value is needed.
|
|
65
64
|
|
|
66
|
-
Example: ql --name TOI-
|
|
65
|
+
Example: ql --name TOI-5071 --sector 46 -save -verbose
|
|
67
66
|
|
|
68
67
|
options:
|
|
69
68
|
-h, --help show this help message and exit
|
|
@@ -101,12 +100,12 @@ options:
|
|
|
101
100
|
|
|
102
101
|
## Examples
|
|
103
102
|
|
|
104
|
-
1. Run `quicklook` on the most recent TESS lightcurve of TOI
|
|
103
|
+
1. Run `quicklook` on the most recent TESS lightcurve of TOI-5071 (aka K2-100).
|
|
105
104
|
|
|
106
105
|
```shell
|
|
107
106
|
(my_env) $ ql --name TOI-5071
|
|
108
107
|
```
|
|
109
|
-

|
|
110
109
|
|
|
111
110
|
The figure above shows 9 panels. Let's break them down.
|
|
112
111
|
* top row
|
|
@@ -124,7 +123,7 @@ The figure above shows 9 panels. Let's break them down.
|
|
|
124
123
|
|
|
125
124
|
Try changing the parameters:
|
|
126
125
|
```shell
|
|
127
|
-
(my_env) $ ql --name
|
|
126
|
+
(my_env) $ ql --name TIC-52368076 -verbose -save | tee output.log
|
|
128
127
|
(my_env) $ ql --name TOI-125.01 --pipeline qlp #specific pipeline
|
|
129
128
|
(my_env) $ ql --name TOI-125.01 --sector 2 #specific TESS sector
|
|
130
129
|
(my_env) $ ql --name TOI-125.01 --flatten_method cosine #specific function to detrend baseline
|
|
@@ -133,10 +132,10 @@ Try changing the parameters:
|
|
|
133
132
|
|
|
134
133
|
## Advanced usage
|
|
135
134
|
|
|
136
|
-
If you would like to run `ql` on a list of TIC IDs (saved as `tic_ids.txt`), then you can make a batch script named `run_ql_given_tic.batch`. The output files containing the plots (*.png) and periodogram results (*_tls.h5) will be saved in `tic_dir` directory:
|
|
135
|
+
If you would like to run `ql` on a list of TIC IDs (saved as `tic_ids.txt`), then you can make a batch script named `run_ql_given_tic.batch`. The output files containing the logs (*.log), plots (*.png), and periodogram results (*_tls.h5) will be saved in `tic_dir` directory:
|
|
137
136
|
|
|
138
137
|
```shell
|
|
139
|
-
(my_env) $ cat tic_ids.txt | while read tic; do echo ql --name TIC$tic -save --outdir tic_dir
|
|
138
|
+
(my_env) $ cat tic_ids.txt | while read tic; do echo ql --name TIC$tic -save --outdir tic_dir | tee TIC$tic.log; done > run_ql_given_tic.batch
|
|
140
139
|
```
|
|
141
140
|
|
|
142
141
|
To test the Nth line of the batch script,
|
|
@@ -10,7 +10,7 @@ with open("requirements.txt") as f:
|
|
|
10
10
|
# see pyproject.toml for details such as version and requirements
|
|
11
11
|
setup(
|
|
12
12
|
name="quicklook-package",
|
|
13
|
-
version="1.
|
|
13
|
+
version="1.2",
|
|
14
14
|
description="Quicklook lightcurve plot generator",
|
|
15
15
|
long_description=long_description,
|
|
16
16
|
long_description_content_type="text/markdown",
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
from quicklook.tql import TessQuickLook
|
|
3
|
+
from matplotlib.figure import Figure
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
@pytest.fixture
|
|
7
|
+
def planet_inputs():
|
|
8
|
+
# Provide sample data for testing
|
|
9
|
+
return {
|
|
10
|
+
"target_name": "WASP-21",
|
|
11
|
+
"sector": 56,
|
|
12
|
+
"flux_type": "pdcsap",
|
|
13
|
+
"pipeline": "SPOC",
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def test_tql_planet(planet_inputs):
|
|
18
|
+
ql = TessQuickLook(**planet_inputs)
|
|
19
|
+
assert isinstance(ql, TessQuickLook)
|
|
20
|
+
fig = ql.plot_tql()
|
|
21
|
+
assert isinstance(fig, Figure)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
@pytest.fixture
|
|
25
|
+
def eb_inputs():
|
|
26
|
+
# Provide sample data for testing
|
|
27
|
+
return {
|
|
28
|
+
"target_name": "TIC 144539611",
|
|
29
|
+
"sector": 4,
|
|
30
|
+
"flux_type": "pdcsap",
|
|
31
|
+
"pipeline": "SPOC",
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def test_tql_eb(eb_inputs):
|
|
36
|
+
ql = TessQuickLook(**eb_inputs)
|
|
37
|
+
assert isinstance(ql, TessQuickLook)
|
|
38
|
+
fig = ql.plot_tql()
|
|
39
|
+
assert isinstance(fig, Figure)
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import pytest
|
|
2
|
-
from quicklook.tql import TessQuickLook
|
|
3
|
-
from matplotlib.figure import Figure
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
@pytest.fixture
|
|
7
|
-
def sample_inputs():
|
|
8
|
-
# Provide sample data for testing
|
|
9
|
-
return {
|
|
10
|
-
"target_name": "WASP-21",
|
|
11
|
-
"sector": 56,
|
|
12
|
-
"flux_type": "pdcsap",
|
|
13
|
-
"pipeline": "SPOC",
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
def test_tql(sample_inputs):
|
|
18
|
-
ql = TessQuickLook(**sample_inputs)
|
|
19
|
-
assert isinstance(ql, TessQuickLook)
|
|
20
|
-
fig = ql.plot_tql()
|
|
21
|
-
assert isinstance(fig, Figure)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{quicklook_package-1.1.2 → quicklook_package-1.2}/quicklook_package.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|