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

Start here Contents
Physics guide Coordinates, invariant mass, event selections, rest frames, decay angles, and numerical conventions
API reference Constructors, observables, transformations, array operations, and cache options
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.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 lvec 0.3.0
File Size Uploaded Provenance Actions
lvec-0.3.0.tar.gz 202.1 kB With provenance Details for lvec-0.3.0.tar.gz

Built distribution (wheel)

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

Total release size: 342.2 kB

Release files / lvec-0.3.0.tar.gz

Download URL lvec-0.3.0.tar.gz
Size 202.1 kB
Tags Source
SHA-256 checksum
How to use checksums
0fdc97da3727fd023ab21c48054b12d88b1822fc99f31bc14c1c87c1dca34201
BLAKE2b-256 checksum
How to use checksums
c486639f1605241592dbcc3b6bf180a26b94c88e9647cb1ec8dc7d77626dd1aa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.17

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 2, 2026.

Transparency log

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

Download URL lvec-0.3.0-py3-none-any.whl
Size 140.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a6a1b10c48b7a102504dd7a98fa8094f16ec9583bc854ea42a482bb0782e4e4a
BLAKE2b-256 checksum
How to use checksums
2c231dd25b0a3d2d8d50b27aef4504c133b355ec5163dda8a537218a851beefb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.17

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 2, 2026.

Transparency log

Security for lvec 0.3.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.

Full provenance

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

Select from 2 files

Attestation for lvec-0.3.0.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 2, 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