Lightweight Python wrapper around the NASA Exoplanet Archive.
Project description
oplanet
Lightweight Python wrapper around the NASA Exoplanet Archive with practical helpers for stellar aliases, photometry, and system/planet properties.
This package is built to make exoplanet metadata easier to use in notebooks and scripts by exposing a simple object API and automatically selecting the most reliable published values.
NSystem is exported at package level, so you can import it directly with from oplanet import NSystem.
What it is
oplanet wraps data from:
- NASA Exoplanet Archive
- Simbad / Vizier utilities for star aliases, coordinates, and photometry
For parameters with multiple entries in the archive, it chooses the best measurement by preferring rows with the smallest uncertainty bars (when available), with fallback to limits when no direct value exists.
Measurement-return convention used by NSystem/NStar/NPlanet properties:
- Standard measurement:
[value, err_pos, err_neg] - No direct measurement but limits exist:
[nan, limit_upper, limit_lower]
Installation
From pip (recommended)
pip install oplanet
From GitHub
pip install "git+https://github.com/ProfesseurShadoko/oplanet.git"
From source
git clone https://github.com/ProfesseurShadoko/oplanet.git
cd oplanet
python -m venv .venv
source .venv/bin/activate
pip install .
Requirements
Dependencies are listed in requirements.txt:
oakleynumpypandasastroqueryastropyscipymatplotlib
Quick examples
For a guided walkthrough with explanations and runnable cells, see examples.ipynb.
1. Resolve star names and aliases
from oplanet import parse_star_name, get_star_aliases
print(parse_star_name("TOI 1478"))
print(get_star_aliases("TOI 1478"))
2. Explore a system, its star, and its planets
from oplanet import NSystem
system = NSystem("LHS 1140")
print(system.star_name)
print(system.n_planets)
# Returns [value, err1, err2] when available,
# or [nan, upper_limit, lower_limit] when only limits exist
print(system.distance_pc)
print(system.star.age_myr)
print(system.b.mass_mjup)
print(system.b.orbital_period_yrs)
3. One-line import for common API
from oplanet import NSystem, parse_star_name, get_star_aliases, get_photometry_jy
4. Get stellar photometry at a wavelength
from oplanet import get_photometry_jy
flux_jy = get_photometry_jy("LHS 1140", 11.56)
print(flux_jy)
5. Pretty-print helpers (display and print_column)
from oplanet import NSystem
system = NSystem("LHS 1140")
# Human-readable summary of system properties
system.display()
# Human-readable summary for star and a planet
system.star.display()
system.b.display()
# Print raw dataframe values for a specific archive column
system.print_column("st_age")
Returned values
Most numeric property getters in the object API return a NumPy array with 3 entries:
value: best selected valueerr_pos: positive uncertaintyerr_neg: negative uncertainty
When no direct value is available and only limits are present, the returned array is:
nan, limit_upper, limit_lower
Examples:
system = NSystem("LHS 1140")
age = system.star.age_myr
distance = system.distance_pc
print(age) # e.g. [value, err_pos, err_neg] or [nan, upper, lower]
print(distance) # same convention
Data behavior
On import, the loader keeps a local CSV cache in oplanet/data, removes older archive snapshots, and refreshes stale files automatically.
Notes
- Internet access is needed for Simbad/Vizier queries and first-time archive download.
- This repository is currently source-first (requirements-driven), not a published PyPI package.
- The support for exoplanet.eu will be added once the database becomes more reliable and code friendly.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file oplanet-1.3.0.tar.gz.
File metadata
- Download URL: oplanet-1.3.0.tar.gz
- Upload date:
- Size: 27.9 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5a0e67f758ebc2d0c15620445be306cc1808cbbae8308608b392aee0680c3ef9
|
|
| MD5 |
18841b61a3b5e991e23d3df7e3482906
|
|
| BLAKE2b-256 |
c8d047ca42d0e5ad14d18e07561d364b6fed7f73a2ee90c1073b88776c39065e
|
File details
Details for the file oplanet-1.3.0-py3-none-any.whl.
File metadata
- Download URL: oplanet-1.3.0-py3-none-any.whl
- Upload date:
- Size: 28.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
148a77c442d2edc1f66f21ed0fad3c6cb1861c0a72fb50bb771325a8479aadd8
|
|
| MD5 |
73d3d0beddd0ba6fa0db204e59ff01ba
|
|
| BLAKE2b-256 |
75f23cc631e1348e03b7627b969427956655d172dd6fa2b4e72f9afcf5867d20
|