Skip to main content

LVec

CI PyPI

Lorentz vectors for particle physics with NumPy and Awkward Array.

Reconstruct invariant masses, select particles, transform reference frames, and calculate decay angles on scalars, dense arrays, or jagged event data. LVec also provides two- and three-dimensional spatial vectors.

Install

Requires Python 3.10 or later and NumPy 2.2.4 or later. Jagged collections additionally require Awkward 2.7.4 or later.

python -m pip install lvec
python -m pip install "lvec[awkward]"  # for jagged event data

Reconstruct a two-particle system

Use consistent energy and momentum units, with $c=1$ and metric $(+,-,-,-)$.

from lvec import LVec

daughter1 = LVec(px=3., py=0., pz=0., E=5.)
daughter2 = LVec(px=0., py=4., pz=0., E=5.)
parent = daughter1 + daughter2

print(f"Pair mass: {parent.mass:.3f}")  # Pair mass: 8.660
daughter1_cm = daughter1.boost_to_rest(parent)

The same operations act elementwise on arrays. Components are independent, read-only float64 snapshots, so editing an input array cannot change a vector. Use validate=True when constructing physical particle momenta. For event samples, start with jagged events and reductions.

Documentation

The LVec manual provides searchable tutorials, physics conventions, and API reference pages. Sources can also be read here:

Start here Contents
Tutorials Scalars, NumPy arrays, jagged events, particle combinations, and rest frames
Physics guide Coordinates, invariant mass, event selections, rest frames, decay angles, and numerical conventions
API reference Complete 2D, 3D, 4D, and frame interfaces, including aliases and coordinate conversions
Migrating from vector Familiar interfaces and scientific differences to check
Benchmarks Representative measurements, ownership boundaries, and reproduction
Contributing Testing, numerical bug reports, and releases

Citation

Please cite LVec using CITATION.cff.

Licence

LVec is licensed under the GNU General Public License v3.

Metadata

Release files for lvec 0.3.4

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

Source distribution (sdist)

Source distribution for lvec 0.3.4
File Size Uploaded Provenance Actions
lvec-0.3.4.tar.gz 243.3 kB With provenance Details for lvec-0.3.4.tar.gz

Built distribution (wheel)

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

Total release size: 397.6 kB

Release files / lvec-0.3.4.tar.gz

Download URL lvec-0.3.4.tar.gz
Size 243.3 kB
Tags Source
SHA-256 checksum
How to use checksums
c3635cf3c68f41acc20bd8d530aecea41f65cd428b814d848c6f01f5ef8b990e
BLAKE2b-256 checksum
How to use checksums
eda876ce2bc051027ee715321387a7bbf1f1521156469ec0ae99417ec04f6271
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.18

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 7, 2026.

Transparency log

Release files / lvec-0.3.4-py3-none-any.whl

Download URL lvec-0.3.4-py3-none-any.whl
Size 154.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3a43612c7e2351cb2834ab4e6ef5c037c6707cc4804dd5f394caf3c17f9cd34a
BLAKE2b-256 checksum
How to use checksums
e598dc07cc450582a6f469343f849eae954bcfde65921a1967cb4a1f5251715a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.18

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 7, 2026.

Transparency log

Security for lvec 0.3.4

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for lvec-0.3.4.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 7, 2026.

Transparency log

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