Homeworlder
- 1 Devlogs
- 1 Total hours
Python script that fetches data about exoplanets and calculates their habitability score relative to Earth's properties
Python script that fetches data about exoplanets and calculates their habitability score relative to Earth's properties
Devlog 1 : Building Homeworlder - An Exoplanet Habitability Analyzer
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)
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.
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.