particle#

import qrules.particle

A collection of particle info containers.

The particle module is the starting point of qrules. Its main interface is the ParticleCollection, which is a collection of immutable Particle instances that are uniquely defined by their properties. As such, it can be used stand-alone as a database of quantum numbers (see Particle database).

The transition module uses the properties of Particle instances when it computes which MutableTransition s are allowed between an initial state and final state.

class Spin(magnitude: SupportsFloat, projection: SupportsFloat)[source]#

Bases: object

Safe, immutable data container for spin with projection.

magnitude: float[source]#
projection: float[source]#
class Particle(*, name: str, pid: int, latex: str | None = None, spin, mass, width=0.0, charge: int = 0, isospin: Spin | Tuple[float, float] | None = None, strangeness: int = 0, charmness: int = 0, bottomness: int = 0, topness: int = 0, baryon_number: int = 0, electron_lepton_number: int = 0, muon_lepton_number: int = 0, tau_lepton_number: int = 0, parity: Parity | int | None = None, c_parity: Parity | int | None = None, g_parity: Parity | int | None = None)[source]#

Bases: object

Immutable container of data defining a physical particle.

A Particle is defined by the minimum set of the quantum numbers that every possible instances of that particle have in common (the “static” quantum numbers of the particle). A “non-static” quantum number is the spin projection. Hence Particle instances do not contain spin projection information.

Particle instances are uniquely defined by their quantum numbers and properties like mass. The name and pid are therefore just labels that are not taken into account when checking if two Particle instances are equal.

Note

As opposed to classes such as EdgeQuantumNumbers and NodeQuantumNumbers, the Particle class serves as an interface to the user (see Particle database).

name: str[source]#
pid: int[source]#
latex: str | None[source]#
spin: float[source]#
mass: float[source]#
width: float[source]#
charge: int[source]#
isospin: Spin | None[source]#
strangeness: int[source]#
charmness: int[source]#
bottomness: int[source]#
topness: int[source]#
baryon_number: int[source]#
electron_lepton_number: int[source]#
muon_lepton_number: int[source]#
tau_lepton_number: int[source]#
parity: Parity | None[source]#
c_parity: Parity | None[source]#
g_parity: Parity | None[source]#
is_lepton() bool[source]#
class ParticleCollection(particles: Iterable[Particle] | None = None)[source]#

Bases: MutableSet

Searchable collection of immutable Particle instances.

add(value: Particle) None[source]#

Add an element.

discard(value: Particle | str) None[source]#

Remove an element. Do not raise an exception if absent.

find(search_term: int | str) Particle[source]#

Search for a particle by either name (str) or PID (int).

filter(function: Callable[[Particle], bool]) ParticleCollection[source]#

Search by Particle properties using a lambda function.

For example:

>>> from qrules.particle import load_pdg
>>> pdg = load_pdg()
>>> subset = pdg.filter(
...     lambda p: p.mass > 1.8
...     and p.mass < 2.0
...     and p.spin == 2
...     and p.strangeness == 1
... )
>>> sorted(subset.names)
['K(2)(1820)+', 'K(2)(1820)0', 'K(2)*(1980)+', 'K(2)*(1980)0']
update(other: Iterable[Particle]) None[source]#
property names: List[str][source]#
create_particle(template_particle: Particle, name: str | None = None, latex: str | None = None, pid: int | None = None, mass: float | None = None, width: float | None = None, charge: int | None = None, spin: float | None = None, isospin: Spin | None = None, strangeness: int | None = None, charmness: int | None = None, bottomness: int | None = None, topness: int | None = None, baryon_number: int | None = None, electron_lepton_number: int | None = None, muon_lepton_number: int | None = None, tau_lepton_number: int | None = None, parity: int | None = None, c_parity: int | None = None, g_parity: int | None = None) Particle[source]#
create_antiparticle(template_particle: Particle, new_name: str | None = None, new_latex: str | None = None) Particle[source]#
load_pdg() ParticleCollection[source]#

Create a ParticleCollection with all entries from the PDG.

PDG info is imported from the scikit-hep/particle package.