pylhe

Lightweight Python interface to read Les Houches Event (LHE) files

https://github.com/scikit-hep/pylhe

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

hep lhe particle-physics scikit-hep

Keywords from Contributors

histogram high-energy-physics particles hep-ex closember pdg cern-root jax spacy-extension pid
Last synced: 6 months ago · JSON representation ·

Repository

Lightweight Python interface to read Les Houches Event (LHE) files

Basic Info
Statistics
  • Stars: 45
  • Watchers: 5
  • Forks: 22
  • Open Issues: 14
  • Releases: 16
Topics
hep lhe particle-physics scikit-hep
Created almost 11 years ago · Last pushed 6 months ago
Metadata Files
Readme License Code of conduct Citation Zenodo

README.md

pylhe: Python LHE interface

pylhe logo

GitHub Project DOI Scikit-HEP

RTD Docs Live Docs

PyPI version Conda-forge version Supported Python versions

GitHub Actions Status Code Coverage pre-commit.ci status Code style: black

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:

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
Matthew Feickert

Lukas
Lukas

Eduardo Rodrigues
Eduardo Rodrigues

Johannes Schumann
Johannes Schumann

Henry Schreiner
Henry Schreiner

ariaradick
ariaradick

Junghwan John Goh
Junghwan John Goh

fuenfundachtzig
fuenfundachtzig

Shantanu Gontia
Shantanu Gontia

Tom Eichlersmith
Tom Eichlersmith

Alexander Puck Neuwirth
Alexander Puck Neuwirth

Iason Krommydas
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

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

All Time
  • Total Commits: 278
  • Total Committers: 16
  • Avg Commits per committer: 17.375
  • Development Distribution Score (DDS): 0.651
Past Year
  • Commits: 50
  • Committers: 6
  • Avg Commits per committer: 8.333
  • Development Distribution Score (DDS): 0.62
Top Committers
Name Email 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
docs (6) enhancement (4) test (3) CI (2) bug (2) question (2) github-actions (2) dependencies (2) build (1) fix (1) chore (1)
Pull Request Labels
dependencies (58) github-actions (57) chore (32) CI (31) docs (21) enhancement (10) build (8) fix (7) test (5) API (3) refactor (1)

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

  • Versions: 18
  • Dependent Packages: 3
  • Dependent Repositories: 9
  • Downloads: 2,819 Last month
  • Docker Downloads: 11
Rankings
Dependent packages count: 3.2%
Docker downloads count: 4.1%
Dependent repos count: 4.8%
Average: 6.3%
Downloads: 6.9%
Forks count: 8.2%
Stargazers count: 10.5%
Last synced: 6 months ago
conda-forge.org: pylhe
  • Versions: 1
  • Dependent Packages: 1
  • Dependent Repositories: 0
Rankings
Dependent packages count: 28.8%
Forks count: 33.2%
Dependent repos count: 34.0%
Average: 34.5%
Stargazers count: 41.7%
Last synced: 6 months ago

Dependencies

.github/workflows/bump-version.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
.github/workflows/ci.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
  • codecov/codecov-action v3 composite
.github/workflows/lint.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
.github/workflows/publish-package.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
  • pypa/gh-action-pypi-publish v1.6.4 composite
.github/workflows/semantic-pr-check.yml actions
  • amannn/action-semantic-pull-request v5 composite
docker/Dockerfile docker
  • ${BASE_IMAGE} latest build
  • base latest build