decayangle package

Submodules

decayangle.backend module

decayangle.config module

decayangle.decay_topology module

class decayangle.decay_topology.HelicityAngles(phi_rf, theta_rf)

Bases: tuple

phi_rf

Alias for field number 0

theta_rf

Alias for field number 1

class decayangle.decay_topology.Node(value: Any | tuple, ordering_function=None)

Bases: object

Class to represent a node in a decay topology. The node can have daughters, which are also nodes. The value of a node is either an integer or a tuple of integers. A tuple implies that the node will finally decay into the particles given in the tuple. The ordering function is used to sort the daughters and the values of the composite nodes.

value

the value of the node

Type:

Union[int, Tuple[int]]

parent

the parent node of the node

Type:

Node

daughters

the daughters of the node

Type:

Tuple[Node]

ordering_function

function ordering the daughters and node values of the node

Type:

function

add_daughter(daughter: Node)

Add a daughter to the node. The daughter has to be of type Node, since this function should only be called when constructing a topology. No checks are made to ensure that the daughter is not already a daughter of the node. Daughters are re-sorted after adding a new daughter.

Parameters:

daughter (Node) – the daughter to add

align_with_daughter(momenta: Dict[int, array | array], nth_daughter: int = 0, tol: float | None = None) Dict[int, array | array]

Align the momenta with the nth daughter. It is written in this way, to highlight, that one can only align with the direct daughters of a node. This requires the momenta to be in the rest frame of the node.

Parameters:
  • momenta (dict) – the momenta of the final state particles

  • nth_daughter (int, optional) – the daughter to align with. Defaults to 0.

  • tol (float, optional) – tolerance for the gamma check. Defaults to the value in the config.

Returns:

the aligned momenta

Return type:

dict

boost(target: Node | int, momenta: Dict[str, array | array], tol: float | None = None, convention: Literal['helicity', 'minus_phi', 'canonical'] = 'helicity') LorentzTrafo

Get the boost from this node to a target node The momenta dictionary will define the initial configuration. It is expected, that the momenta are jax or numpy compatible and that the momenta are given in the rest frame of this node.

Parameters:
  • target (Union[Node, int]) – the target node to boost to

  • momenta (dict) – the momenta of the final state particles

  • tol (float, optional) – tolerance for the gamma check. Defaults to the value in the config.

  • convention (Literal["helicity", "minus_phi", "canonical"], optional) – the convention to use for the boost. Defaults to “helicity”. helicity: we just rotate to be aligned with the target and boost minus_phi: we rotate to be aligned, boost and then roate the azimutal angle (phi or psi) back canonical: We rotate, boost and rotate back. Thus the action is a pure boost

static construct_topology(node: Node, topology: Tuple[int | tuple])

Construct a topology from a tuple of integers and tuples, in the form like the string representation of a topology

i.e. ((1,2), 3) or ((1, (2, 3)), 4) for a four body decay

Parameters:
  • node (Node) – the node to add the daughters to

  • topology (List[Union[int, tuple]]) – the topology to construct

contains(contained_node: Node) bool

Check if a node is contained in the topology

Parameters:

contained_node (Node) – the node to check for

Returns:

True if the node is contained in the topology, False otherwise

Return type:

bool

property daughters: Tuple[Node]

Get the daughters of the node

Returns:

the daughters of the node

Return type:

List[Node]

property final_state: bool

Check if the node is a final state node by checking if it has daughters

Returns:

True if the node is a final state node, False otherwise

Return type:

bool

classmethod get_node(value: int | Tuple[int] | Node) Node

Get a node from a value or return the value if a node is given

Parameters:

value (Union[int, Tuple[int], Node]) – the value of the node

Returns:

the node

Return type:

Node

helicity_angles(momenta: Dict[str, array | array], tol: float | None = None) HelicityAngles

Get the helicity angles for the daughters of this node. The angles are with respect to the first daughter. Here the ordering scheme can be important.

Parameters:
  • momenta – Dictionary of momenta for the final state particles

  • tol – Tolerance for the gamma check

Returns:

Helicity angles for the final state particles

mass(momenta: Dict[str, Array | array]) Array | array

Get the mass of the particle

Parameters:

momenta (dict) – the momenta of the final state particles

Returns:

the mass of the particle, as set by the momenta dictionary This expects the momenta to be jax or numpy compatible

momentum(momenta: Dict[str, Array | array]) Array | array

Get a particles momentum

Parameters:

momenta (dict) – the momenta of the final state particles

Returns:

the momentum of the particle, as set by the momenta dictionary This expects the momenta to be jax or numpy compatible

property ordering_function: Callable

Get the sorting key of the node. This is used to sort the daughters and make sure, that the order of the daughters is consistent.

Returns:

the sorting key

Return type:

int

preorder() List[Node]

Get the nodes in the tree in preorder. This is a recursive function, which will return the nodes in the tree in the order of the preorder traversal. This means, root first, then daughters in the order they were added.

Returns:

the nodes in the tree in preorder

Return type:

list

rotate_to(target: Node, momenta: Dict[str, array | array], tol: float | None = None) Tuple[LorentzTrafo, float | array | array, float | array | array]

Get the rotation from this node to a target node The momenta dictionary will define the initial configuration. It is expected, that the momenta are jax or numpy compatible and that the momenta are given in the rest frame of this node.

Parameters:
  • target (Node) – the target node to rotate to

  • momenta (dict) – the momenta of the final state particles

  • tol (float, optional) – tolerance for the gamma check. Defaults to the value in the config.

Returns:

the rotation to apply theta_rf (Union[float, np.array, jnp.array]): the polar angle of the rotation psi_rf (Union[float, np.array, jnp.array]): the azimuthal angle of the rotation

Return type:

rotation (LorentzTrafo)

transform(trafo: LorentzTrafo, momenta: Dict[str, array | array]) Dict[int, array | array]

Transform the momenta of the final state particles

Parameters:
  • trafo (LorentzTrafo) – transformation to apply

  • momenta (dict) – the momenta of the final state particles

Returns:

the transformed momenta

Return type:

dict

property tuple

Tuple representation of the node. When called on the root node of a tree, the result can be used to reconstruct the tree.

Returns:

the tuple representation of the node

Return type:

tuple

class decayangle.decay_topology.Topology(root: Node | int, decay_topology: List[int | tuple] | None = None, ordering_function=None)

Bases: object

A class to represent a decay topology as a tree of nodes. The tree is constructed from a root node, which has daughters, which can have daughters and so on. The final state nodes are the nodes without daughters. The ordering function is used to sort the daughters of the nodes and the values of the composite nodes.

Properties:

root (Node): the root node of the topology final_state_nodes (List[Node]): the final state nodes of the topology ordering_function (function): function ordering the daughters and node values of the topology

align_with_daughter(momenta: Dict[int, array | array], node: int | Node | None = None) Dict[int, array | array]

Align the momenta with the node passed as argument. If no node is passed, the first daughter is used. If the node is not a daughter of the root node, a ValueError is raised.

Parameters:
  • momenta (dict) – the momenta of the final state particles

  • node (int, optional) – the daughter to align with. Defaults to the first daughter.

Returns:

the aligned momenta

Return type:

dict

boost(target: Node | int, momenta: Dict[str, array | array], inverse: bool = False, tol: float | None = None, convention: Literal['helicity', 'minus_phi', 'canonical'] = 'helicity') LorentzTrafo

Get the boost from the root node to a target node.

Parameters:
  • target – Node to boost to

  • momenta – Dictionary of momenta for the final state particles

  • inverse – If True, return the inverse of the boost

  • tol – Tolerance for the gamma check. Defaults to the value in the config.

  • convention – The convention to use for the boost. Defaults to “helicity”.

Returns:

Boost from the root node to the target node

contains(contained_node: Node | int) bool

Check if a node is contained in the topology

Parameters:

contained_node (Node) – the node to check for

Returns:

True if the node is contained in the topology, False otherwise

Return type:

bool

property final_state_nodes: List[Node]

The final state nodes of the topology

Returns:

the final state nodes of the topology

Return type:

List[Node]

helicity_angles(momenta: Dict[str, array | array], tol: float | None = None, convention: Literal['helicity', 'minus_phi', 'canonical'] = 'helicity') Dict[Tuple[tuple | int, tuple | int], HelicityAngles]

Get a tree with the helicity angles for every internal node

Parameters:
  • momenta (Dictionary) – Dictionary of momenta for the final state particles

  • tol (float) – Tolerance for the gamma check. Defaults to the value in the config.

  • convention (Literal["helicity", "minus_phi", "canonical"]) – the convention to use.

  • "helicity". (Defaults to) – helicity: we just rotate to be aligned with the target and boost minus_phi: we rotate to be aligned, boost and then roate the azimutal angle (phi or psi) back canonical: We rotate, boost and rotate back. Thus the action is a pure boost

Returns:

Helicity angles for the final state particles

property nodes: Dict[tuple | int, Node]

nodes of the tree

Returns:

A dict of the nodes with the node value as key

Return type:

Dict[Union[tuple, int], Node]

property ordering_function: Callable

The sorting key of the topology

Returns:

the sorting key of the topology

Return type:

int

path_to(target: Node | int) Tuple[tuple | int, Dict[int, Node]]

Get the path to a target node

Parameters:

target (Union[Node, int]) – the target node to get the path to

Returns:

the path to the target node

Return type:

list

preorder() List[Node]

Get the nodes in the tree in preorder. This only calls the preorder function of the root node. For more details see the preorder function of the Node class.

Returns:

the nodes in the tree in preorder

Return type:

list

relative_wigner_angles(other: Topology, momenta: Dict[str, array | array], tol: float | None = None, convention: Literal['helicity', 'minus_phi', 'canonical'] = 'helicity') Dict[int, Tuple[Array | array, Array | array]]

Get the relative Wigner angles between two topologies

Parameters:
  • other – Topology to compare to

  • target – Node to compare to

  • momenta – Dictionary of momenta for the final state particles

  • tol – Tolerance for the gamma check. Defaults to the value in the config.

Returns:

Dict of the relative Wigner angles with the final state node as key

property root: Node

The root node of the topology

Returns:

the root node of the topology

Return type:

Node

rotate_between_topologies(other: Topology, target: Node | int, momenta: Dict[str, array | array], tol: float | None = None, convention: Literal['helicity', 'minus_phi', 'canonical'] = 'helicity') LorentzTrafo

Get the relative Wigner angles between two topologies

Parameters:
  • other – Topology to compare to

  • target – Node to compare to

  • momenta – Dictionary of momenta for the final state particles

  • tol – Tolerance for the gamma check. Defaults to the value in the config.

Returns:

The rotation between the two rest frames for the target node, one arrives at by boosting from the mother rest frame to the target rest frame as described by the two topologies

to_rest_frame(momenta: Dict[str, array | array], tol: float | None = None) Dict[int, array | array]

Transform the momenta to the rest frame of the root node

Parameters:
  • momenta (dict) – the momenta of the final state particles

  • tol (float, optional) – tolerance for the gamma check. Defaults to the value in the config. When the original gamma is close to 1, the momenta are assumed to be in the rest frame of the root node.

Returns:

the momenta in the rest frame of the root node

Return type:

dict

property tuple

Tuple representation of the topology. When called on the root node of a tree, the result can be used to reconstruct the tree.

Returns:

the tuple representation of the topology root node

Return type:

tuple

class decayangle.decay_topology.TopologyCollection(start_node: int = None, final_state_nodes: List[int] = None, topologies: List[Topology] = None, ordering_function=None)

Bases: object

A group of topologies with the same start node and final state nodes. Mostly used to filter topologies based on the internal nodes they contain. Also ensures, that all topologies are for the same final state nodes and start node.

start_node

the start node of the topologies. Has to be the same for all topologies.

Type:

int

final_state_nodes

the final state nodes of the topologies. Have to be the same for all topologies.

Type:

list

topologies

the topologies of the collection

Type:

list

ordering_function

function ordering the daughters and node values of the topologies. Will overwrite the ordering function of the topologies.

Type:

function

filter(*contained_nodes: Node) List[Topology]

Filter the topologies based on the number of contained intermediate nodes.

Parameters:

contained_nodes (tuple[Node]) – nodes which should be contained in the topologies

static filter_list(topologies: List[Node], contained_node: Node) List[Topology]

Filter the topologies based on the number of contained steps.

Parameters:

contained_step (list) – sub topology for which to filter

property ordering_function: Callable

The sorting key of the topology, used to sort the daughters of the nodes and the values of the composite nodes

Returns:

A function returning an integer and accepting an integer or tuple as input

property topologies: List[Topology]

Returns all possible topologies for the given final state nodes or the topologies provided at initialization

Returns:

the topologies of the collection

Return type:

List[Topology]

decayangle.decay_topology.flat(l) Generator

Flatten a nested list

Parameters:

l (list) – the list to flatten

Returns:

the flattened list as a generator

Return type:

list

decayangle.decay_topology.generate_topology_definitions(nodes: List[int]) List[Node]

Generate all possible topology definitions for a given list of nodes.

Parameters:

nodes – List of nodes to generate topology definitions for

Returns:

List of topology definitions

decayangle.decay_topology.split(nodes: List[Node], splitter: int) Tuple[Tuple[Node], Tuple[Node]]

Split a list of nodes into two lists of nodes. Parameters: nodes: List of nodes to split

splitter: Bitmask to split the nodes 1 -> left, 0 -> right

Returns: Tuple of lists of nodes

decayangle.kinematics module

decayangle.kinematics.adjust_for_2pi_rotation(m_original_2x2, phi, theta, xi, phi_rf, theta_rf, psi_rf) Tuple[array | array]

Adjust the rotation angles for the 2pi rotation ambiguity

Parameters:
  • M_original_2x2 (jax.numpy.ndarray) – the original 2x2 matrix

  • psi (float) – the recovered psi angle from the 4x4 matrix

  • theta (float) – the recovered theta angle from the 4x4 matrix

  • xi (float) – the recovered rapidity angle from the 4x4 matrix

  • theta_rf (float) – the recovered theta_rf angle from the 4x4 matrix

  • phi_rf (float) – the recovered phi_rf angle from the 4x4 matrix

  • psi_rf (float) – the recovered psi_rf angle from the 4x4 matrix

Returns:

the adjusted rotation angles

Return type:

tuple

decayangle.kinematics.beta(momentum)

calculate beta factor

Parameters:

p (jax.numpy.ndarray) – momentum 4-vector

decayangle.kinematics.boost_matrix_2_2_x(xi: float | array | array) array | array

Build a 2x2 boost matrix in the x-direction :param xi: rapidity of the boost :type xi: float

Returns:

the 2x2 boost matrix with shape (…,2,2)

Return type:

Union[jnp.array, np.array]

decayangle.kinematics.boost_matrix_2_2_y(xi: float | array | array) array | array

Build a 2x2 boost matrix in the y-direction :param xi: rapidity of the boost :type xi: float

Returns:

the 2x2 boost matrix with shape (…,2,2)

Return type:

Union[jnp.array, np.array]

decayangle.kinematics.boost_matrix_2_2_z(xi: float | array | array) array | array

Build a 2x2 boost matrix in the z-direction :param xi: rapidity of the boost :type xi: float

Returns:

the 2x2 boost matrix with shape (…,2,2)

Return type:

Union[jnp.array, np.array]

decayangle.kinematics.boost_matrix_4_4_z(xi: float | array | array) array | array

Build a 4x4 boost matrix in the z-direction

Parameters:

xi (float) – rapidity of the boost

Returns:

the 4x4 boost matrix with shape (…,4,4)

Return type:

Union[jnp.array, np.array]

decayangle.kinematics.boost_to_rest(vector: array | array, boostvector: array | array) array | array

Perform Lorentz boost to the rest frame of the 4-vector boostvector.

Parameters:
  • vector (Union[jnp.array, np.array]) – 4-vector to be boosted

  • boostvector (Union[jnp.array, np.array]) – Boost momentum 4-vector in the same frame as vector (should have nonzero mass!)

Returns:

4-vector boosted to the rest frame of boostvector

Return type:

Union[jnp.array, np.array]

decayangle.kinematics.build_2_2(phi, theta, xi, phi_rf, theta_rf, psi_rf)

Build a 2x2 matrix from the 6 kinematic parameters

Parameters:
  • psi (float) – the rotation angle around the z-axis

  • theta (float) – the rotation angle around the y-axis

  • xi (float) – the rapidity of the boost

  • phi_rf (float) – the rotation angle around the z-axis in the rest frame

  • theta_rf (float) – the rotation angle around the y-axis in the rest frame

  • psi_rf (float) – the rotation angle around the z-axis in the rest frame

Returns:

the 2x2 matrix

Return type:

jax.numpy.ndarray

decayangle.kinematics.build_4_4(phi, theta, xi, phi_rf, theta_rf, psi_rf)

Build a 4x4 matrix from the 6 kinematic parameters

Parameters:
  • psi (float) – the rotation angle around the z-axis

  • theta (float) – the rotation angle around the y-axis

  • xi (float) – the rapidity of the boost

  • phi_rf (float) – the rotation angle around the z-axis in the rest frame

  • theta_rf (float) – the rotation angle around the y-axis in the rest frame

  • psi_rf (float) – the rotation angle around the z-axis in the rest frame

Returns:

the 4x4 matrix

Return type:

jax.numpy.ndarray

decayangle.kinematics.build_vector(x, y, z)

Make a 3-vector from components. Components are stacked along the last index.

Parameters:
  • x – x-component of the vector

  • y – y-component of the vector

  • z – z-component of the vector

Returns:

3-vector

decayangle.kinematics.decode_4_4(matrix: array | array, tol: float | None = None)

Decode a 4x4 matrix into the 6 kinematic parameters

Parameters:
  • matrix (Union[jnp.array, np.array]) – the 4x4 matrix

  • tol (Optional[float], optional) – The tolerance for the gamma factor. If None the default tolerance of the config will be used. Defaults to None.

Returns:

the 6 kinematic parameters

Return type:

Tuple[Union[jnp.array, np.array]]

decayangle.kinematics.decode_4_4_boost(matrix, tol: float | None = None) Tuple[float | array | array]

decode a 4x4 matrix into the 3 boost parameters

Parameters:
  • matrix (jax.numpy.ndarray) – the 4x4 matrix

  • tol (float, optional) – the tolerance for the gamma factor. When not given the default value from the config (‘gamma_tolerance’) will be used.

decayangle.kinematics.decode_rotation_4x4(rotation_matrix: array | array) Tuple[float, float, float]

decode a 4x4 rotation matrix into the 3 rotation angles

Parameters:

matrix (jax.numpy.ndarray) – the 4x4 rotation matrix

Returns:

the 3 rotation angles (phi, theta, psi)

Return type:

Tuple[float, float, float]

decayangle.kinematics.decode_su2_rotation(matrix_2x2: array) Tuple[array, array, array]
decayangle.kinematics.eta(vector)

Return pseudorapidity component of the input Lorentz or 3-vector

Parameters:

vector – input vector (Lorentz or 3-vector)

Returns:

vector of pseudorapidity components

decayangle.kinematics.from_mass_and_momentum(m, mom)

Create a Lorentz vector from mass and momentum vector

Parameters:
  • mass – Mass scalar

  • momentum – 3-vector of momentum components

Returns:

Lorentz vector

decayangle.kinematics.gamma(momentum)

calculate gamma factor

Parameters:

p (jax.numpy.ndarray) – momentum 4-vector

decayangle.kinematics.lorentz_boost(vector: array | array, boostvector: array | array) array | array

Perform Lorentz boost of the 4-vector vector using boost vector boostvector. We do not use the matrices here, to make things a little easier

Parameters:
  • vector (Union[jnp.array, np.array]) – 4-vector to be boosted

  • boostvector (Union[jnp.array, np.array]) – Boost momentum 4-vector in the same frame as vector (should have nonzero mass!)

Returns:

4-vector boosted to the boostvector frame

Return type:

Union[jnp.array, np.array]

decayangle.kinematics.lorentz_vector(space, time)

Make a Lorentz vector from spatial and time components

Parameters:
  • space – 3-vector of spatial components

  • time – time component

Returns:

Lorentz vector

decayangle.kinematics.mass(vector)

Calculate mass scalar for Lorentz 4-momentum vector

Parameters:

vector – input Lorentz momentum vector

Returns:

scalar invariant mass

decayangle.kinematics.mass_squared(vector)

Calculate squared invariant mass scalar for Lorentz 4-momentum vector

Parameters:

vector – input Lorentz momentum vector

Returns:

scalar invariant mass squared

decayangle.kinematics.metric_tensor()

Constant metric tensor for Lorentz space

Returns:

Metric tensor

decayangle.kinematics.norm(vec: array | array)

Calculate norm of 3-vector

Parameters:

vec (Union[jnp.array, np.array]) – 3-vector

Returns:

norm of the 3-vector

Return type:

Union[jnp.array, np.array]

decayangle.kinematics.p(vector: array | array) array | array

Calculate absolute value of the 4-momentum

Parameters:

vector (Union[jnp.array, np.array]) – 4-momentum vector

Returns:

absolute value of the 4-momentum

Return type:

Union[jnp.array, np.array]

decayangle.kinematics.psi(vector: array | array) array | array

Return azimuthal angle component of the input Lorentz or 3-vector

Parameters:

vector – input vector (Lorentz or 3-vector)

Returns:

vector of azimuthal angle components

decayangle.kinematics.pt(vector)

Return transverse (X-Y) component of the input Lorentz or 3-vector

Parameters:

vector – input vector (Lorentz or 3-vector)

Returns:

vector of transverse components

decayangle.kinematics.rapidity(momentum)

calculate rapidity

Parameters:

p (jax.numpy.ndarray) – momentum 4-vector

decayangle.kinematics.rotate_to_z_axis(v: array | array) array | array

Given a vector, calculate the angles to rotate it to the z-axis This is done by rotating into the x-z plane (rotation around z axis by -psi_rf) and then into the z-axis (rotation around y axis by -theta_rf)

Parameters:

v (Union[jnp.array, np.array]) – the 4 vector to be rotated

Returns:

the rotation angles around first z and then y axis

Return type:

Union[jnp.array, np.array]

decayangle.kinematics.rotation_matrix_2_2_x(theta: float | array | array) array | array

Build a 2x2 rotation matrix around the x-axis

Parameters:

theta (float) – the rotation angle

Returns:

the rotation matrix with shape (…,2,2)

Return type:

Union[jnp.array, np.array]

decayangle.kinematics.rotation_matrix_2_2_y(theta: float | array | array) array | array

Build a 2x2 rotation matrix around the y-axis

Parameters:

theta (float) – the rotation angle

Returns:

the rotation matrix with shape (…,2,2)

Return type:

Union[jnp.array, np.array]

decayangle.kinematics.rotation_matrix_2_2_z(theta: float | array | array) array | array

Build a 2x2 rotation matrix around the z-axis

Parameters:

theta (float) – the rotation angle

Returns:

the rotation matrix with shape (…,2,2)

Return type:

Union[jnp.array, np.array]

decayangle.kinematics.rotation_matrix_4_4_y(theta: float | array | array) array | array

Build a 4x4 rotation matrix around the y-axis

Parameters:

theta (float) – the rotation angle

Returns:

the rotation matrix with shape (…,4,4)

Return type:

Union[jnp.array, np.array]

decayangle.kinematics.rotation_matrix_4_4_z(theta: float) array | array

Build a 4x4 rotation matrix around the z-axis

Parameters:

theta (float) – the rotation angle

Returns:

the rotation matrix with shape (…,4,4)

Return type:

Union[jax.numpy.ndarray, np.array]

decayangle.kinematics.scalar(x: array | array) array | array

Create a scalar (array with only one component in last index) which can be used to e.g. scale a vector.

Parameters:

x (Union[jnp.array, np.array]) – input array

Returns:

scalar array

Return type:

Union[jnp.array, np.array]

decayangle.kinematics.scalar_product(vec1: array | array, vec2: array | array) array | array

Calculate scalar product of two 3-vectors

Parameters:
  • vec1 (Union[jnp.array, np.array]) – first 3-vector

  • vec2 (Union[jnp.array, np.array]) – second 3-vector

Returns:

scalar product of the two vectors

Return type:

Union[jnp.array, np.array]

decayangle.kinematics.spatial_components(vector)

Return spatial components of the input Lorentz vector

Parameters:

vector – input Lorentz vector

Returns:

tensor of spatial components

decayangle.kinematics.time_component(vector)

Return time component of the input Lorentz vector

Parameters:

vector – input Lorentz vector (where indexes 0-2 are space, index 3 is time)

Returns:

vector of time components

decayangle.kinematics.x_component(vector)

Return spatial X component of the input Lorentz or 3-vector

Parameters:

vector – input vector (Lorentz or 3-vector)

Returns:

vector of X-components

decayangle.kinematics.y_component(vector)

Return spatial Y component of the input Lorentz or 3-vector

Parameters:

vector – input vector (Lorentz or 3-vector)

Returns:

vector of Y-components

decayangle.kinematics.z_component(vector)

Return spatial Z component of the input Lorentz or 3-vector

Parameters:

vector – input vector (Lorentz or 3-vector)

Returns:

vector of Z-components

decayangle.lorentz module

class decayangle.lorentz.LorentzTrafo(*args, **kwargs)

Bases: object

A class to represent a Lorentz transformation. It is initialized with either 6 values or 2 matrices. The matrices are the 2x2 SU(2) matrix and the 4x4 O(3) matrix. Both representations are held in the class and can be accessed via the attributes matrix_2x2 and matrix_4x4.

The 4x4 matrix is used to perform the Lorentz transformation on a 4-vector and to decode the parameters of the transformation up to a rotation of 2 pi. The 2x2 matrix can then be used to determine if a rotation of 2 pi has been performed, as this implies matrix_2x2(decoded params) = -matrix_2x2(original params). This is important information for fermions.

decode(two_pi_aware=True, tol: float | None = None, method: Literal['flip', 'su2_decode'] = 'su2_decode') Tuple[array | array]

Decode the parameters of the Lorentz transformation

Parameters:
  • two_pi_aware (bool, optional) – If true the check for a rotation of 2 pi will be made. Defaults to True.

  • tol (Optional[float], optional) – The tolerance for the check of a 2 pi rotation. If None the default tolerance of the config will be used. Defaults to None.

  • method (Literal["flip", "su2_decode"], optional) –

    The method to use for decoding. Defaults to “flip”. “flip”: The parameters are decoded from the 4x4 matrix and the check for a 2 pi rotation is made.

    A 2 pi flip may be applied to phi_rf

    ”su2_decode”: theta_rf, phi_rf and psi_rf are decoded from the 2x2 SU(2) matrix directly.

Returns:

The parameters of the Lorentz transformation

Return type:

Tuple[Union[np.array, jnp.array]]

inverse() LorentzTrafo

Inverse of the Lorentz transformation

Returns:

the inverse of the Lorentz transformation

Return type:

LorentzTrafo

wigner_angles(method: Literal['flip', 'su2_decode'] = 'su2_decode') Tuple[array | array]

The wigner angles of a transformation These are usually the angles of the rotation before the boost

Returns:

the angles of the rotation in the frame before the boost

Return type:

Tuple[Union[np.array, jnp.array]]

class decayangle.lorentz.WignerAngles(phi_rf, theta_rf, psi_rf)

Bases: tuple

phi_rf

Alias for field number 0

psi_rf

Alias for field number 2

theta_rf

Alias for field number 1

decayangle.numerics_helpers module

decayangle.numerics_helpers.matrix_vector_product(matrix, vector)

Vectorized version of the matrix vector product using einsum

Parameters:
  • matrix (Union[np.array, jnp.array]) – The matrix

  • vector (Union[np.array, jnp.array]) – The vector

Returns:

The result of the matrix vector product

Return type:

Union[np.array, jnp.array]

decayangle.numerics_helpers.save_arccos(x)

Save version of arccos by clipping the argument to the range [-1, 1]

Parameters:

x (Union[float, jnp.array]) – The argument of the arccos

Returns:

The result of the arccos

Return type:

Union[float, jnp.array]

Module contents