How to use the particle.pythia.PythiaID 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 / pythia / test_pythiaid.py View on Github external
def test_from_pdgid():
    assert PythiaID.from_pdgid(9010221) == 10221

    assert PythiaID.from_pdgid(PDGID(9010221)) == 10221
    assert PythiaID.from_pdgid(PDGID(9010221)) == PythiaID(10221)

    with pytest.raises(MatchingIDNotFound):
        pdgid = PythiaID.from_pdgid(9000221)
github scikit-hep / particle / tests / pythia / test_pythiaid.py View on Github external
def test_class_return_type():
    assert isinstance(-PythiaID(211), PythiaID)
    assert isinstance(~PythiaID(211), PythiaID)
github scikit-hep / particle / tests / converters / test_maps.py View on Github external
def test_DirectionalMaps():
    filename = data.open_text(data, "pdgid_to_pythiaid.csv")
    PDG2PyIDMap, Py2PDGIDMap = DirectionalMaps(
        "PDGID", "PythiaID", filename=filename, converters=(int, int)
    )

    assert len(PDG2PyIDMap) == 538
    assert len(Py2PDGIDMap) == 538

    assert "DirectionalMap(PDGID->PYTHIAID)" in str(PDG2PyIDMap)
    assert "DirectionalMap(PYTHIAID->PDGID)" in str(Py2PDGIDMap)

    with pytest.raises(MatchingIDNotFound):
        pyid = PDG2PyIDMap[PDGID(9000221)]
    with pytest.raises(MatchingIDNotFound):
        pdgid = Py2PDGIDMap[PythiaID(9000221)]
github scikit-hep / particle / tests / pythia / test_pythiaid.py View on Github external
def test_class_string_representations():
    pid = PythiaID(211)
    assert pid == 211
    assert pid.__str__() == ""
github scikit-hep / particle / tests / pythia / test_pythiaid.py View on Github external
def test_to_pdgid():
    pythiaid = PythiaID(10331)
    assert pythiaid.to_pdgid() == 10221
    assert pythiaid.to_pdgid() == PDGID(10221)
github scikit-hep / particle / tests / converters / test_maps.py View on Github external
def test_BiMap():
    bimap = BiMap(PDGID, PythiaID)

    assert len(bimap) == 538
    assert "BiMap(PDGID-PythiaID)" in str(bimap)

    with pytest.raises(MatchingIDNotFound):
        pyid = bimap[PDGID(9000221)]
github scikit-hep / particle / tests / pythia / test_pythiaid.py View on Github external
def test_class_inversion():
    assert -PythiaID(311) == ~PythiaID(311)