How to use the particle.particle.Particle.from_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 / particle / test_particle.py View on Github external
def test_html_name(pid, html_name):
    particle = Particle.from_pdgid(pid)

    assert particle.html_name == html_name
github scikit-hep / particle / tests / particle / test_particle.py View on Github external
def test_int_compare():
    assert Particle.from_pdgid(211) > 0
    assert Particle.from_pdgid(-211) < 0
    assert Particle.from_pdgid(211) >= 0
    assert Particle.from_pdgid(-211) <= 0

    assert 0 < Particle.from_pdgid(211)
    assert 0 > Particle.from_pdgid(-211)
    assert 0 <= Particle.from_pdgid(211)
    assert 0 >= Particle.from_pdgid(-211)
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 / particle / test_particle.py View on Github external
def test_is_name_barred(pid, has_bar):
    particle = Particle.from_pdgid(pid)

    assert particle.is_name_barred == has_bar
github scikit-hep / particle / tests / particle / test_particle.py View on Github external
def test_pdg():
    assert Particle.from_pdgid(211).pdgid == 211
    with pytest.raises(InvalidParticle):
        Particle.from_pdgid(0)
github scikit-hep / particle / tests / particle / test_particle.py View on Github external
def test_spin_type(pid, stype):
    particle = Particle.from_pdgid(pid)

    assert particle.spin_type == stype
github scikit-hep / particle / tests / particle / test_particle.py View on Github external
def test_describe(pid, description):
    particle = Particle.from_pdgid(pid)
    assert description in particle.describe()
github scikit-hep / particle / tests / particle / test_particle.py View on Github external
def test_basic_props():
    pi = Particle.from_pdgid(211)
    assert pi.pdg_name == "pi"
    assert pi.pdgid == 211
    assert pi.three_charge == Charge.p
    assert pi.charge == 1
github scikit-hep / particle / tests / particle / test_particle.py View on Github external
def test_default_table_loading_bis():
    Particle.all()
    p = Particle.from_pdgid(211)
    assert p.table_loaded() is True
    assert p.table_names() == ("particle2019.csv", "nuclei2020.csv")