Skip to content

scikit-hep/vector

Repository files navigation

Vector logo

Vector: arrays of 2D, 3D, and Lorentz vectors

Actions Status Documentation Status pre-commit.ci status codecov percentage GitHub Discussion Gitter

PyPI platforms PyPI version Conda latest release DOI LICENSE Scikit-HEP

Installation

You can install Vector with pip and conda.

pip install vector

Introduction

Vector is a Python library for 2D and 3D spatial vectors, as well as 4D space-time vectors. It is especially intended for performing geometric calculations on arrays of vectors, rather than one vector at a time in a Python for loop.

Vector is part of the Scikit-HEP project, High Energy Physics (HEP) tools in Python.

Coordinate systems

Vectors may be expressed in any of these coordinate systems:

  • the azimuthal plane may be Cartesian x y or polar rho ($\rho$) phi ($\phi$)
  • the longitudinal axis may be Cartesian z, polar theta ($\theta$), or pseudorapidity eta ($\eta$)
  • the temporal component for space-time vectors may be Cartesian t or proper time tau ($\tau$)

in any combination. (That is, 4D vectors have 2Γ—3Γ—2 = 12 distinct coordinate systems.)

Diagram of coordinate systems

Backends

Vectors may be included in any of these data types:

Each of these "backends" provides the same suite of properties and methods, through a common "compute" library.

Geometric versus momentum

Finally, vectors come in two flavors:

  • geometric: only one name for each property or method
  • momentum: same property or method can be accessed with several synonyms, such as pt ($p_T$, transverse momentum) for the azimuthal magnitude rho ($\rho$) and energy and mass for the Cartesian time t and proper time tau ($\tau$).

Familiar conventions

Names and coordinate conventions were chosen to align with ROOT's TLorentzVector and Math::LorentzVector, as well as scikit-hep/math, uproot-methods TLorentzVector, henryiii/hepvector, and coffea.nanoevents.methods.vector.

Getting help

Contributing to Vector

If you want to contribute to Vector, pull requests are welcome!

Please install the latest version of the main branch from source or a fork:

git clone https://github.com/scikit-hep/vector.git
cd vector
pip install -e .

Refer to CONTRIBUTING.md for more.

Documentation

Tutorials

Vector constructors

Vector functions

More ways to learn

Contributors

Thanks goes to these wonderful people (emoji key):


Jim Pivarski

🚧 πŸ’» πŸ“–

Henry Schreiner

🚧 πŸ’» πŸ“–

Eduardo Rodrigues

🚧 πŸ’» πŸ“–

N!no

πŸ“–

Peter Fackeldey

πŸ“–

Luke Kreczko

πŸ’»

Nicholas Smith

πŸ€”

Jonas Eschle

πŸ€”

This project follows the all-contributors specification. Contributions of any kind welcome! See CONTRIBUTING.md for information on setting up a development environment.

Acknowledgements

This library was primarily developed by Saransh Chopra, Henry Schreiner, Jim Pivarski, Eduardo Rodrigues, and Jonas Eschle.

Support for this work was provided by the National Science Foundation cooperative agreement OAC-1836650 and PHY-2323298 (IRIS-HEP) and OAC-1450377 (DIANA/HEP). Any opinions, findings, conclusions or recommendations expressed in this material are those of the authors and do not necessarily reflect the views of the National Science Foundation.