Skip to main content
Sandbox Physics
Measuring the depth of the sky

L3 · Stellar astrometry

Compare two distance estimates for twenty-four Gaia stars

Open the Gaia DR3 sample and Python script supplied with this page. You will turn twenty-four real catalogue parallaxes into distance distributions, retain three negative measurements, and see how a prior affects weak data.

Freeze the input before doing the calculation

The input is gaia-dr3-sample.csv, retrieved on 28 October 2026 through ARI’s Gaia TAP service and cross-checked against the same query at ESA. The saved query.adql selects the first twenty-four source identifiers in a fixed interval with five-parameter solutions. It makes no parallax-sign or RUWE quality cut.

This deterministic selection creates a small exercise, not a sample for estimating the Galactic distance distribution, star counts or the population frequency of negative parallaxes. All three negative-parallax rows remain in both input and output.

The provenance file and result retain the input SHA-256 checksum. The script checks the row count, negative-parallax count and positive definiteness of every reconstructed five-parameter covariance. Use the repository checkout for the exact folder layout shown below.

                    python3 scripts/astronomy/ac01/reproduce-gaia-distances.py
python3 scripts/astronomy/ac01/reproduce-gaia-distances.py --check
                  

Reading: ARI Gaia Services — TAP documentation · Lindegren et al.

Read the units and reconstruct the correlations

Treat source_id as a string. Its many digits can exceed the exact-integer range of floating-point storage. The ra and dec columns give ICRS directions in degrees at J2016.0. Parallax and its error use milliarcseconds. The pmra and pmdec columns use milliarcseconds per year.

The pmra value already includes the cosine of declination. The ra_error column describes the tangent quantity α∗\alpha_* in milliarcseconds; it cannot simply be added to an RA value in degrees. Five standard errors and ten correlations reconstruct the full astrometric covariance.

As one application, propagate the eastward tangent-position uncertainty twenty years. Include the initial position variance, proper-motion variance and their cross term. The output also gives the result after omitting the cross term, so you can compare the consequence. This is linear tangent propagation without radial acceleration.

Kij=ρijσiσj,Var⁡(x2036)=K00+40K03+400K33K_{ij}=\rho_{ij}\sigma_i\sigma_j,\qquad\operatorname{Var}(x_{2036})=K_{00}+40K_{03}+400K_{33}
The position–motion covariance can increase or decrease propagated uncertainty. Twenty years means J2016.0 to J2036.0.

Reading: Lindegren et al.

Start with a precise positive parallax

Source 3200000263315829632 has measured parallax about 5.56170±0.04595 mas5.56170\pm0.04595\,\mathrm{mas}. Its inverse gives about 179.8 parsecs. Since the error is small compared with the measured parallax, changing the prior has little effect on this star’s inferred distance.

Source 3200000224659857664 instead has 0.04374±0.12633 mas0.04374\pm0.12633\,\mathrm{mas}. Direct inversion gives about 22,860 parsecs. That apparently precise number is extremely sensitive to a small measurement change. Move the parallax towards zero and the inverse diverges; move it through zero and the inverse becomes negative.

For this weak measurement, describe noise in parallax space. At each proposed positive distance, predict a parallax and calculate how likely the observed value would be. This probability density for the data conditional on the parameter is the likelihood.

Reading: Bailer-Jones

Weight positive distances and vary the prior

The script uses an easily tested teaching prior with density proportional to r2e−r/Lr^2e^{-r/L}. The squared-distance term reflects spherical-shell volume; the exponential gradually suppresses very large distances. This is not the direction-dependent Galactic prior used for the Bailer-Jones EDR3 distance catalogue.

Multiply the prior by the Gaussian parallax likelihood and normalize to obtain a posterior distribution. The script uses L=500,1350,3000 pcL=500,1350,3000\,\mathrm{pc} and saves the sixteenth, fiftieth and eighty-fourth percentiles for each. Quantiles retain the asymmetry that a single symmetric error bar would hide.

The numerical grid is uniform in log distance. Its cells do not have equal widths in distance, so integration weights include dr=r dlog⁡rdr=r\,d\log r. Omitting this factor silently changes the calculation.

p(r∣ϖ^,σ,L)∝r2e−r/Lexp⁡ ⁣[−(ϖ^−1000/r)22σ2],r>0p(r\mid\widehat\varpi,\sigma,L)\propto r^2e^{-r/L}\exp\!\left[-\frac{(\widehat\varpi-1000/r)^2}{2\sigma^2}\right],\qquad r>0
Distance is in parsecs; measured parallax and its standard error are in milliarcseconds. No parallax zero-point correction is applied here. These results illustrate inference. Calibrated scientific distances also require suitable zero-point treatment and a justified prior.

Reading: Bailer-Jones · Bailer-Jones et al. · Lindegren et al.

Inspect negative parallaxes and spatial coordinates

Source 3200000259019600000 has measured parallax about minus 0.131 milliarcseconds with standard error 0.425. Its inverse-distance output is null, but its positive-distance posterior is calculated normally. With prior scale 1,350 parsecs, the median is about 4,463 parsecs and the central sixty-eight-percent interval about 2,741 to 7,060. Changing the prior scale moves this weakly constrained result.

The output also projects each radial median along its ICRS direction into three spatial coordinates. These are positions at the chosen radial median, not exact locations or complete joint three-dimensional distributions. A population map requires the distance distributions and observational selection as well as the plotted points.

Finally run --check. It compares the recomputed output with the frozen result and halves the grid resolution to check convergence. When the parallax likelihood becomes essentially constant in distance, the posterior must approach a Gamma distribution with shape three. Its analytic cumulative probability independently checks the numerical quantiles.

For a different Gaia sample, inspect release, epoch, units and solution type first. Then examine covariances, the applicable zero-point calibration and the sample selection. A single point in a distance map carries all of that information behind it.

Reading: Bailer-Jones · Lindegren et al.

Download the frozen exercise

Use the repository checkout for the command paths above. The same input, output, provenance and source script can be inspected here.

Try the geometry

Recognize the corresponding problem in a simulated measurement

  1. Compare the nearby preset with The wobble in noise and watch the parallax signal shrink relative to the measurement scatter.
  2. Export the synthetic sequence and distinguish its per-observation coordinate covariance from the real CSV’s fitted five-parameter covariance.

Exercises and explained answers

Why keep the three negative parallaxes instead of deleting them before analysis?

Measurement noise affects the sign. Removing negative values preferentially removes measurements scattered in one direction and changes the sample. A positive-distance inference can still use their negative-parallax likelihoods.

A weak source’s median distance changes substantially with the prior scale. How should you interpret it?

The data constrain distance weakly and the prior matters. Report the sensitivity and consider suitable direction-dependent priors, photometry or independent observations. Choose the model from the sample and observational evidence.

Sources and calculation scope

  1. Lindegren et al., Gaia EDR3 — The astrometric solution, arXiv:2012.03380v1

    Sections 3.1, 5.3–5.7; equation 23 and figures 10–12. The fixed single-source model and covariance conventions apply to the basic DR3 astrometry inherited from EDR3.

  2. Bailer-Jones, Estimating distances from parallaxes, arXiv:1507.02105v1

    Sections 2–3 and 7; equations 1, 4 and 17–18. Used for the Gaussian parallax likelihood and an explicitly pedagogical exponentially decreasing space-density prior.

  3. Bailer-Jones et al., Estimating distances from parallaxes V, arXiv:2012.05220v1

    Sections II.1–II.3, V.2 and V.5. The published direction-dependent Galactic prior differs from this tutorial’s simple EDSD prior.

  4. Lindegren et al., Parallax bias versus magnitude, colour, and position, arXiv:2012.01742v2

    Sections 2.3, 4.1 and 8; figures 2, 5, 21–22 and tables 9–10. The tutorial applies no zero-point correction and does not claim calibrated catalogue distances.

  5. ARI Gaia Services — TAP documentation

    Synchronous CSV queries against gaiadr3.gaia_source. Query, source IDs, raw CSV and checksum frozen on 28 October 2026.

FeedbackSomething broken, confusing, or missing on this page?Tell us
What kind of feedback?

Sent with this page’s address, its Lab ID, the site language and your device type. Please leave out personal details. Feedback is kept for up to 12 months.Privacy policy