How to use the particle.particle.Particle.from_string 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_ampgen_style_names(name, pid):
    particle = Particle.from_string(name)

    assert int(particle) == pid
    assert particle.pdgid == pid
    assert particle == pid
github scikit-hep / particle / tests / particle / test_particle.py View on Github external
def test_string():
    pi = Particle.from_string("pi+")
    assert pi.pdgid == 211

    with pytest.raises(ParticleNotFound):
        Particle.from_string("unknown")
github scikit-hep / particle / tests / particle / test_particle.py View on Github external
def test_fuzzy_string():
    """
    The input name is not specific enough, in which case the search is done
    by pdg_name after failing a match by name.
    """
    p = Particle.from_string("a(0)(980)")  # all 3 charge stages match
    assert p.pdgid == 9000111
github scikit-hep / particle / tests / particle / test_particle.py View on Github external
def test_string():
    pi = Particle.from_string("pi+")
    assert pi.pdgid == 211

    with pytest.raises(ParticleNotFound):
        Particle.from_string("unknown")