How to use the particle.data 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_generation.py View on Github external
particle2018 = tmp_path / "particle2018.csv"
    particle2019 = tmp_path / "particle2019.csv"

    produce_files(particle2018, particle2019, "DUMMY", "2019")

    """
    # No longer test this file, which eventually will be removed
    particle2018_data = data.open_text(data, "particle2018.csv")
    with particle2018.open() as src, particle2018_data as res:
        src = [l for l in src.readlines() if not l.startswith("#")]
        res = [l for l in res.readlines() if not l.startswith("#")]
        assert src == res
    """

    particle2019_data = data.open_text(data, "particle2019.csv")
    with particle2019.open() as src, particle2019_data as res:
        src = [l for l in src.readlines() if not l.startswith("#")]
        res = [l for l in res.readlines() if not l.startswith("#")]
        assert src == res
github scikit-hep / particle / tests / particle / test_particle.py View on Github external
def test_explicit_table_loading():
    Particle.load_table(data.open_text(data, "particle2019.csv"))
    assert Particle.table_loaded() == True
    assert len(Particle.table_names()) == 1
    assert Particle.all() is not None
github scikit-hep / particle / tests / particle / test_generation.py View on Github external
def test_file_has_latex(filename):
    with data.open_text(data, filename) as particle_data:
        p = pd.read_csv(particle_data, comment="#")

    assert p[p.Latex == ""].empty
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)]