Vector is a Python 3.6+ 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, spherical, 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.

Team