COSMIC-HUNTER is an end-to-end machine learning and astronomical data processing pipeline for automated exoplanet candidate discovery and classification using photometric light curves from NASA's Transiting Exoplanet Survey Satellite (TESS).
- Executive Summary
- Pipeline Architecture
- Pipeline Stages
- Neural Network Architecture
- Model Performance & Benchmark
- Repository Structure
- Installation
- Usage
- Dependencies
- References
- License
The detection of exoplanets via the transit method requires the identification of periodic, shallow flux decrements (typically < 1%) within time-series photometry that is dominated by stellar variability, instrumental systematics, and stochastic noise. Traditional approaches relying solely on periodogram-based searches produce a high rate of false positives due to astrophysical mimics such as eclipsing binaries (EBs), background blends, and residual systematic artefacts.
This repository presents a multi-stage hybrid pipeline that combines classical signal processing techniques with deep learning to automate the full workflow from raw TESS light curve ingestion through to astrophysical classification. The system chains four sequential analysis phases:
- Data Ingestion and Detrending -- systematic noise removal and flux normalisation
- Box Least Squares (BLS) Periodogram Search -- periodic transit signal detection
- Physical Transit Shape Fitting -- morphological validation of candidate signals
- Dual-Branch Convolutional Neural Network Classification -- three-class astrophysical categorisation
The CNN classifier, inspired by the AstroNet architecture (Shallue & Vanderburg, 2018), ingests both local (transit-centred) and global (full-orbit) views of the phase-folded light curve to distinguish genuine planetary transits from eclipsing binaries and instrumental false positives.
The pipeline processes TESS photometry through four sequential stages. Each stage refines the candidate list and extracts progressively higher-level astrophysical features:
TESS Raw Light Curve
|
v
[Phase 1] Data Ingestion & Detrending
| - Quality flag filtering
| - Outlier rejection (sigma-clipping)
| - CBV / SFF systematic detrending
| - Flux normalisation and flattening
v
[Phase 2] Box Least Squares (BLS) Periodogram Search
| - High-resolution period grid search
| - Peak power extraction
| - Orbital period (P), duration (T_dur), epoch (t0)
| - Signal-to-noise ratio (SNR) computation
v
[Phase 3] Physical Transit Shape Fitting
| - Limb-darkened trapezoidal model fitting
| - U-shaped (planet) vs. V-shaped (EB) morphology test
| - Ingress / egress duration extraction
v
[Phase 4] Dual-Branch 1D TransitCNN Classification
- Local branch: 200-point transit-centred view
- Global branch: 2000-point full-orbit view
- Three-class output:
Class 0: Exoplanet Transit
Class 1: Eclipsing Binary (EB)
Class 2: False Positive / Noise
Module: src/tess_pipeline.py
Handles automated data acquisition and preprocessing of TESS photometric observations:
- Fetches Target Pixel Files (TPF) and Pre-search Data Conditioning Simple Aperture Photometry (PDCSAP) light curves from the Mikulski Archive for Space Telescopes (MAST) via the Lightkurve API.
- Applies TESS data quality flag filtering to remove cadences affected by spacecraft anomalies (momentum dumps, scattered light, cosmic ray events).
- Performs iterative sigma-clipping outlier rejection to remove residual flux excursions.
- Applies Cotrending Basis Vector (CBV) correction or Self-Flat-Fielding (SFF) detrending to remove low-frequency instrumental systematics.
- Produces normalised, flattened flux time series suitable for downstream periodogram analysis.
Module: src/bls_search.py
Implements a high-resolution BLS periodogram search (Kovacs, Zucker & Mazeh, 2002) to detect periodic box-shaped transit signals:
- Constructs a dense frequency grid spanning the physically meaningful period range for TESS single-sector observations.
- Evaluates the BLS statistic across all trial periods, durations, and reference epochs.
- Extracts the best-fit orbital period (
$P$ ), transit duration ($T_{\text{dur}}$ ), mid-transit epoch ($t_0$ ), transit depth, and depth signal-to-noise ratio ($\text{SNR}_{\text{depth}}$ ). - Generates diagnostic phase-folded light curve plots at the detected period for visual inspection.
Module: src/shape_fitting.py
Performs parametric transit model fitting to evaluate the physical plausibility of detected signals:
- Fits limb-darkened trapezoidal transit profiles to the phase-folded light curve.
- Quantitatively distinguishes between U-shaped planetary occultation profiles and V-shaped grazing eclipsing binary profiles based on ingress-to-total duration ratio.
- Extracts physical transit parameters including ingress/egress duration, impact parameter proxy, and depth consistency metrics.
- Produces diagnostic shape comparison plots overlaying fitted models on observed data.
Module: src/cnn_classifier.py
Implements a dual-branch one-dimensional convolutional neural network for three-class astrophysical classification:
| Branch | Input | Grid Size | Purpose |
|---|---|---|---|
| Local | Phase interval [-0.1, +0.1] | 200 points | Resolves fine transit morphology: flat-bottomed planetary dips vs. V-shaped EB profiles; limb-darkening ingress/egress ramps |
| Global | Phase interval [-0.5, +0.5] | 2000 points | Captures orbit-wide context: secondary eclipses at phase ~0.5 (EB indicator), ellipsoidal/reflection modulations, baseline offsets from blends |
Classification Head:
The flattened feature vectors from both branches are concatenated and passed through two fully-connected layers with Dropout regularisation, producing calibrated three-class probabilities via Softmax:
| Class | Label | Description |
|---|---|---|
| 0 | Exoplanet Transit | U-shaped dip, no secondary eclipse, consistent depth |
| 1 | Eclipsing Binary | V-shaped dip, secondary eclipse present, large depth |
| 2 | False Positive / Noise | Background blend, stellar variability, instrumental artefact |
Tensor Dimensions (batch size B):
local_view : (B, 1, 200) -- single-channel 1D signal
global_view : (B, 1, 2000) -- single-channel 1D signal
output : (B, 3) -- [P(planet), P(EB), P(FP)]
graph TD
A["Scattered Phase-Folded Light Curve"] --> B["Linear Interpolation onto Fixed Grids"]
B --> C["Local View: 200 points"]
B --> D["Global View: 2000 points"]
subgraph Local Branch
C --> L1["Conv1D + BatchNorm + ReLU + MaxPool"]
L1 --> L2["Conv1D + BatchNorm + ReLU + MaxPool"]
L2 --> L3["Conv1D + BatchNorm + ReLU + MaxPool"]
L3 --> LFLAT["Flatten"]
end
subgraph Global Branch
D --> G1["Conv1D + BatchNorm + ReLU + MaxPool"]
G1 --> G2["Conv1D + BatchNorm + ReLU + MaxPool"]
G2 --> G3["Conv1D + BatchNorm + ReLU + MaxPool"]
G3 --> G4["Conv1D + BatchNorm + ReLU + MaxPool"]
G4 --> GFLAT["Flatten"]
end
LFLAT --> FUSE["Concatenate Feature Vectors"]
GFLAT --> FUSE
FUSE --> FC1["Fully Connected + Dropout + ReLU"]
FC1 --> FC2["Fully Connected Head"]
FC2 --> OUT["Softmax: Planet / EB / FP"]
Evaluation results of the pre-trained TransitCNN model on the held-out test dataset (160 multi-modal astronomical light curves):
- Overall Test Accuracy:
91.25%(0.9125) - Macro Average F1-Score:
91.35%
| Class Category | Precision | Recall | F1-Score | Sample Count |
|---|---|---|---|---|
| Planet Candidate (PC) | 0.9200 | 0.8519 | 0.8846 | 54 |
| Confirmed/Known Planet (CP+KP) | 0.8305 | 0.9245 | 0.8750 | 53 |
| Eclipsing Binary (EB) | 1.0000 | 0.9623 | 0.9808 | 53 |
| Overall / Weighted Average | 0.9169 | 0.9125 | 0.9133 | 160 |
| True Class \ Predicted Class | Planet Candidate (PC) | Confirmed Planet (CP+KP) | Eclipsing Binary (EB) |
|---|---|---|---|
| Planet Candidate (PC) | 46 | 8 | 0 |
| Confirmed Planet (CP+KP) | 4 | 49 | 0 |
| Eclipsing Binary (EB) | 0 | 2 | 51 |
.
├── data/ # Catalogues and preprocessed datasets
│ ├── curated_dataset_checkpoint.npz # Preprocessed multi-class training dataset
│ ├── test_dataset.npz # Held-out evaluation dataset
│ ├── tess_eb_catalog.csv # TESS Eclipsing Binary catalogue reference
│ └── toi_catalog.csv # TESS Objects of Interest catalogue reference
│
├── models/ # Serialised model weights
│ └── transit_cnn_init.pth # Trained Dual-Branch TransitCNN state dict
│
├── plots/ # Generated diagnostic plots
│ ├── bls_phase2_*.png # Phase 2 BLS periodogram outputs
│ └── phase3_shape_fit_*.png # Phase 3 transit shape fit overlays
│
├── src/ # Source code
│ ├── tess_pipeline.py # Phase 1: Data ingestion and detrending
│ ├── bls_search.py # Phase 2: BLS periodogram search
│ ├── shape_fitting.py # Phase 3: Transit shape fitting
│ ├── cnn_classifier.py # Phase 4: Dual-Branch CNN architecture
│ ├── build_dataset.py # Dataset construction and preprocessing
│ ├── train_classifier.py # Model training loop (Adam, CrossEntropy, LR scheduler)
│ ├── evaluate.py # Evaluation metrics (accuracy, confusion matrix, ROC)
│ ├── predict.py # Single-target end-to-end inference
│ ├── run_kelt3.py # Pipeline validation on KELT-3 b (TIC 28159019)
│ └── test_phase1.py # Phase 1 unit and integration tests
│
├── .gitignore
├── requirements.txt
├── LICENSE
└── README.md
- Python 3.9 or higher
- pip package manager
- (Recommended) A CUDA-capable GPU for model training; CPU inference is fully supported
- Clone the repository:
git clone https://github.com/Adityat07-create/COSMIC-HUNTER.git
cd COSMIC-HUNTER- Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate # macOS / Linux
# venv\Scripts\activate # Windows- Install dependencies:
pip install -r requirements.txtRuns the full Phase 1 + Phase 2 pipeline on KELT-3 b (TIC 28159019), a known hot Jupiter with a ~2.703 day period and ~0.8--1.1% transit depth. This validates that the pipeline correctly recovers the orbital period and achieves a statistically significant detection SNR on a challenging target.
python src/run_kelt3.pyPerforms end-to-end period search, phase folding, and CNN classification for a specified TESS Input Catalogue (TIC) identifier:
python src/predict.py --tic 100100827Trains the Dual-Branch TransitCNN on the curated labelled dataset using the Adam optimiser with cross-entropy loss and a learning rate scheduler:
python src/train_classifier.pyComputes classification accuracy, per-class precision/recall/F1 scores, and a confusion matrix on the held-out test dataset:
python src/evaluate.py| Package | Version | Purpose |
|---|---|---|
| NumPy | >= 1.22.0 | Array operations and numerical computation |
| SciPy | >= 1.8.0 | Interpolation and signal processing utilities |
| Pandas | >= 1.4.0 | Catalogue I/O and tabular data handling |
| Matplotlib | >= 3.5.0 | Diagnostic plotting and visualisation |
| AstroPy | >= 5.0 | Astronomical coordinate and time handling |
| Lightkurve | >= 2.4.0 | TESS/Kepler light curve access and manipulation |
| PyTorch | >= 2.0.0 | Neural network architecture and training |
| scikit-learn | >= 1.0.0 | Classification metrics and evaluation utilities |
All dependencies are specified in requirements.txt.
-
Shallue, C. J. & Vanderburg, A. (2018). Identifying Exoplanets with Deep Learning: A Five Planet Resonant Chain around Kepler-80 and an Eighth Planet around Kepler-90. The Astronomical Journal, 155(2), 94. arXiv:1712.05044
-
Ansdell, M. et al. (2018). Scientific Domain Knowledge Improves Exoplanet Transit Classification with Deep Learning. The Astrophysical Journal Letters, 869(1), L7.
-
Kovacs, G., Zucker, S. & Mazeh, T. (2002). A box-fitting algorithm in the search for periodic transits. Astronomy & Astrophysics, 391(1), 369--377.
-
Ricker, G. R. et al. (2015). Transiting Exoplanet Survey Satellite (TESS). Journal of Astronomical Telescopes, Instruments, and Systems, 1(1), 014003.
-
Lightkurve Collaboration (2018). Lightkurve: Kepler and TESS time series analysis in Python. Astrophysics Source Code Library. ascl:1812.013
This project is released under the MIT License. See the LICENSE file for the full text.