Devlog 1 : Building Homeworlder - An Exoplanet Habitability Analyzer
Summary: Built a Python tool that pulls live astronomical data from NASA’s API to calculate if a distant exoplanet could host Earth-based life.
The Idea:
Write a fun little script to practice Python and SQL that applies to my huge nerd hobby of studying exoplanets. I wanted to put something together that handled some calculations based on user input and database querying.
Homeworlder compares any discovered exoplanet in NASA’s Exoplanet Archive against Earth’s baseline attributes to generate an approximate habitability score. Please note that this is a project just for fun, it doesn’t hold much scientific ground as of now. (Just seeing how similar planets are)
How It Works & Architecture
analyzer.py (The Engine & Math):
Connects to the NASA Exoplanet Archive TAP API using ADQL queries (pscomppars table) and fetches key metrics like planetary radius, mass, equilibrium temperature, solar flux/insolation, density, and orbital period. Compares the target exoplanet against a hardcoded EARTH_DATA baseline. Runs a weighted scoring algorithm that penalizes deviations from Earth’s environmental norms.
main.py (The Interface):
Handles user interaction, inputs, and error handling for missing planets. Formats raw NASA numbers cleanly with rounding logic for readability.
Challenges & Solutions
- Handling Missing NASA Data
The Problem: Not every exoplanet has every data point filled out in NASA’s database. Trying to run math on None values (e.g., None / 255.0) crashed the script instantly with TypeError exceptions.
The Fix: Added explicit checks (if val is not None:) to ensure missing data points gracefully deduct a flat penalty rather than crashing the program.
Next Up
- Revise calculations and weights for habitaility/similarity to Earth.
- Build a desktop UI using CustomTkinter
- Package it into a standalone executable using PyInstaller.
- Perhaps add visuals comparing exoplanet radii side-by-side with Earth