Source code for pyfeyn2.particles

from typing import List, Tuple

from particle import PDGID
from particle.converters.bimap import DirectionalMaps

PDG2LaTeXNameMap, LaTeX2PDGNameMap = DirectionalMaps(
    "PDGID", "LaTexName", converters=(PDGID, str)
)

PDG2Name2IDMap, PDGID2NameMap = DirectionalMaps(
    "PDGName", "PDGID", converters=(str, PDGID)
)


[docs]def get_name(pid: int) -> str: """ Get the latex name of a particle. Args: pid (int) : PDG Monte Carlo identifier for the particle. Returns: str: Latex name. Examples: >>> get_name(21) 'g' >>> get_name(1000022) '\\\\tilde{\\\\chi}_{1}^{0}' """ global PDG2LaTeXNameMap pdgid = PDG2LaTeXNameMap[pid] return pdgid