How to use the particle.pdgid.PDGID function in particle

To help you get started, we’ve selected a few particle examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github scikit-hep / particle / tests / pdgid / test_pdgid.py View on Github external
def test_class_string_representations():
    pid = PDGID(11)
    assert pid == 11
    assert pid.__str__() == ""
    pid = PDGID(-99999999)
    assert pid.__str__() == ""
github scikit-hep / particle / tests / geant / test_geant3id.py View on Github external
def test_to_pdgid():
    gid = Geant3ID(8)
    assert gid.to_pdgid() == 211
    assert gid.to_pdgid() == PDGID(211)
github scikit-hep / particle / tests / pdgid / test_pdgid.py View on Github external
def test_class_operations(PDGIDs):
    id_electron = PDGID(PDGIDs.Electron)
    id_positron = PDGID(PDGIDs.Positron)
    assert PDGIDs.Electron == id_electron
    assert id_positron == -id_electron
    assert PDGIDs.Positron == -id_electron
github scikit-hep / particle / tests / pdgid / test_pdgid.py View on Github external
def test_class_inversion():
    assert -PDGID(311) == ~PDGID(311)
github scikit-hep / particle / tests / particle / test_particle.py View on Github external
def test_pdg_convert():
    p = Particle.from_pdgid(211)
    assert isinstance(p.pdgid, PDGID)
    assert int(p) == 211
    assert PDGID(p) == 211
github scikit-hep / particle / tests / pdgid / test_pdgid.py View on Github external
def test_class_return_type():
    assert isinstance(-PDGID(311), PDGID)
    assert isinstance(~PDGID(311), PDGID)
github scikit-hep / particle / tests / pdgid / test_pdgid.py View on Github external
is_SUSY        False
is_baryon      False
is_diquark     False
is_dyon        False
is_hadron      False
is_lepton      False
is_meson       False
is_nucleus     False
is_pentaquark  False
is_valid       True
j_spin         3
l_spin         None
s_spin         None
three_charge   0
"""
    assert PDGID(22).info() == __info
github scikit-hep / particle / tests / pdgid / test_pdgid.py View on Github external
def test_nonphysical_pdgids():
    # The negative PDGID of a self-conjugate meson makes no sense
    assert (
        PDGID(-111).is_meson == False
    )  # the "anti-pi0" with opposite PDGID of a pi0 does not exist
    assert (
        PDGID(-443).is_meson == False
    )  # the "anti-J/psi" with opposite PDGID of a J/psi does not exist
github scikit-hep / particle / tests / pdgid / test_pdgid.py View on Github external
def test_decorated_class_methods(PDGIDs):
    """
    Check that all particle.pdgid functions decorated in the PDGID class
    work as expected for all kinds of PDGIDs.
    """
    for m in _fnames:
        for pid in PDGIDs:
            assert getattr(PDGID(pid), m) == getattr(_functions, m)(pid)