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

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.3
File Size Uploaded Provenance Actions
lvec-0.3.3.tar.gz 239.5 kB With provenance Details for lvec-0.3.3.tar.gz

Built distribution (wheel)

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

Total release size: 390.2 kB

Release files / lvec-0.3.3.tar.gz

Download URL lvec-0.3.3.tar.gz
Size 239.5 kB
Tags Source
SHA-256 checksum
How to use checksums
2e334a391e8327ebb11cbfd73a4f87519f1f8dc0eed0837cff7838a9bd70c126
BLAKE2b-256 checksum
How to use checksums
f2b96bc537f5e44970235cbea576de97c270d2fa9184011adbc82d13c8f60362
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 5, 2026.

Transparency log

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

Download URL lvec-0.3.3-py3-none-any.whl
Size 150.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7f4d2f3a2adfe6e08d681ffa549ec9e8acdfbc5af979fc0583e3cd88d6a9e6e3
BLAKE2b-256 checksum
How to use checksums
8be523bb91eb54e87f2870c33d0353e9b6c6fb07d0df08c25782ab170783019a
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 5, 2026.

Transparency log

Security for lvec 0.3.3

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