Bayesian parallax-to-distance pipeline for stellar catalogues
Project description
plx2dist
Bayesian parallax-to-distance pipeline for stellar catalogues.
Trigonometric parallax is an unbiased distance estimator only at high S/N. At
moderate or low S/N — or for the many Gaia stars with negative parallaxes —
naive inversion (d = 1/ϖ) fails badly. plx2dist solves this by computing
the full posterior p(r | ϖ, σ) on an adaptive grid, combining a Gaussian
parallax likelihood with a physically motivated distance prior (EDSD or
uniform volume density). It was developed for CNS6 (The Sixth Catalogue of Nearby Stars) but is general-purpose for any Gaia-era parallax catalogue.
Installation
pip install plx2dist # core
pip install plx2dist[progress] # + tqdm progress bar
Quick start (Python API)
import pandas as pd
from plx2dist import derive_distances
df = pd.read_csv("my_catalogue.csv") # must contain 'parallax', 'parallax_error'
if __name__ == "__main__":
result_df = derive_distances(df, plx_col="parallax", err_col="parallax_error", n_jobs=4)
Quick start (command line)
plx2dist --input catalogue.vot \
--output-prefix results \
--priors edsd \
--n-jobs 8
Output columns
For each prior (e.g. edsd), the following columns are added:
| Column | Description |
|---|---|
distance_edsd_mode |
Posterior mode (pc) |
distance_edsd_q05 |
5th percentile (pc) |
distance_edsd_q16 |
16th percentile — lower 1σ bound (pc) |
distance_edsd_q50 |
Median distance (pc) — recommended point estimate |
distance_edsd_q84 |
84th percentile — upper 1σ bound (pc) |
distance_edsd_q95 |
95th percentile (pc) |
distance_edsd_err_lo |
q50 − q16 (pc) |
distance_edsd_err_hi |
q84 − q50 (pc) |
distance_edsd_p_within_25pc |
P(r < 25 pc | ϖ, σ) — membership probability; threshold can be specified by user |
distance_edsd_r_grid_min_used |
Diagnostic: refined grid lower bound (pc) |
distance_edsd_r_grid_max_used |
Diagnostic: refined grid upper bound (pc) |
distance_edsd_prior_L_pc |
EDSD scale length used (pc) |
Use q50 as the point estimate and err_lo/err_hi as the asymmetric uncertainty.
mode tends to be slightly closer to the likelihood peak; prefer q50 for catalogue work.
Method
The pipeline uses a two-stage adaptive log-r grid:
- A broad safety pass locates posterior support, with automatic boundary expansion for low-S/N stars.
- A refined pass concentrates grid points around the posterior mass for accurate quantile estimation.
No MCMC. Fully deterministic and parallelised via Python multiprocessing.
Priors
| Name | Formula | Default L |
|---|---|---|
edsd |
p(r) ∝ r² exp(−r/L) | 250 pc (tuned for CNS6 volume) |
volume |
p(r) ∝ r² (uniform space density, truncated) | — |
For the solar neighbourhood (e.g., ≲ 25 pc) the EDSD prior with L = 250 pc is recommended.
Reference
If you use plx2dist, please cite:
- Golovin et al. (in prep.) — CNS6 catalogue and distance methodology
BibTeX for CNS6:
@article{Golovin2026,
author = {Golovin, A. et al.},
title = {{The Sixth Catalogue of Nearby Stars (CNS6)}},
journal = {A\&A},
year = {2026},
volume = {NNN},
pages = {ANN},
doi = {TBD}
}
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 plx2dist-0.1.0.tar.gz.
File metadata
- Download URL: plx2dist-0.1.0.tar.gz
- Upload date:
- Size: 19.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ea76edd09e52bc0c0f78ee3e8784eb47a085b51371c5e598528e989847ccf4f1
|
|
| MD5 |
b1130f518967d10520034044f6fc3f91
|
|
| BLAKE2b-256 |
7b1cb4e7afac0acdbaa65bce1d516b4778de25237fa68daf929d578197e87029
|
File details
Details for the file plx2dist-0.1.0-py3-none-any.whl.
File metadata
- Download URL: plx2dist-0.1.0-py3-none-any.whl
- Upload date:
- Size: 13.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5fc7240dc661c1d6e7fd64ed8280151da71151c4ab06012999c2a0ae1948db98
|
|
| MD5 |
1047900b87c2cb3aaebbe61d138397ab
|
|
| BLAKE2b-256 |
bb7bf44f51a7fe28a9be579c44cddae5d07b1481be56b49da607bd35e9b0fcff
|