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

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.2
File Size Uploaded Provenance Actions
lvec-0.3.2.tar.gz 238.2 kB With provenance Details for lvec-0.3.2.tar.gz

Built distribution (wheel)

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

Total release size: 387.2 kB

Release files / lvec-0.3.2.tar.gz

Download URL lvec-0.3.2.tar.gz
Size 238.2 kB
Tags Source
SHA-256 checksum
How to use checksums
5250b467e96f04473efc666a3e4e4509ec86d0d5c4d5e7c41a125e36f3c16ab7
BLAKE2b-256 checksum
How to use checksums
72f22d9b08d6808cb5fc2be5d1e58912c8ac57b95cd870e65c5703de29e2106b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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

Transparency log

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

Download URL lvec-0.3.2-py3-none-any.whl
Size 149.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a33d759519953ac262f49143a5f5d85089842b70220c24c483295c660b4d367c
BLAKE2b-256 checksum
How to use checksums
869f382ec032fb40d97a24c555e139a8f08b01da278c90121cf7fc8fb021a7e8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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

Transparency log

Security for lvec 0.3.2

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