pylhe
Lightweight Python interface to read Les Houches Event (LHE) files
Science Score: 77.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 4 DOI reference(s) in README -
✓Academic publication links
Links to: zenodo.org -
✓Committers with academic emails
4 of 16 committers (25.0%) from academic institutions -
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (16.7%) to scientific vocabulary
Keywords
Keywords from Contributors
Repository
Lightweight Python interface to read Les Houches Event (LHE) files
Basic Info
- Host: GitHub
- Owner: scikit-hep
- License: apache-2.0
- Language: Python
- Default Branch: main
- Homepage: https://pypi.org/project/pylhe/
- Size: 1.89 MB
Statistics
- Stars: 45
- Watchers: 5
- Forks: 22
- Open Issues: 14
- Releases: 16
Topics
Metadata Files
README.md
pylhe: Python LHE interface

Small and thin Python interface to read Les Houches Event (LHE) files
Tested Monte Carlo Generators' LHE output
| Generator | Tested Versions | |------------------------------------------------|-----------------------| | MadGraph5 | 2.0.0, 2.2.1, 3.5.8 | | POWHEG-BOX-V2 | r4027 | | Pythia | 6.413, 8.3.14 | | Sherpa | 3.0.1 | | Whizard | 3.1.4 |
Note: test files are provided via the 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
python -m pip install pylhe
The visualization capabilities require the external dependency of Graphviz.
Get started
The example below provides a simple overview.
Full functionality can be inspected from the functions provided in the pylhe module.
Reading
```python import itertools
You can use LHE files from scikit-hep-testdata
from skheptestdata import datapath
import pylhe
lhefile = datapath("pylhe-testlhef3.lhe") events = pylhe.readlhewithattributes(lhefile) print(f"Number of events: {pylhe.readnumevents(lhe_file)}")
Get event 1
event = next(itertools.islice(events, 1, 2))
A DOT language graph of the event can be inspected as follows
print(event.graph.source)
The graph is nicely displayed as SVG in Jupyter notebooks
event
To save a DOT graph render the graph to a supported image format
(refer to the Graphviz documentation for more)
event.graph.render(filename="test", format="png", cleanup=True) event.graph.render(filename="test", format="pdf", cleanup=True) ```
Writing
For a full example see write or filter.
The values in the sketch below are intentionally left empty since they depend on the use-case.
The data structure of pylhe is:
```python import pylhe
file=pylhe.LHEFile( init=pylhe.LHEInit( initInfo=pylhe.LHEInitInfo( beamA=, beamB=, energyA=, energyB=, PDFgroupA=, PDFgroupB=, PDFsetA=, PDFsetB=, weightinStrategy=, numProcesses=, ), procInfo=pylhe.LHEProcInfo( xSection=, error=, unitWeight=, procId=, ), ), events=[ pylhe.LHEEvent( eventinfo=pylhe.LHEEventInfo( nparticles=, pid=, weight=, scale=, aqed=, aqcd=, ), particles=[ pylhe.LHEParticle( id=, status=, mother1=, mother2=, color1=, color2=, px=, py=, pz=, e=, m=, lifetime=, spin=, ), ... ], weights=None, attributes=None, optional=None, ), ... ] )
write to file, compressed if gz/gzip suffix
writelhefile(file.init, file.events, "myevents.lhe.gz", rwgt=True, weights=False)
```
Citation
The preferred BibTeX entry for citation of pylhe is
@software{pylhe,
author = {Lukas Heinrich and Matthew Feickert and Eduardo Rodrigues and Alexander Puck Neuwirth},
title = "{pylhe: v0.9.3}",
version = {v0.9.3},
doi = {10.5281/zenodo.1217031},
url = {https://github.com/scikit-hep/pylhe},
}
pylhe has been referenced in:
- Constraints on the trilinear and quartic Higgs couplings from triple Higgs production at the LHC and beyond (2023)
- BSM reach of four-top production at the LHC (2023)
- Probing compressed higgsinos with forward protons at the LHC (2023)
- FLArE up dark sectors with EM form factors at the LHC Forward Physics Facility (2022)
- Probing Neutrino-Portal Dark Matter at the Forward Physics Facility (2021)
- Looking forward to test the KOTO anomaly with FASER (2020)
- Probing Light Gauge Bosons in Tau Neutrino Experiments (2020)
- Benchmarking simplified template cross sections in WH production (2019)
- MadMiner: Machine learning-based inference for particle physics (2019)
- Search Strategy for Sleptons and Dark Matter Using the LHC as a Photon Collider (2018)
Contributors
We hereby acknowledge the contributors that made this project possible (emoji key): <!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --> <!-- prettier-ignore-start --> <!-- markdownlint-disable -->
Matthew Feickert |
Lukas |
Eduardo Rodrigues |
Johannes Schumann |
Henry Schreiner |
ariaradick |
Junghwan John Goh |
fuenfundachtzig |
Shantanu Gontia |
Tom Eichlersmith |
Alexander Puck Neuwirth |
Iason Krommydas |
This project follows the all-contributors specification.
Owner
- Name: Scikit-HEP Project
- Login: scikit-hep
- Kind: organization
- Email: scikit-hep-forum@googlegroups.com
- Website: https://scikit-hep.org
- Repositories: 46
- Profile: https://github.com/scikit-hep
A community project for High Energy Physics data analysis in Python
Citation (CITATION.cff)
cff-version: 1.2.0 message: "Please cite the following works when using this software." type: software authors: - family-names: "Heinrich" given-names: "Lukas" orcid: "https://orcid.org/0000-0002-4048-7584" affiliation: "Technical University of Munich" - family-names: "Feickert" given-names: "Matthew" orcid: "https://orcid.org/0000-0003-4124-7862" affiliation: "University of Wisconsin-Madison" - family-names: "Rodrigues" given-names: "Eduardo" orcid: "https://orcid.org/0000-0003-2846-7625" affiliation: "University of Liverpool" - family-names: "Neuwirth" given-names: "Alexander Puck" orcid: "https://orcid.org/0000-0002-2484-1328" affiliation: "Institut für Theoretische Physik, Universität Münster" title: "pylhe: v0.9.3" version: 0.9.3 doi: 10.5281/zenodo.1217031 repository-code: "https://github.com/scikit-hep/pylhe/releases/tag/v0.9.3" keywords: - lhe - physics - python - scikit-hep license: "Apache-2.0" abstract: | A small package to get structured data out of Les Houches Event files.
GitHub Events
Total
- Create event: 27
- Release event: 1
- Issues event: 11
- Watch event: 4
- Delete event: 24
- Issue comment event: 86
- Push event: 53
- Pull request review comment event: 29
- Pull request review event: 69
- Pull request event: 55
- Fork event: 1
Last Year
- Create event: 27
- Release event: 1
- Issues event: 11
- Watch event: 4
- Delete event: 24
- Issue comment event: 86
- Push event: 53
- Pull request review comment event: 29
- Pull request review event: 69
- Pull request event: 55
- Fork event: 1
Committers
Last synced: 10 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Matthew Feickert | m****t@c****h | 97 |
| pre-commit-ci[bot] | 6****] | 50 |
| dependabot[bot] | 4****] | 39 |
| Lukas Heinrich | l****h@g****m | 32 |
| Eduardo Rodrigues | e****s@c****h | 15 |
| allcontributors[bot] | 4****] | 11 |
| Alexander Puck Neuwirth | A****y | 9 |
| GitHub Action | a****n@g****m | 8 |
| Henry Schreiner | H****I@g****m | 5 |
| Tom Eichlersmith | 3****h | 3 |
| Johannes Schumann | j****n@f****e | 3 |
| ariaradick | 5****k | 2 |
| Junghwan John Goh | j****h@c****h | 1 |
| Shantanu Gontia | g****u@g****m | 1 |
| fuenfundachtzig | 8****g | 1 |
| Holger Schulz | h****z@d****k | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 38
- Total pull requests: 205
- Average time to close issues: 8 months
- Average time to close pull requests: 15 days
- Total issue authors: 12
- Total pull request authors: 12
- Average comments per issue: 2.03
- Average comments per pull request: 1.78
- Merged pull requests: 191
- Bot issues: 2
- Bot pull requests: 112
Past Year
- Issues: 8
- Pull requests: 67
- Average time to close issues: 23 days
- Average time to close pull requests: 7 days
- Issue authors: 5
- Pull request authors: 7
- Average comments per issue: 1.13
- Average comments per pull request: 1.66
- Merged pull requests: 58
- Bot issues: 1
- Bot pull requests: 47
Top Authors
Issue Authors
- matthewfeickert (13)
- APN-Pucky (8)
- eduardo-rodrigues (5)
- lukasheinrich (2)
- Andresfgomez970 (2)
- dependabot[bot] (2)
- sznajder (1)
- bfonta (1)
- tomeichlersmith (1)
- tshelley200 (1)
- ikrommyd (1)
- jhgoh (1)
Pull Request Authors
- dependabot[bot] (58)
- matthewfeickert (44)
- pre-commit-ci[bot] (40)
- APN-Pucky (19)
- allcontributors[bot] (14)
- eduardo-rodrigues (14)
- henryiii (6)
- tomeichlersmith (3)
- lukasheinrich (3)
- jhgoh (2)
- UCSC-EarlAlmazan (1)
- ikrommyd (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 2
-
Total downloads:
- pypi 2,819 last-month
- Total docker downloads: 11
-
Total dependent packages: 4
(may contain duplicates) -
Total dependent repositories: 9
(may contain duplicates) - Total versions: 19
- Total maintainers: 4
pypi.org: pylhe
A small package to get structured data out of Les Houches Event files
- Homepage: https://github.com/scikit-hep/pylhe
- Documentation: https://pylhe.readthedocs.io/
- License: Apache-2.0
-
Latest release: 0.9.3
published 6 months ago
Rankings
Maintainers (4)
conda-forge.org: pylhe
- Homepage: https://github.com/scikit-hep/pylhe
- License: Apache-2.0
-
Latest release: 0.4.0
published over 3 years ago
Rankings
Dependencies
- actions/checkout v3 composite
- actions/setup-python v4 composite
- actions/checkout v3 composite
- actions/setup-python v4 composite
- codecov/codecov-action v3 composite
- actions/checkout v3 composite
- actions/setup-python v4 composite
- actions/checkout v3 composite
- actions/setup-python v4 composite
- pypa/gh-action-pypi-publish v1.6.4 composite
- amannn/action-semantic-pull-request v5 composite
- ${BASE_IMAGE} latest build
- base latest build