_images/vector-logo.png

Action status Documentation Status pre-commit.ci status coverage GitHub Discussion Gitter Code style: black

PyPI platforms PyPI version Conda latest releasetatus DOI License Scikit-HEP

Overview#

Vector is a Python 3.7+ library for 2D, 3D, and Lorentz vectors, especially arrays of vectors, to solve common physics problems in a NumPy-like way.

Main features of Vector:

  • Pure Python with NumPy as its only dependency. This makes it easier to install.

  • Vectors may be represented in a variety of coordinate systems: Cartesian, cylindrical, pseudorapidity, and any combination of these with time or proper time for Lorentz vectors. In all, there are 12 coordinate systems: {x - y vs ρ - φ in the azimuthal plane} × {z vs θ vs η longitudinally} × {t vs τ temporally}.

  • Uses names and conventions set by ROOT’s TLorentzVector and Math::LorentzVector, as well as scikit-hep/math, uproot-methods TLorentzVector, henryiii/hepvector, and coffea.nanoevents.methods.vector.

  • Implemented on a variety of backends:
    • pure Python objects

    • NumPy arrays of vectors (as a structured array subclass)

    • Awkward Arrays of vectors

    • potential for more: CuPy, TensorFlow, Torch, JAX…

  • NumPy/Awkward backends also implemented in Numba for JIT-compiled calculations on vectors.

  • Distinction between geometrical vectors, which have a minimum of attribute and method names, and vectors representing momentum, which have synonyms like pt = rho, energy = t, mass = tau.

Installation#

Vector is available on PyPI as well as on conda. The library can be installed using pip -

pip install vector

or using conda -

conda install -c conda-forge vector

Talks about vector#

Changes in vector’s API#

The changelog file describes the changes in vector’s API and usage introduced in every new version. These changes can be breaking changes or minor adjustments, hence one should go through this file and their existing codebase while updating vector’s version.

Getting help#

  • Vector’s code is hosted on GitHub.

  • If something is not working the way it should, or if you want to request a new feature, create a new issue on GitHub.

  • To discuss something related to vector, use the discussions tab on GitHub or vector’s gitter (Scikit-HEP/vector) chat room.

Contributing to vector#

If you are planning to develop vector (thank you!), or if you want to use the latest commit of vector on your local machine, you might want to install it from the source. Refer to our Contributing Guidelines for more information.

API reference#

The API reference details the functionality of each class and function present in vector’s codebase.

API Reference