Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']

steps:
- uses: actions/checkout@v4
Expand Down
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,18 @@

Small and thin Python interface to read [Les Houches Event (LHE)](https://inspirehep.net/record/725284) files


## Tested Monte Carlo Generators' LHE output

| Generator | Tested Versions |
|------------------------------------------------|-----------------------|
| [MadGraph5](https://launchpad.net/mg5amcnlo) | 2.0.0, 2.2.1, 3.5.8 |
| [POWHEG-BOX-V2](http://powhegbox.mib.infn.it/) | r4027 |
| [Pythia](https://pythia.org/) | 6.413, 8.3.14 |
| [Sherpa](https://sherpa-team.gitlab.io/) | 3.0.1 |
| [Whizard](https://whizard.hepforge.org/) | 3.1.4 |

Note: test files are provided via the [scikit-hep-testdata](https://github.com/scikit-hep/scikit-hep-testdata) package. Please open an issue of create directly a PR for the inclusion of new files for testing.
## Install

To install `pylhe` from PyPI you can just do
Expand Down
5 changes: 2 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ dynamic = ["version"]
description = "A small package to get structured data out of Les Houches Event files"
readme = "README.md"
license = { text = "Apache-2.0" } # SPDX short identifier
requires-python = ">=3.8"
requires-python = ">=3.9"
authors = [
{ name = "Lukas Heinrich", email = "lukas.heinrich@cern.ch" },
{ name = "Matthew Feickert", email = "matthew.feickert@cern.ch" },
Expand All @@ -30,7 +30,6 @@ classifiers = [
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
Expand All @@ -54,7 +53,7 @@ test = [
"pydocstyle",
"pytest-cov>=2.5.1",
"pytest>=6.0",
"scikit-hep-testdata>=0.4.36",
"scikit-hep-testdata>=0.5.5",
]
develop = [
"pylhe[lint,test]",
Expand Down
3 changes: 2 additions & 1 deletion src/pylhe/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import gzip
import io
import xml.etree.ElementTree as ET
from typing import Iterable, Optional
from collections.abc import Iterable
from typing import Optional

import graphviz
from particle import latex_to_html_name
Expand Down
36 changes: 30 additions & 6 deletions tests/test_lhe_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,30 @@
skhep_testdata.data_path(f"pylhe-testfile-powheg-box-v2-{proc}.lhe")
for proc in ["Z", "W", "Zj", "trijet", "directphoton", "hvq"]
]
TEST_FILES_LHE_MADGRAPH = [
skhep_testdata.data_path("pylhe-testfile-madgraph-2.0.0-wbj.lhe"),
skhep_testdata.data_path("pylhe-testfile-madgraph-2.2.1-Z-ckkwl.lhe.gz"),
skhep_testdata.data_path("pylhe-testfile-madgraph-2.2.1-Z-fxfx.lhe.gz"),
skhep_testdata.data_path("pylhe-testfile-madgraph-2.2.1-Z-mlm.lhe.gz"),
skhep_testdata.data_path("pylhe-testfile-madgraph5-3.5.8-pp_to_jj.lhe.gz"),
]
TEST_FILES_LHE_PYTHIA = [
skhep_testdata.data_path("pylhe-testfile-pythia-6.413-ttbar.lhe"),
skhep_testdata.data_path("pylhe-testfile-pythia-8.3.14-weakbosons.lhe"),
]
TEST_FILES_LHE_SHERPA = [
skhep_testdata.data_path("pylhe-testfile-sherpa-3.0.1-eejjj.lhe"),
]
TEST_FILES_LHE_WHIZARD = [
skhep_testdata.data_path("pylhe-testfile-whizard-3.1.4-eeWW.lhe"),
]
TEST_FILES_LHE_GENERATORS = [
*TEST_FILES_LHE_MADGRAPH,
*TEST_FILES_LHE_POWHEG,
*TEST_FILES_LHE_PYTHIA,
*TEST_FILES_LHE_SHERPA,
*TEST_FILES_LHE_WHIZARD,
]


@pytest.fixture(scope="session")
Expand Down Expand Up @@ -141,10 +165,10 @@ def test_read_lhe_with_attributes_v3():
assert isinstance(e, LHEEvent)


@pytest.mark.parametrize("file", TEST_FILES_LHE_POWHEG)
def test_read_lhe_powheg(file):
@pytest.mark.parametrize("file", TEST_FILES_LHE_GENERATORS)
def test_read_lhe_generator(file):
"""
Test method read_lhe() on several types of LesHouchesEvents POWHEG files.
Test method read_lhe() on several types of LesHouchesEvents generator files.
"""
events = pylhe.read_lhe(file)

Expand All @@ -153,10 +177,10 @@ def test_read_lhe_powheg(file):
assert isinstance(e, LHEEvent)


@pytest.mark.parametrize("file", TEST_FILES_LHE_POWHEG)
def test_read_lhe_with_attributes_powheg(file):
@pytest.mark.parametrize("file", TEST_FILES_LHE_GENERATORS)
def test_read_lhe_with_attributes_generator(file):
"""
Test method read_lhe_with_attributes() on several types of LesHouchesEvents POWHEG files.
Test method read_lhe_with_attributes() on several types of LesHouchesEvents generator files.
"""
events = pylhe.read_lhe_with_attributes(file)

Expand Down
Loading