Skip to main content

pylgframework

A software framework for the Local Group.

The barycentre of the Local Group is routinely adopted as a point estimate. pylgframework replaces the single-line centre-of-mass calculation with a Monte Carlo that propagates the observational uncertainty of the member galaxies, and returns the barycentre together with its uncertainty region.

Frutos Plaza, M. (2026). The cost of undeclared uncertainty at Local Group scales: membership systematics of the barycentric rest frame (manuscript in preparation; data and code at doi:10.5281/zenodo.23440771)

Status

tests

Tested on Linux and Windows, Python 3.11 and 3.12, with astropy 7.2 and the latest release.

Installation

Requires Python ≥ 3.11

pip install pylgframework             # core: numpy, pandas, astropy
pip install "pylgframework[rebound]"  # adapter for REBOUND simulations

Installation (for developers)

git clone https://github.com/mfrutosp/pylgframework
cd pylgframework
pip install -e .                 # core: numpy, pandas, astropy
pip install -e ".[rebound]"      # adapter for REBOUND simulations
pip install -e ".[test]"         # development and tests

Quick start

from pylgframework import barycentre, compare, fiducials

res = barycentre(fiducials.WU, n=1000, seed=2000)
print(res)                       # position, velocity, principal axes, CMB-frame speed, assumptions

res.median_position              # kpc, Galactocentric
res.axes                         # 1-sigma principal axes of the barycentre cloud (kpc)
res.vcmb("4")                    # speed w.r.t. the CMB (16th, 50th, 84th percentile, km/s)
res.cloud                        # DataFrame with every realization

# Paired audit of two literature fiducials (identical random draws)
compare(fiducials.WU, fiducials.VDM2012, n=1000, seed=3000)

Available fiducials: WU (Wu et al. 2026), SAWALA (Sawala et al. 2025), VDM2019, VDM2012 and VDM2012_3B (van der Marel et al. 2012, four-body and faithful three-body variants). Each one carries its reference and notes (fiducials.WU.reference).

Memberships: "2" (MW+M31), "3M" (+M33), "3L" (+LMC), "4" (all four).

Motion of a galaxy relative to the barycentre

The velocity of any member relative to the barycentre depends on the adopted membership and fiducial. pylgframework propagates both:

res = barycentre(fiducials.WU, n=1000, seed=2000)

res.relative_to_barycentre("LMC", "4")  # per realization: distance, speed, radial and tangential velocity
res.body_budget("LMC")                  # median and 16th/84th percentiles for each membership

# Paired difference between two fiducials (identical random draws)
diff = compare(fiducials.WU, fiducials.VDM2012, n=1000, seed=3000)
diff.body_offset("LMC", "4")            # (16th, 50th, 84th) percentiles of the difference, km/s

For the fiducial of Wu et al. (2026) and seed 2000, the speed of the LMC relative to the barycentre is about 271 km/s if the barycentre is defined by the MW and M31 alone, and about 253 km/s with all four bodies.

Assumptions

  • Observables (distance modulus, proper motions, radial velocity, mass) are drawn from Gaussians truncated at ±2σ (the effective standard deviation is about 0.88σ).
  • Sky positions are held fixed; the MW is at rest at the origin of the Galactocentric frame (R0 = 8.122 kpc, v⊙ = (12.9, 245.6, 7.78) km/s).
  • The output is the uncertainty induced by the declared errors, not a complete physical uncertainty region.
  • The uncertainty model is fixed across fiducials unless sigmas= is supplied.

Reproducibility

Realization i of an ensemble with seed s uses numpy.random.default_rng([s, i]). This scheme is part of the public interface. The test suite reproduces Table 1 and Sects. 3 and 4 of the manuscript, and the worked example above:

pytest            # full suite (a few seconds)

An example using the REBOUND adapter is in tests/test_rebound_simulation.py.

How to cite

If this software is used, please cite the article above and the archived software: pylgframework v0.2.0, Zenodo deposit doi:10.5281/zenodo.23440771 (all versions).

References

The bibliography of the manuscript, including the sources of every fiducial and of the CMB dipole, is in docs/references.bib.

Issues

Bug reports and questions: GitHub issues.

License

MIT.

Metadata

Release files for pylgframework 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pylgframework 0.2.0
File Size Uploaded Provenance Actions
pylgframework-0.2.0.tar.gz 18.4 kB Without provenance Details for pylgframework-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pylgframework 0.2.0
File Interpreter ABI Platform Actions
pylgframework-0.2.0-py3-none-any.whl Python 3 none any Details for pylgframework-0.2.0-py3-none-any.whl

Total release size: 33.6 kB

Release files / pylgframework-0.2.0.tar.gz

Download URL pylgframework-0.2.0.tar.gz
Size 18.4 kB
Tags Source
SHA-256 checksum
How to use checksums
9436db624e21887362c7018a6a3b7d52b49615d1d03dc5e4b50cd8bc86529689
BLAKE2b-256 checksum
How to use checksums
2274f69213ae5267ad15b3942edc4272dcb90520fe492518644505e73babf5c9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.6

Release files / pylgframework-0.2.0-py3-none-any.whl

Download URL pylgframework-0.2.0-py3-none-any.whl
Size 15.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
60894f1a266f0f264fef44004413d8e1265505b7d7c4c41214e93743e05054cd
BLAKE2b-256 checksum
How to use checksums
2a3b22dc30f557c89801bb9782c6614df0445203770483b8e504f73a8ba026da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.6

Security for pylgframework 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page