gputls 2.2.3__tar.gz → 2.2.7__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.
- gputls-2.2.7/PKG-INFO +308 -0
- gputls-2.2.7/README.md +261 -0
- {gputls-2.2.3 → gputls-2.2.7}/src/gputls/constants.py +5 -7
- {gputls-2.2.3 → gputls-2.2.7}/src/gputls/core.py +279 -118
- {gputls-2.2.3 → gputls-2.2.7}/src/gputls/kernels.cu +455 -16
- {gputls-2.2.3 → gputls-2.2.7}/src/gputls/main.py +28 -7
- {gputls-2.2.3 → gputls-2.2.7}/src/gputls/results.py +2 -4
- gputls-2.2.7/src/gputls/screening_policy.py +42 -0
- {gputls-2.2.3 → gputls-2.2.7}/src/gputls/stats.py +71 -2
- gputls-2.2.7/src/gputls/template_approximation.py +190 -0
- {gputls-2.2.3 → gputls-2.2.7}/src/gputls/validate.py +37 -2
- {gputls-2.2.3 → gputls-2.2.7}/src/gputls/version.py +1 -1
- {gputls-2.2.3 → gputls-2.2.7}/src/gputls/workspace.py +9 -6
- gputls-2.2.7/src/gputls.egg-info/PKG-INFO +308 -0
- {gputls-2.2.3 → gputls-2.2.7}/src/gputls.egg-info/SOURCES.txt +4 -0
- {gputls-2.2.3 → gputls-2.2.7}/tests/test_candidate_screening.py +31 -0
- gputls-2.2.7/tests/test_final_candidate.py +69 -0
- {gputls-2.2.3 → gputls-2.2.7}/tests/test_gtls.py +122 -0
- gputls-2.2.7/tests/test_screening_schedule.py +169 -0
- {gputls-2.2.3 → gputls-2.2.7}/tests/test_stats.py +21 -3
- {gputls-2.2.3 → gputls-2.2.7}/tests/test_window_reuse.py +1 -0
- gputls-2.2.3/PKG-INFO +0 -240
- gputls-2.2.3/README.md +0 -193
- gputls-2.2.3/src/gputls.egg-info/PKG-INFO +0 -240
- {gputls-2.2.3 → gputls-2.2.7}/LICENSE +0 -0
- {gputls-2.2.3 → gputls-2.2.7}/pyproject.toml +0 -0
- {gputls-2.2.3 → gputls-2.2.7}/setup.cfg +0 -0
- {gputls-2.2.3 → gputls-2.2.7}/src/gputls/__init__.py +0 -0
- {gputls-2.2.3 → gputls-2.2.7}/src/gputls/grid.py +0 -0
- {gputls-2.2.3 → gputls-2.2.7}/src/gputls/helpers.py +0 -0
- {gputls-2.2.3 → gputls-2.2.7}/src/gputls/interpolation.py +0 -0
- {gputls-2.2.3 → gputls-2.2.7}/src/gputls/screening.py +0 -0
- {gputls-2.2.3 → gputls-2.2.7}/src/gputls/transit.py +0 -0
- {gputls-2.2.3 → gputls-2.2.7}/src/gputls.egg-info/dependency_links.txt +0 -0
- {gputls-2.2.3 → gputls-2.2.7}/src/gputls.egg-info/requires.txt +0 -0
- {gputls-2.2.3 → gputls-2.2.7}/src/gputls.egg-info/top_level.txt +0 -0
- {gputls-2.2.3 → gputls-2.2.7}/tests/test_bucket_sort.py +0 -0
- {gputls-2.2.3 → gputls-2.2.7}/tests/test_patch_scan.py +0 -0
- {gputls-2.2.3 → gputls-2.2.7}/tests/test_snr_units.py +0 -0
- {gputls-2.2.3 → gputls-2.2.7}/tests/test_tls_compare.py +0 -0
- {gputls-2.2.3 → gputls-2.2.7}/tests/test_workspace.py +0 -0
gputls-2.2.7/PKG-INFO
ADDED
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: gputls
|
|
3
|
+
Version: 2.2.7
|
|
4
|
+
Summary: GPU-accelerated Transit Least Squares (TLS) for periodic transit detection
|
|
5
|
+
Author-email: Quanquan Hu <huqq1917@outlook.com>
|
|
6
|
+
Maintainer-email: Quanquan Hu <huqq1917@outlook.com>
|
|
7
|
+
License: MIT License
|
|
8
|
+
|
|
9
|
+
Copyright (c) 2018 Michael Hippke 2023 Quanquan Hu
|
|
10
|
+
|
|
11
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
12
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
13
|
+
in the Software without restriction, including without limitation the rights
|
|
14
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
15
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
16
|
+
furnished to do so, subject to the following conditions:
|
|
17
|
+
|
|
18
|
+
The above copyright notice and this permission notice shall be included in all
|
|
19
|
+
copies or substantial portions of the Software.
|
|
20
|
+
|
|
21
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
22
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
23
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
24
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
25
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
26
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
27
|
+
SOFTWARE.
|
|
28
|
+
|
|
29
|
+
Project-URL: Homepage, https://github.com/Farthing-0/GTLS
|
|
30
|
+
Project-URL: Source, https://github.com/Farthing-0/GTLS
|
|
31
|
+
Project-URL: Issues, https://github.com/Farthing-0/GTLS/issues
|
|
32
|
+
Keywords: astronomy,exoplanet,transit,TLS,GPU,CUDA
|
|
33
|
+
Classifier: Development Status :: 3 - Alpha
|
|
34
|
+
Classifier: Intended Audience :: Science/Research
|
|
35
|
+
Classifier: Topic :: Scientific/Engineering :: Astronomy
|
|
36
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
37
|
+
Classifier: Environment :: GPU :: NVIDIA CUDA
|
|
38
|
+
Classifier: Programming Language :: Python :: 3
|
|
39
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
40
|
+
Requires-Python: >=3.8
|
|
41
|
+
Description-Content-Type: text/markdown
|
|
42
|
+
Provides-Extra: cuda11
|
|
43
|
+
Provides-Extra: cuda12
|
|
44
|
+
Provides-Extra: cuda13
|
|
45
|
+
Provides-Extra: test
|
|
46
|
+
License-File: LICENSE
|
|
47
|
+
|
|
48
|
+
# GTLS: GPU Transit Least Squares
|
|
49
|
+
|
|
50
|
+
[](https://pypi.org/project/gputls/)
|
|
51
|
+
[](https://github.com/Farthing-0/GTLS/blob/main/LICENSE)
|
|
52
|
+
|
|
53
|
+
**GTLS** (`gputls` on PyPI) is a CUDA-accelerated implementation of the [Transit Least Squares (TLS)](https://github.com/hippke/tls) algorithm for detecting periodic exoplanet transits in photometric light curves.
|
|
54
|
+
|
|
55
|
+
It preserves the TLS transit-shape templates and search grids while parallelising phase folding, depth estimation, and weighted residual evaluation on NVIDIA GPUs—achieving **27.9× median paired speedup** over 28-worker CPU TLS 2.0.4 (`fused-pl`) on a 1470-day *Kepler*-like light curve on an RTX 5090, while reproducing the CPU search's best period, epoch, and S/N.
|
|
56
|
+
|
|
57
|
+

|
|
58
|
+
|
|
59
|
+
## Why GTLS?
|
|
60
|
+
|
|
61
|
+
- **Familiar API**: Near drop-in replacement for `transitleastsquares` (`from gputls import gtls`), supporting default limb-darkened, grazing, and box templates.
|
|
62
|
+
- **Substantial GPU speedup**: Evaluates trial periods in batches via CuPy and custom CUDA kernels, with both TLS2 backends (`fused-pl` and `fused`).
|
|
63
|
+
- **Automatic memory management**: Adapts period batch sizes to free GPU VRAM, enabling multi-year, high-cadence searches on a single GPU.
|
|
64
|
+
- **Multi-GPU scaling**: Run on a specific card (`GPUDeviceID=0`) or split one search across multiple GPUs (`GPUDeviceIDs=[0, 1]`) with identical results.
|
|
65
|
+
|
|
66
|
+
## Installation
|
|
67
|
+
|
|
68
|
+
### Prerequisites
|
|
69
|
+
|
|
70
|
+
- An NVIDIA GPU with CUDA support (`nvidia-smi` should list your GPU)
|
|
71
|
+
- Python ≥ 3.8
|
|
72
|
+
- [CuPy](https://cupy.dev/) matching your CUDA version
|
|
73
|
+
|
|
74
|
+
### Install with `pip`
|
|
75
|
+
|
|
76
|
+
Note that the PyPI package name is **`gputls`** (imported in Python as `gputls`).
|
|
77
|
+
|
|
78
|
+
| Environment | Install command | Notes |
|
|
79
|
+
| --- | --- | --- |
|
|
80
|
+
| **CUDA 12.x** (recommended) | `pip install "gputls[cuda12]"` | Installs `cupy-cuda12x[ctk]` with CUDA headers |
|
|
81
|
+
| **CUDA 13.x** | `pip install "gputls[cuda13]"` | Installs `cupy-cuda13x[ctk]` with CUDA headers |
|
|
82
|
+
| **CUDA 11.x** | `pip install "gputls[cuda11]"` | Requires a local [CUDA Toolkit](https://developer.nvidia.com/cuda-toolkit-archive) (`CUDA_PATH`) |
|
|
83
|
+
| **CuPy already installed** | `pip install gputls` | Uses your existing CuPy installation |
|
|
84
|
+
|
|
85
|
+
Or install from source:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
git clone https://github.com/Farthing-0/GTLS.git
|
|
89
|
+
cd GTLS
|
|
90
|
+
pip install .
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Verify your installation
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
python -c "import cupy, gputls; print('gputls:', gputls.__version__, '| GPUs:', cupy.cuda.runtime.getDeviceCount())"
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
> **Troubleshooting (`Failed to find CUDA headers`):** GTLS compiles its CUDA kernels at runtime via CuPy. If you installed CuPy manually without CUDA headers, reinstall with `pip install "cupy-cuda12x[ctk]"` (or `cupy-cuda13x[ctk]`), or point `CUDA_PATH` to your local CUDA Toolkit (e.g., `export CUDA_PATH=/usr/local/cuda-11.8`).
|
|
100
|
+
|
|
101
|
+
## Quick start
|
|
102
|
+
|
|
103
|
+
### Self-contained example
|
|
104
|
+
|
|
105
|
+
Copy and run this minimal script—no external light-curve files required:
|
|
106
|
+
|
|
107
|
+
```python
|
|
108
|
+
import numpy as np
|
|
109
|
+
from gputls import gtls
|
|
110
|
+
|
|
111
|
+
# 1. Create a 60-day synthetic light curve with a 5.0-day transit
|
|
112
|
+
rng = np.random.default_rng(42)
|
|
113
|
+
time = np.linspace(0, 60, 60 * 48) # 30-min cadence, in days
|
|
114
|
+
flux = np.ones_like(time) + rng.normal(0, 3e-4, time.size)
|
|
115
|
+
in_transit = np.abs((time - 1.2 + 2.5) % 5.0 - 2.5) < 0.06
|
|
116
|
+
flux[in_transit] -= 0.002 # 2000 ppm transit depth
|
|
117
|
+
|
|
118
|
+
# 2. Run the GPU transit search
|
|
119
|
+
model = gtls(time, flux)
|
|
120
|
+
result = model.power()
|
|
121
|
+
|
|
122
|
+
print(
|
|
123
|
+
f"Period = {result.period:.4f} d, T0 = {result.T0:.4f} d, "
|
|
124
|
+
f"Depth = {result.depth:.5f}, SDE = {result.SDE:.1f}"
|
|
125
|
+
)
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Expected output (numbers vary slightly with GPU precision):
|
|
129
|
+
|
|
130
|
+
```text
|
|
131
|
+
Period = 5.0003 d, T0 = 1.1988 d, Depth = 0.00226, SDE = 31.7
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### Input data requirements
|
|
135
|
+
|
|
136
|
+
Before passing a real light curve (e.g., from *Kepler* or TESS) to `gtls(time, flux, dy=None)`:
|
|
137
|
+
|
|
138
|
+
1. **`time`** *(1D array, days)*: Time stamps must be finite and span $> 0$ days (at least 3 valid points). `NaN`/`inf` entries are filtered out automatically.
|
|
139
|
+
2. **`flux`** *(1D array, normalised)*: Flux must be positive, finite, and detrended around **`1.0`** (GTLS warns if the mean flux falls outside `0.99–1.01`). For real stellar light curves, detrend first with a filter such as [`wotan`](https://github.com/hippke/wotan).
|
|
140
|
+
3. **`dy`** *(1D array, optional)*: Per-point flux uncertainties. If omitted, GTLS assigns a uniform uncertainty equal to `np.std(flux)`.
|
|
141
|
+
|
|
142
|
+
### Migrating from CPU `TLS`
|
|
143
|
+
|
|
144
|
+
Switching from `transitleastsquares` usually requires changing only the import and constructor:
|
|
145
|
+
|
|
146
|
+
```python
|
|
147
|
+
# Before (CPU TLS)
|
|
148
|
+
# from transitleastsquares import transitleastsquares
|
|
149
|
+
# result = transitleastsquares(time, flux, dy).power()
|
|
150
|
+
|
|
151
|
+
# After (GTLS)
|
|
152
|
+
from gputls import gtls
|
|
153
|
+
result = gtls(time, flux, dy).power()
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
> **Important differences from CPU `TLS`:**
|
|
157
|
+
> - **`result.depth` convention**: GTLS reports the **fractional transit depth** (`1 - flux_in_transit`, e.g. `0.002` for a 0.2% transit), whereas upstream TLS reports the **in-transit flux level** (`1 - depth = 0.998`).
|
|
158
|
+
> - **Legacy/CPU-only arguments**: `use_threads`, `show_progress_bar`, and `verbose` are accepted in `power()` for compatibility and ignored.
|
|
159
|
+
> - **Removed/empty fields**: `snrFit` and `snrFitPink` have been removed; `possiblePeriods` and `possiblePeriodsIndices` are returned as empty lists.
|
|
160
|
+
|
|
161
|
+
## Common options and choosing a backend
|
|
162
|
+
|
|
163
|
+
`power()` accepts standard TLS keyword arguments alongside GPU controls. Most users only need the options below:
|
|
164
|
+
|
|
165
|
+
| Argument | Default | Description |
|
|
166
|
+
| --- | --- | --- |
|
|
167
|
+
| `backend` | `"fused-pl"` | Residual scoring kernel: `"fused-pl"` (piecewise-linear template approximation, TLS2 style) or `"fused"` (exact full-template scoring) |
|
|
168
|
+
| `period_min`, `period_max` | `0`, `inf` | Search bounds in days (`0` and `inf` use the automatic physical bounds) |
|
|
169
|
+
| `periods` | `[]` | Explicit array of trial periods (days); overrides the automatic grid |
|
|
170
|
+
| `n_transits_min` | `2` | Minimum number of transits required; sets the default upper period limit (`baseline / n_transits_min`) |
|
|
171
|
+
| `R_star`, `M_star` | `1.0`, `1.0` | Host star radius and mass (solar units) used to construct the frequency grid |
|
|
172
|
+
| `R_star_min`, `R_star_max` | `0.13`, `3.5` | Stellar radius bounds (solar units) for the trial duration grid |
|
|
173
|
+
| `M_star_min`, `M_star_max` | `0.1`, `1.0` | Stellar mass bounds (solar units) for the trial duration grid |
|
|
174
|
+
| `oversampling_factor` | `3` | Frequency-grid oversampling factor |
|
|
175
|
+
| `duration_grid_step` | `1.1` | Multiplicative step between adjacent trial durations |
|
|
176
|
+
| `transit_depth_min` | `1e-5` | Minimum trial transit depth to evaluate |
|
|
177
|
+
| `transit_template` | `"default"` | `"default"` (limb-darkened), `"grazing"`, or `"box"` |
|
|
178
|
+
| `GPUDeviceID` | `0` | CUDA device index for single-GPU runs |
|
|
179
|
+
| `GPUDeviceIDs` | `None` | List of CUDA device indices to split one search across multiple GPUs (e.g., `[0, 1]`); overrides `GPUDeviceID` |
|
|
180
|
+
| `fast` | `False` | If `True`, returns only `(periods, power)` and skips final epoch refinement and transit statistics |
|
|
181
|
+
|
|
182
|
+
### Which `backend` should I use?
|
|
183
|
+
|
|
184
|
+
- **`backend="fused-pl"` (default)**: Fastest for almost all standard searches—including *Kepler* long cadence, 2-minute TESS sectors, and multi-year light curves down to ~100 s cadence. Uses TLS 2.0.4's piecewise-linear template approximation, coarse initial phase scan (`T0_coarsen=3`), and duration scouting (`scout_every=4`), followed by a full-template final epoch fit.
|
|
185
|
+
- **`backend="fused"`**: Evaluates the exact sampled template without piecewise-linear approximation or duration scouting. Recommended if you want zero template approximation, or on **very densely sampled, multi-year light curves** (e.g., 25–50 s cadence over 1–4 years), where preparing cumulative sums in `fused-pl` outweighs its scoring savings.
|
|
186
|
+
|
|
187
|
+
<details>
|
|
188
|
+
<summary><strong>Advanced tuning parameters & environment variables</strong></summary>
|
|
189
|
+
|
|
190
|
+
| Argument / Env Var | Default | Description |
|
|
191
|
+
| --- | --- | --- |
|
|
192
|
+
| `T0_fit_margin` | `0.01` | Base phase step as a fraction of trial duration (`0` to `0.125`; `0` tests every folded sample). Legacy `T0_refine_margin` is deprecated |
|
|
193
|
+
| `T0_coarsen` / `TLS_T0_COARSEN` | `3` (`fused-pl`), `1` (`fused`) | Set `3` to scan every third base-grid start (when `3 * T0_fit_margin * width >= 2`) and refine locally (`±2` steps); set `1` to scan every base-grid start |
|
|
194
|
+
| `scout_every` / `TLS_SCOUT_EVERY` | `4` (`fused-pl`), `0` (`fused`) | For curves with `>= 2000` points, scans all phases at every `scout_every`-th duration (plus shortest and longest) and searches remaining durations near those peaks. Set `0` or `1` to disable |
|
|
195
|
+
| `screening_tolerances` | `None` | Strictly decreasing positive certificate tolerances for `fused` pruning. `None` uses `(0.05, 0.015, 0.005, 0.00025)`; `()` disables pruning. Affects runtime only, not the final periodogram |
|
|
196
|
+
| `screening_policy` | `"fixed"` | `"auto"` benchmarks 1–4 leading cascade levels per period band on the fly (`model.screening_diagnostics` records timing). Cannot be combined with explicit `screening_tolerances` |
|
|
197
|
+
| `bar_location` | `0` | `tqdm` progress bar vertical offset when running multiple searches concurrently |
|
|
198
|
+
| `TLS_BACKEND` | `"fused-pl"` | Default backend when `backend` is not passed to `power()` |
|
|
199
|
+
| `TLS_PL_EPS`, `TLS_PL_A2_SPREAD_MAX` | `0.02`, `0.1` | Piecewise-linear fit relative tolerance and weight-spread limit for `fused-pl` |
|
|
200
|
+
|
|
201
|
+
**Implementation notes:**
|
|
202
|
+
- **Four-level fused screening**: Curves with `>= 32,768` samples and batches with `>= 128` periods run a single fused screening cascade with early block termination; smaller workloads keep separate kernels to avoid extra register pressure.
|
|
203
|
+
- **Auto screening (`screening_policy="auto"`)**: Measures disjoint interleaved subsets per period band (factors of 32 for `< 32,768` samples, factors of 8 for larger curves) and prefers fewer levels within 5% of the fastest measurement. Calibration work contributes to the search itself and is included in total runtime.
|
|
204
|
+
- **Pink-noise S/N (`snrPink`)**: Uses GPU window standard deviations for finite `float64` inputs with `>= 4096` windows and widths `<= 1024` points, preserving NumPy summation order; other inputs use the CPU path.
|
|
205
|
+
|
|
206
|
+
</details>
|
|
207
|
+
|
|
208
|
+
## Search outputs (`gtlsResult`)
|
|
209
|
+
|
|
210
|
+
`power()` returns a `gtlsResult` object (unless `fast=True`):
|
|
211
|
+
|
|
212
|
+
| Attribute | Description |
|
|
213
|
+
| --- | --- |
|
|
214
|
+
| `period` | Best orbital period (days) |
|
|
215
|
+
| `T0` | Mid-transit epoch of the first transit (days) |
|
|
216
|
+
| `duration` | Fitted transit duration (days) |
|
|
217
|
+
| `depth` | Fractional transit depth (`1 - flux_in_transit`) |
|
|
218
|
+
| `SDE` | Peak Signal Detection Efficiency |
|
|
219
|
+
| `snr`, `snrPink` | White-noise and pink-noise (correlated) signal-to-noise ratios |
|
|
220
|
+
| `transitTimes` | Mid-transit times falling within the light curve (days) |
|
|
221
|
+
| `periods`, `power` | Trial period grid and corresponding SDE periodogram |
|
|
222
|
+
|
|
223
|
+
<details>
|
|
224
|
+
<summary><strong>Additional & legacy attributes on <code>gtlsResult</code></strong></summary>
|
|
225
|
+
|
|
226
|
+
| Attribute | Description |
|
|
227
|
+
| --- | --- |
|
|
228
|
+
| `chi2` | Minimum weighted $\chi^2$ per trial period after refinement |
|
|
229
|
+
| `raw_power`, `raw_chi2` | Unmasked SDE power and $\chi^2$ from the single period-grid scan |
|
|
230
|
+
| `rawDuration`, `rawDurations` | Best fractional duration (`duration / period`) and master fractional-duration grid |
|
|
231
|
+
| `durationPoints` | Best template width in phase-folded data points |
|
|
232
|
+
| `possiblePeriods`, `possiblePeriodsIndices` | Legacy TLS fields, returned as empty lists |
|
|
233
|
+
|
|
234
|
+
</details>
|
|
235
|
+
|
|
236
|
+
## Examples & tutorials
|
|
237
|
+
|
|
238
|
+
The [`examples/`](https://github.com/Farthing-0/GTLS/tree/main/examples) directory contains side-by-side Jupyter notebooks comparing GTLS and TLS on real space-telescope light curves:
|
|
239
|
+
|
|
240
|
+
- [`kepler_tutorial.ipynb`](https://github.com/Farthing-0/GTLS/blob/main/examples/kepler_tutorial.ipynb): Searching a *Kepler* target downloaded with `lightkurve`
|
|
241
|
+
- [`tess_tutorial.ipynb`](https://github.com/Farthing-0/GTLS/blob/main/examples/tess_tutorial.ipynb): Searching a TESS target
|
|
242
|
+
|
|
243
|
+
Notebook extras: `pip install matplotlib astropy transitleastsquares lightkurve wotan`.
|
|
244
|
+
|
|
245
|
+
## Testing & benchmarks
|
|
246
|
+
|
|
247
|
+
Install test dependencies (`pytest`, `astropy`, `lightkurve`) with:
|
|
248
|
+
|
|
249
|
+
```bash
|
|
250
|
+
pip install "gputls[test]"
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
Run the GPU test suite (end-to-end synthetic injection-recovery, `fast` mode, real *Kepler* data in [`tests/data/`](https://github.com/Farthing-0/GTLS/tree/main/tests/data), VRAM cleanup, and single- vs. multi-GPU parity):
|
|
254
|
+
|
|
255
|
+
```bash
|
|
256
|
+
./run_tests.sh # build + test on GPU 0
|
|
257
|
+
./run_tests.sh 1 # build + test on GPU 1
|
|
258
|
+
PYTHON=/path/to/python ./run_tests.sh
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
Or run `pytest tests` directly (select the GPU via `GTLS_GPU_DEVICE`).
|
|
262
|
+
|
|
263
|
+
To benchmark against CPU `TLS 1.32` and `TLS 2.0.4` (see [`tests/tls_compare/`](https://github.com/Farthing-0/GTLS/tree/main/tests/tls_compare)):
|
|
264
|
+
|
|
265
|
+
```bash
|
|
266
|
+
python tests/compare_tls.py # standard suite -> report.md + report.json
|
|
267
|
+
python tests/compare_tls.py --suite full --plot
|
|
268
|
+
pytest tests/test_tls_compare.py # injection recovery and agreement checks
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
## Project structure
|
|
272
|
+
|
|
273
|
+
```text
|
|
274
|
+
GTLS/
|
|
275
|
+
├── src/gputls/ # Core Python + CUDA package
|
|
276
|
+
│ ├── main.py # gtls class (public API)
|
|
277
|
+
│ ├── core.py # GPU search driver and multi-GPU coordination
|
|
278
|
+
│ ├── kernels.cu # CUDA kernels compiled at runtime by CuPy
|
|
279
|
+
│ ├── grid.py # Ofir (2014) period grid and duration grid
|
|
280
|
+
│ ├── transit.py # Limb-darkened transit templates (batman)
|
|
281
|
+
│ ├── stats.py # Periodogram, SDE, and S/N calculations
|
|
282
|
+
│ ├── validate.py # Input and argument validation
|
|
283
|
+
│ └── constants.py # Default parameters and physical constants
|
|
284
|
+
├── examples/ # Kepler and TESS tutorial notebooks
|
|
285
|
+
├── tests/ # GPU test suite, TLS comparison tools, sample data
|
|
286
|
+
├── docs/images/ # Documentation figures
|
|
287
|
+
├── run_tests.sh # Local build and GPU test script
|
|
288
|
+
└── pyproject.toml
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
<details>
|
|
292
|
+
<summary><strong>Release notes (v2.2.3 – v2.2.7)</strong></summary>
|
|
293
|
+
|
|
294
|
+
- **v2.2.7**: Added TLS2-style phase coarsening (`T0_coarsen`) with local refinement and duration scouting (`scout_every`) to `fused-pl`; computes the periodogram in a single pass over the period grid; fixed duration-grid mass/radius corner pairing and empty-window baseline fallback.
|
|
295
|
+
- **v2.2.6**: Switched default backend to TLS2-style piecewise-linear scoring (`backend="fused-pl"`), with `backend="fused"` for full-template scoring and full-template final epoch fitting.
|
|
296
|
+
- **v2.2.5**: Added `screening_policy="auto"`, fused four-level screening with early block termination on large workloads, and GPU sliding-window `snrPink`; removed `snrFit` and `snrFitPink`.
|
|
297
|
+
- **v2.2.4**: Aligned final candidate epoch fitting and duration conversion with TLS 2.0.4.
|
|
298
|
+
- **v2.2.3**: Fixed out-of-transit noise-mask duration units (days instead of fractional phase) in `snr` and `snrPink`.
|
|
299
|
+
|
|
300
|
+
</details>
|
|
301
|
+
|
|
302
|
+
## Citation, acknowledgements, and license
|
|
303
|
+
|
|
304
|
+
GTLS is adapted from [TLS](https://github.com/hippke/tls) by Michael Hippke and René Heller. If you use GTLS in published work, please cite both the GTLS paper (Hu et al., submitted to *A&A*) and the original TLS paper:
|
|
305
|
+
|
|
306
|
+
- Hippke, M. & Heller, R. (2019), *Optimized transit detection algorithm to search for periodic transits of small planets*, [A&A 623, A39](https://doi.org/10.1051/0004-6361/201834672).
|
|
307
|
+
|
|
308
|
+
Both TLS and GTLS are released under the [MIT License](https://github.com/Farthing-0/GTLS/blob/main/LICENSE).
|
gputls-2.2.7/README.md
ADDED
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
# GTLS: GPU Transit Least Squares
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/gputls/)
|
|
4
|
+
[](https://github.com/Farthing-0/GTLS/blob/main/LICENSE)
|
|
5
|
+
|
|
6
|
+
**GTLS** (`gputls` on PyPI) is a CUDA-accelerated implementation of the [Transit Least Squares (TLS)](https://github.com/hippke/tls) algorithm for detecting periodic exoplanet transits in photometric light curves.
|
|
7
|
+
|
|
8
|
+
It preserves the TLS transit-shape templates and search grids while parallelising phase folding, depth estimation, and weighted residual evaluation on NVIDIA GPUs—achieving **27.9× median paired speedup** over 28-worker CPU TLS 2.0.4 (`fused-pl`) on a 1470-day *Kepler*-like light curve on an RTX 5090, while reproducing the CPU search's best period, epoch, and S/N.
|
|
9
|
+
|
|
10
|
+

|
|
11
|
+
|
|
12
|
+
## Why GTLS?
|
|
13
|
+
|
|
14
|
+
- **Familiar API**: Near drop-in replacement for `transitleastsquares` (`from gputls import gtls`), supporting default limb-darkened, grazing, and box templates.
|
|
15
|
+
- **Substantial GPU speedup**: Evaluates trial periods in batches via CuPy and custom CUDA kernels, with both TLS2 backends (`fused-pl` and `fused`).
|
|
16
|
+
- **Automatic memory management**: Adapts period batch sizes to free GPU VRAM, enabling multi-year, high-cadence searches on a single GPU.
|
|
17
|
+
- **Multi-GPU scaling**: Run on a specific card (`GPUDeviceID=0`) or split one search across multiple GPUs (`GPUDeviceIDs=[0, 1]`) with identical results.
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
### Prerequisites
|
|
22
|
+
|
|
23
|
+
- An NVIDIA GPU with CUDA support (`nvidia-smi` should list your GPU)
|
|
24
|
+
- Python ≥ 3.8
|
|
25
|
+
- [CuPy](https://cupy.dev/) matching your CUDA version
|
|
26
|
+
|
|
27
|
+
### Install with `pip`
|
|
28
|
+
|
|
29
|
+
Note that the PyPI package name is **`gputls`** (imported in Python as `gputls`).
|
|
30
|
+
|
|
31
|
+
| Environment | Install command | Notes |
|
|
32
|
+
| --- | --- | --- |
|
|
33
|
+
| **CUDA 12.x** (recommended) | `pip install "gputls[cuda12]"` | Installs `cupy-cuda12x[ctk]` with CUDA headers |
|
|
34
|
+
| **CUDA 13.x** | `pip install "gputls[cuda13]"` | Installs `cupy-cuda13x[ctk]` with CUDA headers |
|
|
35
|
+
| **CUDA 11.x** | `pip install "gputls[cuda11]"` | Requires a local [CUDA Toolkit](https://developer.nvidia.com/cuda-toolkit-archive) (`CUDA_PATH`) |
|
|
36
|
+
| **CuPy already installed** | `pip install gputls` | Uses your existing CuPy installation |
|
|
37
|
+
|
|
38
|
+
Or install from source:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
git clone https://github.com/Farthing-0/GTLS.git
|
|
42
|
+
cd GTLS
|
|
43
|
+
pip install .
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Verify your installation
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
python -c "import cupy, gputls; print('gputls:', gputls.__version__, '| GPUs:', cupy.cuda.runtime.getDeviceCount())"
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
> **Troubleshooting (`Failed to find CUDA headers`):** GTLS compiles its CUDA kernels at runtime via CuPy. If you installed CuPy manually without CUDA headers, reinstall with `pip install "cupy-cuda12x[ctk]"` (or `cupy-cuda13x[ctk]`), or point `CUDA_PATH` to your local CUDA Toolkit (e.g., `export CUDA_PATH=/usr/local/cuda-11.8`).
|
|
53
|
+
|
|
54
|
+
## Quick start
|
|
55
|
+
|
|
56
|
+
### Self-contained example
|
|
57
|
+
|
|
58
|
+
Copy and run this minimal script—no external light-curve files required:
|
|
59
|
+
|
|
60
|
+
```python
|
|
61
|
+
import numpy as np
|
|
62
|
+
from gputls import gtls
|
|
63
|
+
|
|
64
|
+
# 1. Create a 60-day synthetic light curve with a 5.0-day transit
|
|
65
|
+
rng = np.random.default_rng(42)
|
|
66
|
+
time = np.linspace(0, 60, 60 * 48) # 30-min cadence, in days
|
|
67
|
+
flux = np.ones_like(time) + rng.normal(0, 3e-4, time.size)
|
|
68
|
+
in_transit = np.abs((time - 1.2 + 2.5) % 5.0 - 2.5) < 0.06
|
|
69
|
+
flux[in_transit] -= 0.002 # 2000 ppm transit depth
|
|
70
|
+
|
|
71
|
+
# 2. Run the GPU transit search
|
|
72
|
+
model = gtls(time, flux)
|
|
73
|
+
result = model.power()
|
|
74
|
+
|
|
75
|
+
print(
|
|
76
|
+
f"Period = {result.period:.4f} d, T0 = {result.T0:.4f} d, "
|
|
77
|
+
f"Depth = {result.depth:.5f}, SDE = {result.SDE:.1f}"
|
|
78
|
+
)
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Expected output (numbers vary slightly with GPU precision):
|
|
82
|
+
|
|
83
|
+
```text
|
|
84
|
+
Period = 5.0003 d, T0 = 1.1988 d, Depth = 0.00226, SDE = 31.7
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Input data requirements
|
|
88
|
+
|
|
89
|
+
Before passing a real light curve (e.g., from *Kepler* or TESS) to `gtls(time, flux, dy=None)`:
|
|
90
|
+
|
|
91
|
+
1. **`time`** *(1D array, days)*: Time stamps must be finite and span $> 0$ days (at least 3 valid points). `NaN`/`inf` entries are filtered out automatically.
|
|
92
|
+
2. **`flux`** *(1D array, normalised)*: Flux must be positive, finite, and detrended around **`1.0`** (GTLS warns if the mean flux falls outside `0.99–1.01`). For real stellar light curves, detrend first with a filter such as [`wotan`](https://github.com/hippke/wotan).
|
|
93
|
+
3. **`dy`** *(1D array, optional)*: Per-point flux uncertainties. If omitted, GTLS assigns a uniform uncertainty equal to `np.std(flux)`.
|
|
94
|
+
|
|
95
|
+
### Migrating from CPU `TLS`
|
|
96
|
+
|
|
97
|
+
Switching from `transitleastsquares` usually requires changing only the import and constructor:
|
|
98
|
+
|
|
99
|
+
```python
|
|
100
|
+
# Before (CPU TLS)
|
|
101
|
+
# from transitleastsquares import transitleastsquares
|
|
102
|
+
# result = transitleastsquares(time, flux, dy).power()
|
|
103
|
+
|
|
104
|
+
# After (GTLS)
|
|
105
|
+
from gputls import gtls
|
|
106
|
+
result = gtls(time, flux, dy).power()
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
> **Important differences from CPU `TLS`:**
|
|
110
|
+
> - **`result.depth` convention**: GTLS reports the **fractional transit depth** (`1 - flux_in_transit`, e.g. `0.002` for a 0.2% transit), whereas upstream TLS reports the **in-transit flux level** (`1 - depth = 0.998`).
|
|
111
|
+
> - **Legacy/CPU-only arguments**: `use_threads`, `show_progress_bar`, and `verbose` are accepted in `power()` for compatibility and ignored.
|
|
112
|
+
> - **Removed/empty fields**: `snrFit` and `snrFitPink` have been removed; `possiblePeriods` and `possiblePeriodsIndices` are returned as empty lists.
|
|
113
|
+
|
|
114
|
+
## Common options and choosing a backend
|
|
115
|
+
|
|
116
|
+
`power()` accepts standard TLS keyword arguments alongside GPU controls. Most users only need the options below:
|
|
117
|
+
|
|
118
|
+
| Argument | Default | Description |
|
|
119
|
+
| --- | --- | --- |
|
|
120
|
+
| `backend` | `"fused-pl"` | Residual scoring kernel: `"fused-pl"` (piecewise-linear template approximation, TLS2 style) or `"fused"` (exact full-template scoring) |
|
|
121
|
+
| `period_min`, `period_max` | `0`, `inf` | Search bounds in days (`0` and `inf` use the automatic physical bounds) |
|
|
122
|
+
| `periods` | `[]` | Explicit array of trial periods (days); overrides the automatic grid |
|
|
123
|
+
| `n_transits_min` | `2` | Minimum number of transits required; sets the default upper period limit (`baseline / n_transits_min`) |
|
|
124
|
+
| `R_star`, `M_star` | `1.0`, `1.0` | Host star radius and mass (solar units) used to construct the frequency grid |
|
|
125
|
+
| `R_star_min`, `R_star_max` | `0.13`, `3.5` | Stellar radius bounds (solar units) for the trial duration grid |
|
|
126
|
+
| `M_star_min`, `M_star_max` | `0.1`, `1.0` | Stellar mass bounds (solar units) for the trial duration grid |
|
|
127
|
+
| `oversampling_factor` | `3` | Frequency-grid oversampling factor |
|
|
128
|
+
| `duration_grid_step` | `1.1` | Multiplicative step between adjacent trial durations |
|
|
129
|
+
| `transit_depth_min` | `1e-5` | Minimum trial transit depth to evaluate |
|
|
130
|
+
| `transit_template` | `"default"` | `"default"` (limb-darkened), `"grazing"`, or `"box"` |
|
|
131
|
+
| `GPUDeviceID` | `0` | CUDA device index for single-GPU runs |
|
|
132
|
+
| `GPUDeviceIDs` | `None` | List of CUDA device indices to split one search across multiple GPUs (e.g., `[0, 1]`); overrides `GPUDeviceID` |
|
|
133
|
+
| `fast` | `False` | If `True`, returns only `(periods, power)` and skips final epoch refinement and transit statistics |
|
|
134
|
+
|
|
135
|
+
### Which `backend` should I use?
|
|
136
|
+
|
|
137
|
+
- **`backend="fused-pl"` (default)**: Fastest for almost all standard searches—including *Kepler* long cadence, 2-minute TESS sectors, and multi-year light curves down to ~100 s cadence. Uses TLS 2.0.4's piecewise-linear template approximation, coarse initial phase scan (`T0_coarsen=3`), and duration scouting (`scout_every=4`), followed by a full-template final epoch fit.
|
|
138
|
+
- **`backend="fused"`**: Evaluates the exact sampled template without piecewise-linear approximation or duration scouting. Recommended if you want zero template approximation, or on **very densely sampled, multi-year light curves** (e.g., 25–50 s cadence over 1–4 years), where preparing cumulative sums in `fused-pl` outweighs its scoring savings.
|
|
139
|
+
|
|
140
|
+
<details>
|
|
141
|
+
<summary><strong>Advanced tuning parameters & environment variables</strong></summary>
|
|
142
|
+
|
|
143
|
+
| Argument / Env Var | Default | Description |
|
|
144
|
+
| --- | --- | --- |
|
|
145
|
+
| `T0_fit_margin` | `0.01` | Base phase step as a fraction of trial duration (`0` to `0.125`; `0` tests every folded sample). Legacy `T0_refine_margin` is deprecated |
|
|
146
|
+
| `T0_coarsen` / `TLS_T0_COARSEN` | `3` (`fused-pl`), `1` (`fused`) | Set `3` to scan every third base-grid start (when `3 * T0_fit_margin * width >= 2`) and refine locally (`±2` steps); set `1` to scan every base-grid start |
|
|
147
|
+
| `scout_every` / `TLS_SCOUT_EVERY` | `4` (`fused-pl`), `0` (`fused`) | For curves with `>= 2000` points, scans all phases at every `scout_every`-th duration (plus shortest and longest) and searches remaining durations near those peaks. Set `0` or `1` to disable |
|
|
148
|
+
| `screening_tolerances` | `None` | Strictly decreasing positive certificate tolerances for `fused` pruning. `None` uses `(0.05, 0.015, 0.005, 0.00025)`; `()` disables pruning. Affects runtime only, not the final periodogram |
|
|
149
|
+
| `screening_policy` | `"fixed"` | `"auto"` benchmarks 1–4 leading cascade levels per period band on the fly (`model.screening_diagnostics` records timing). Cannot be combined with explicit `screening_tolerances` |
|
|
150
|
+
| `bar_location` | `0` | `tqdm` progress bar vertical offset when running multiple searches concurrently |
|
|
151
|
+
| `TLS_BACKEND` | `"fused-pl"` | Default backend when `backend` is not passed to `power()` |
|
|
152
|
+
| `TLS_PL_EPS`, `TLS_PL_A2_SPREAD_MAX` | `0.02`, `0.1` | Piecewise-linear fit relative tolerance and weight-spread limit for `fused-pl` |
|
|
153
|
+
|
|
154
|
+
**Implementation notes:**
|
|
155
|
+
- **Four-level fused screening**: Curves with `>= 32,768` samples and batches with `>= 128` periods run a single fused screening cascade with early block termination; smaller workloads keep separate kernels to avoid extra register pressure.
|
|
156
|
+
- **Auto screening (`screening_policy="auto"`)**: Measures disjoint interleaved subsets per period band (factors of 32 for `< 32,768` samples, factors of 8 for larger curves) and prefers fewer levels within 5% of the fastest measurement. Calibration work contributes to the search itself and is included in total runtime.
|
|
157
|
+
- **Pink-noise S/N (`snrPink`)**: Uses GPU window standard deviations for finite `float64` inputs with `>= 4096` windows and widths `<= 1024` points, preserving NumPy summation order; other inputs use the CPU path.
|
|
158
|
+
|
|
159
|
+
</details>
|
|
160
|
+
|
|
161
|
+
## Search outputs (`gtlsResult`)
|
|
162
|
+
|
|
163
|
+
`power()` returns a `gtlsResult` object (unless `fast=True`):
|
|
164
|
+
|
|
165
|
+
| Attribute | Description |
|
|
166
|
+
| --- | --- |
|
|
167
|
+
| `period` | Best orbital period (days) |
|
|
168
|
+
| `T0` | Mid-transit epoch of the first transit (days) |
|
|
169
|
+
| `duration` | Fitted transit duration (days) |
|
|
170
|
+
| `depth` | Fractional transit depth (`1 - flux_in_transit`) |
|
|
171
|
+
| `SDE` | Peak Signal Detection Efficiency |
|
|
172
|
+
| `snr`, `snrPink` | White-noise and pink-noise (correlated) signal-to-noise ratios |
|
|
173
|
+
| `transitTimes` | Mid-transit times falling within the light curve (days) |
|
|
174
|
+
| `periods`, `power` | Trial period grid and corresponding SDE periodogram |
|
|
175
|
+
|
|
176
|
+
<details>
|
|
177
|
+
<summary><strong>Additional & legacy attributes on <code>gtlsResult</code></strong></summary>
|
|
178
|
+
|
|
179
|
+
| Attribute | Description |
|
|
180
|
+
| --- | --- |
|
|
181
|
+
| `chi2` | Minimum weighted $\chi^2$ per trial period after refinement |
|
|
182
|
+
| `raw_power`, `raw_chi2` | Unmasked SDE power and $\chi^2$ from the single period-grid scan |
|
|
183
|
+
| `rawDuration`, `rawDurations` | Best fractional duration (`duration / period`) and master fractional-duration grid |
|
|
184
|
+
| `durationPoints` | Best template width in phase-folded data points |
|
|
185
|
+
| `possiblePeriods`, `possiblePeriodsIndices` | Legacy TLS fields, returned as empty lists |
|
|
186
|
+
|
|
187
|
+
</details>
|
|
188
|
+
|
|
189
|
+
## Examples & tutorials
|
|
190
|
+
|
|
191
|
+
The [`examples/`](https://github.com/Farthing-0/GTLS/tree/main/examples) directory contains side-by-side Jupyter notebooks comparing GTLS and TLS on real space-telescope light curves:
|
|
192
|
+
|
|
193
|
+
- [`kepler_tutorial.ipynb`](https://github.com/Farthing-0/GTLS/blob/main/examples/kepler_tutorial.ipynb): Searching a *Kepler* target downloaded with `lightkurve`
|
|
194
|
+
- [`tess_tutorial.ipynb`](https://github.com/Farthing-0/GTLS/blob/main/examples/tess_tutorial.ipynb): Searching a TESS target
|
|
195
|
+
|
|
196
|
+
Notebook extras: `pip install matplotlib astropy transitleastsquares lightkurve wotan`.
|
|
197
|
+
|
|
198
|
+
## Testing & benchmarks
|
|
199
|
+
|
|
200
|
+
Install test dependencies (`pytest`, `astropy`, `lightkurve`) with:
|
|
201
|
+
|
|
202
|
+
```bash
|
|
203
|
+
pip install "gputls[test]"
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
Run the GPU test suite (end-to-end synthetic injection-recovery, `fast` mode, real *Kepler* data in [`tests/data/`](https://github.com/Farthing-0/GTLS/tree/main/tests/data), VRAM cleanup, and single- vs. multi-GPU parity):
|
|
207
|
+
|
|
208
|
+
```bash
|
|
209
|
+
./run_tests.sh # build + test on GPU 0
|
|
210
|
+
./run_tests.sh 1 # build + test on GPU 1
|
|
211
|
+
PYTHON=/path/to/python ./run_tests.sh
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
Or run `pytest tests` directly (select the GPU via `GTLS_GPU_DEVICE`).
|
|
215
|
+
|
|
216
|
+
To benchmark against CPU `TLS 1.32` and `TLS 2.0.4` (see [`tests/tls_compare/`](https://github.com/Farthing-0/GTLS/tree/main/tests/tls_compare)):
|
|
217
|
+
|
|
218
|
+
```bash
|
|
219
|
+
python tests/compare_tls.py # standard suite -> report.md + report.json
|
|
220
|
+
python tests/compare_tls.py --suite full --plot
|
|
221
|
+
pytest tests/test_tls_compare.py # injection recovery and agreement checks
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
## Project structure
|
|
225
|
+
|
|
226
|
+
```text
|
|
227
|
+
GTLS/
|
|
228
|
+
├── src/gputls/ # Core Python + CUDA package
|
|
229
|
+
│ ├── main.py # gtls class (public API)
|
|
230
|
+
│ ├── core.py # GPU search driver and multi-GPU coordination
|
|
231
|
+
│ ├── kernels.cu # CUDA kernels compiled at runtime by CuPy
|
|
232
|
+
│ ├── grid.py # Ofir (2014) period grid and duration grid
|
|
233
|
+
│ ├── transit.py # Limb-darkened transit templates (batman)
|
|
234
|
+
│ ├── stats.py # Periodogram, SDE, and S/N calculations
|
|
235
|
+
│ ├── validate.py # Input and argument validation
|
|
236
|
+
│ └── constants.py # Default parameters and physical constants
|
|
237
|
+
├── examples/ # Kepler and TESS tutorial notebooks
|
|
238
|
+
├── tests/ # GPU test suite, TLS comparison tools, sample data
|
|
239
|
+
├── docs/images/ # Documentation figures
|
|
240
|
+
├── run_tests.sh # Local build and GPU test script
|
|
241
|
+
└── pyproject.toml
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
<details>
|
|
245
|
+
<summary><strong>Release notes (v2.2.3 – v2.2.7)</strong></summary>
|
|
246
|
+
|
|
247
|
+
- **v2.2.7**: Added TLS2-style phase coarsening (`T0_coarsen`) with local refinement and duration scouting (`scout_every`) to `fused-pl`; computes the periodogram in a single pass over the period grid; fixed duration-grid mass/radius corner pairing and empty-window baseline fallback.
|
|
248
|
+
- **v2.2.6**: Switched default backend to TLS2-style piecewise-linear scoring (`backend="fused-pl"`), with `backend="fused"` for full-template scoring and full-template final epoch fitting.
|
|
249
|
+
- **v2.2.5**: Added `screening_policy="auto"`, fused four-level screening with early block termination on large workloads, and GPU sliding-window `snrPink`; removed `snrFit` and `snrFitPink`.
|
|
250
|
+
- **v2.2.4**: Aligned final candidate epoch fitting and duration conversion with TLS 2.0.4.
|
|
251
|
+
- **v2.2.3**: Fixed out-of-transit noise-mask duration units (days instead of fractional phase) in `snr` and `snrPink`.
|
|
252
|
+
|
|
253
|
+
</details>
|
|
254
|
+
|
|
255
|
+
## Citation, acknowledgements, and license
|
|
256
|
+
|
|
257
|
+
GTLS is adapted from [TLS](https://github.com/hippke/tls) by Michael Hippke and René Heller. If you use GTLS in published work, please cite both the GTLS paper (Hu et al., submitted to *A&A*) and the original TLS paper:
|
|
258
|
+
|
|
259
|
+
- Hippke, M. & Heller, R. (2019), *Optimized transit detection algorithm to search for periodic transits of small planets*, [A&A 623, A39](https://doi.org/10.1051/0004-6361/201834672).
|
|
260
|
+
|
|
261
|
+
Both TLS and GTLS are released under the [MIT License](https://github.com/Farthing-0/GTLS/blob/main/LICENSE).
|
|
@@ -88,15 +88,8 @@ SDE_MEDIAN_KERNEL_SIZE = 30
|
|
|
88
88
|
|
|
89
89
|
# Step between trial transit start points in the coarse period search, as a fraction
|
|
90
90
|
# of the transit duration (clipped to [0, 0.125]); 0 tests every cadence (slowest).
|
|
91
|
-
# Both search stages default to a 1% duration step.
|
|
92
91
|
T0_FIT_MARGIN = 0.01
|
|
93
92
|
|
|
94
|
-
# Step between trial transit start points when the best candidate periods are re-searched,
|
|
95
|
-
# as a fraction of the transit duration (clipped to [0, 0.125]); 0 tests every cadence.
|
|
96
|
-
# 0.01 equals the T0 resolution of TLS. The final fit of the best period always tests
|
|
97
|
-
# every cadence.
|
|
98
|
-
T0_REFINE_MARGIN = 0.01
|
|
99
|
-
|
|
100
93
|
# Some cases yield empty period grids. Example: R_star=5, M_star=1
|
|
101
94
|
# Then: Warn and return the default grid
|
|
102
95
|
MINIMUM_PERIOD_GRID_SIZE = 100
|
|
@@ -107,6 +100,7 @@ BAR_LOCATION = 0
|
|
|
107
100
|
# Warn the user if unknown **kwargs are given as parameters.
|
|
108
101
|
# "use_threads", "show_progress_bar" and "verbose" are accepted for TLS compatibility but ignored.
|
|
109
102
|
VALID_PARAMETERS = [
|
|
103
|
+
"backend",
|
|
110
104
|
"R_star",
|
|
111
105
|
"R_star_min",
|
|
112
106
|
"R_star_max",
|
|
@@ -133,7 +127,11 @@ VALID_PARAMETERS = [
|
|
|
133
127
|
"transit_depth_min",
|
|
134
128
|
"oversampling_factor",
|
|
135
129
|
"T0_fit_margin",
|
|
130
|
+
"T0_coarsen",
|
|
131
|
+
"scout_every",
|
|
136
132
|
"T0_refine_margin",
|
|
133
|
+
"screening_tolerances",
|
|
134
|
+
"screening_policy",
|
|
137
135
|
"use_threads",
|
|
138
136
|
"show_progress_bar",
|
|
139
137
|
"transit_template",
|