particle¶
import expertsystem.reaction.particle
A collection of particle info containers.
The particle module is the starting point of the
expertsystem. 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 reaction module uses the properties of Particle instances when it
computes which StateTransitionGraph s are allowed between an initial state
and final state.
-
class
Particle(*, name: str, pid: int, latex: Optional[str] = None, spin, mass, width=0.0, charge: int = 0, isospin=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=None, c_parity=None, g_parity=None)[source]¶ Bases:
objectImmutable container of data defining a physical particle.
A
Particleis 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. HenceParticleinstances do not contain spin projection information.Particleinstances are uniquely defined by their quantum numbers and properties likemass. Thenameandpidare therefore just labels that are not taken into account when checking if twoParticleinstances are equal.Note
As opposed to classes such as
EdgeQuantumNumbersandNodeQuantumNumbers, theParticleclass serves as an interface to the user (see Particle database).-
__eq__(other)¶ Method generated by attrs for class Particle.
-
-
class
ParticleCollection(particles: Optional[Iterable[Particle]] = None)[source]¶ Bases:
collections.abc.MutableSetSearchable collection of immutable
Particleinstances.-
discard(value: Union[Particle, str]) → None[source]¶ Remove an element. Do not raise an exception if absent.
-
filter(function: Callable[[Particle], bool]) → ParticleCollection[source]¶ Search by
Particleproperties using alambdafunction.For example:
>>> from expertsystem.reaction.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(list(subset.names)) ['K(2)(1820)+', 'K(2)(1820)0']
-
property
names¶
-
-
class
Spin(magnitude, projection)[source]¶ Bases:
objectSafe, immutable data container for spin with projection.
-
create_antiparticle(template_particle: Particle, new_name: Optional[str] = None, new_latex: Optional[str] = None) → Particle[source]¶
-
create_particle(template_particle: Particle, name: Optional[str] = None, latex: Optional[str] = None, pid: Optional[int] = None, mass: Optional[float] = None, width: Optional[float] = None, charge: Optional[int] = None, spin: Optional[float] = None, isospin: Optional[Spin] = None, strangeness: Optional[int] = None, charmness: Optional[int] = None, bottomness: Optional[int] = None, topness: Optional[int] = None, baryon_number: Optional[int] = None, electron_lepton_number: Optional[int] = None, muon_lepton_number: Optional[int] = None, tau_lepton_number: Optional[int] = None, parity: Optional[int] = None, c_parity: Optional[int] = None, g_parity: Optional[int] = None) → Particle[source]¶
-
load_pdg() → ParticleCollection[source]¶ Create a
ParticleCollectionwith all entries from the PDG.PDG info is imported from the scikit-hep/particle package.