AkashSetu — TESS Exoplanet Detection Studio (Streamlit)

A Streamlit front-end for the Exo-Planet-AkashSetu v4 pipeline (Bharatiya Antariksh Hackathon 2026, Challenge 7): AI-enabled detection of exoplanets from noisy TESS light curves, using a Box-Least-Squares transit search feeding a calibrated XGBoost + Random-Forest ensemble, plus an LLM (via Groq) that explains and discusses each result with you.

What's included

exoplanet_app/
├── app.py                # Streamlit UI
├── pipeline.py           # Ported signal-processing / feature-extraction / scoring logic
├── llm.py                # Groq (OpenAI-compatible) reasoning + Q&A helper
├── model/
│   ├── tess_exoplanet_model_v4.joblib   # Pretrained ensemble (60 features)
│   └── labels_reference.csv             # Reference TIC labels from the original dataset
├── requirements.txt
└── README.md

The model was trained in the original notebook on ~2,000 labeled TESS light curves. This app reuses that trained model directly — it does not retrain anything, it only runs inference (feature extraction → impute → predict → classify) on light curves you provide.

1. Install

cd exoplanet_app
python3 -m venv venv
source venv/bin/activate        # Windows: venv\Scripts\activate
pip install -r requirements.txt

Note on scikit-learn version: the model was pickled with scikit-learn 1.6.1. requirements.txt pins that exact version so the saved IterativeImputer/RandomForestClassifier/IsotonicRegression objects unpickle correctly. If you see AttributeError on load, double check pip show scikit-learn reports 1.6.1.

2. Run

streamlit run app.py

This opens the app at http://localhost:8501.

3. Using the app

Step 1 — Choose a data source (sidebar)

  • Upload FITS/CSV light curve — upload a real TESS light curve file.
    • FITS: standard SPOC 2-minute-cadence light curve files (tess*_lc.fits), auto-detects TIME/BTJD and PDCSAP_FLUX/SAP_FLUX columns, and filters bad-quality cadences.
    • CSV/TSV: any table with a recognizable time column (time, btjd, bjd, ...) and flux column (pdcsap_flux, sap_flux, flux, ...).
    • You can download real TESS light curves for free from MAST or via lightkurve (lk.search_lightcurve("TIC <id>", mission="TESS").download()).
  • Use bundled example candidates — browse the reference label table that shipped with the original dataset (TIC IDs + known disposition). No raw FITS files are bundled (they're large), so this tab is for reference only — pair it with an upload of the corresponding file.
  • Generate synthetic demo curve — instantly generates either a transit-like or non-planet (EB/quiet/spotted-star) synthetic light curve so you can see the whole pipeline run without needing real data.

Step 2 — Read the result

Once a light curve is loaded, the app automatically:

  1. Detrends the light curve (adaptive Savitzky-Golay).
  2. Runs a Box-Least-Squares (BLS) periodogram search for periodic dips.
  3. Extracts 60 features (BLS parameters, shape/statistics of the flux, secondary-eclipse depth, odd/even transit-depth ratio, V-shape metric, etc.).
  4. Feeds those features through the pretrained calibrated ensemble to get an exoplanet score (0–1).
  5. Classifies the signal as Transit, EclipsingBinary, Blend, or Other using depth/shape-aware rules on top of the score.
  6. Estimates transit parameters (period, epoch, duration, depth) via BLS + trapezoid-model refinement.
  7. Computes a composite confidence level (Low/Moderate/High) from the score and the BLS/phase-folded signal-to-noise ratio.

Visualizations (all interactive, Plotly):

  • Detrended light curve with predicted transit windows shaded.
  • Phase-folded light curve at the BLS period.
  • BLS periodogram (power vs. period).
  • Score gauge against the model's decision threshold.
  • SNR-vs-score scatter (where this target sits relative to the threshold).
  • Global feature-importance bar chart for the underlying XGBoost model.

You can download the full numeric result as JSON.

Step 3 — Ask the AI about the result

Enter your Groq API key in the sidebar (a default key is pre-filled — swap in your own for production use). Click "Explain this result" for a plain-English write-up of what the model decided and why, then use the chat box underneath to ask follow-up questions, e.g.:

  • "Why wasn't this classified as an eclipsing binary?"
  • "What would make this a higher-confidence detection?"
  • "What is the odd/even depth ratio telling us here?"

The LLM is instructed to reason strictly from the numeric result already computed by the pipeline (score, BLS power/SNR, depth, shape metrics) — it does not re-analyze the raw light curve itself, just interprets the pipeline's own output.

Configuring the Groq API key permanently

Instead of pasting the key into the sidebar each time, you can:

  • Set an environment variable and read it in app.py (os.environ.get("GROQ_API_KEY")), or
  • Create .streamlit/secrets.toml: toml GROQ_API_KEY = "gsk_..." and change the sidebar default to st.secrets.get("GROQ_API_KEY", "").

Troubleshooting

  • AttributeError when loading the model — mismatched scikit-learn version. Reinstall with pip install "scikit-learn==1.6.1".
  • "Couldn't find recognizable time/flux columns" — rename your columns to one of the recognized synonyms listed above, or check that the file isn't corrupted.
  • Groq request fails / 401 — check the API key in the sidebar; make sure there's no extra whitespace.
  • Fewer than 50 points error — BLS and detrending need a reasonably long, densely-sampled light curve; very short snippets will be rejected.

Built With

Share this project:

Updates