vector.backends.awkward_constructors module

vector.backends.awkward_constructors module#

vector.backends.awkward_constructors.Array(*args: Any, **kwargs: Any) Any#

Constructs an Awkward Array of vectors, whose type is determined by the fields of the record array (which may be nested within lists or other non-record structures).

All allowed signatures for ak.Array can be used in this function.

The array must contain records with the following combinations of field names:

  • (2D) x, y

  • (2D) rho, phi

  • (3D) x, y, z

  • (3D) x, y, theta

  • (3D) x, y, eta

  • (3D) rho, phi, z

  • (3D) rho, phi, theta

  • (3D) rho, phi, eta

  • (4D) x, y, z, t

  • (4D) x, y, z, tau`

  • (4D) x, y, theta, t`

  • (4D) x, y, theta, tau`

  • (4D) x, y, eta, t`

  • (4D) x, y, eta, tau`

  • (4D) rho, phi, z, t`

  • (4D) rho, phi, z, tau`

  • (4D) rho, phi, theta, t`

  • (4D) rho, phi, theta, tau`

  • (4D) rho, phi, eta, t`

  • (4D) rho, phi, eta, tau`

in which

  • px may be substituted for x

  • py may be substituted for y

  • pt may be substituted for rho

  • pz may be substituted for z

  • E may be substituted for t

  • e may be substituted for t

  • energy may be substituted for t

  • M may be substituted for tau

  • m may be substituted for tau

  • mass may be substituted for tau

to make the vector a momentum vector.

No constraints are placed on the types of the vector fields, though if they are not numbers, mathematical operations will fail. Usually, you want them to be integers or floating-point numbers.

vector.backends.awkward_constructors._check_names(projectable: Any, fieldnames: list[str]) tuple[bool, int, list[str], Any]#
vector.backends.awkward_constructors._is_type_safe(array_type: Any) bool#
vector.backends.awkward_constructors._recname(is_momentum: bool, dimension: int) str#
vector.backends.awkward_constructors.zip(arrays: dict[str, Any], depth_limit: int | None = None) Any#

Constructs an Awkward Array of vectors, whose type is determined by the fields of the record array (which may be nested within lists or other non-record structures).

This function accepts a subset of ak.zip’s arguments.

Parameters:
  • arrays (dict of str to array-like) – Arrays, lists, etc. to zip together. Unlike ak.zip, this must be a dict with string keys to determine the coordinate system of the arrays; it may not be a tuple.

  • depth_limit (None or int) – If None, attempt to fully broadcast the array to all levels. If an int, limit the number of dimensions that get broadcasted. The minimum value is 1, for no broadcasting.

The array must contain records with the following combinations of field names:

  • (2D) x, y

  • (2D) rho, phi

  • (3D) x, y, z

  • (3D) x, y, theta

  • (3D) x, y, eta

  • (3D) rho, phi, z

  • (3D) rho, phi, theta

  • (3D) rho, phi, eta

  • (4D) x, y, z, t

  • (4D) x, y, z, tau`

  • (4D) x, y, theta, t`

  • (4D) x, y, theta, tau`

  • (4D) x, y, eta, t`

  • (4D) x, y, eta, tau`

  • (4D) rho, phi, z, t`

  • (4D) rho, phi, z, tau`

  • (4D) rho, phi, theta, t`

  • (4D) rho, phi, theta, tau`

  • (4D) rho, phi, eta, t`

  • (4D) rho, phi, eta, tau`

in which

  • px may be substituted for x

  • py may be substituted for y

  • pt may be substituted for rho

  • pz may be substituted for z

  • E may be substituted for t

  • e may be substituted for t

  • energy may be substituted for t

  • M may be substituted for tau

  • m may be substituted for tau

  • mass may be substituted for tau

to make the vector a momentum vector.