Skip to main content

small package to get structured data out of Les Houches Event files

Project description

pylhe: Python LHE interface

pylhe logo

GitHub Project DOI Scikit-HEP

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

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.

import itertools

# You can use LHE files from scikit-hep-testdata
from skhep_testdata import data_path

import pylhe

lhe_file = data_path("pylhe-testlhef3.lhe")
events = pylhe.read_lhe_with_attributes(lhe_file)
print(f"Number of events: {pylhe.read_num_events(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)

Citation

The preferred BibTeX entry for citation of pylhe is

@software{pylhe,
  author = {Lukas Heinrich and Matthew Feickert and Eduardo Rodrigues},
  title = "{pylhe: v0.6.0}",
  version = {v0.6.0},
  doi = {10.5281/zenodo.1217031},
  url = {https://github.com/scikit-hep/pylhe},
}

Contributors

We hereby acknowledge the contributors that made this project possible (emoji key):

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

💻

This project follows the all-contributors specification.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pylhe-0.6.0.tar.gz (14.3 kB view details)

Uploaded Source

Built Distribution

pylhe-0.6.0-py3-none-any.whl (12.0 kB view details)

Uploaded Python 3

File details

Details for the file pylhe-0.6.0.tar.gz.

File metadata

  • Download URL: pylhe-0.6.0.tar.gz
  • Upload date:
  • Size: 14.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.3

File hashes

Hashes for pylhe-0.6.0.tar.gz
Algorithm Hash digest
SHA256 77a6500fd259d4c801775dba8cef52d60cc30d308ec69ce5d2ff56de8241d5ed
MD5 cc7a67b9da1e11920e87ed65318eb972
BLAKE2b-256 bc1cb1360d3e8140135dee372e98badd0021379ebeefb67085e2cc71b519bf9d

See more details on using hashes here.

File details

Details for the file pylhe-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: pylhe-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 12.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.3

File hashes

Hashes for pylhe-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 466c2752b906f6f37e3fd77c1ceb79478b76401f7d2085cd1071d36121e95834
MD5 ec2e66dddaaa4afbae65206b35c03e8e
BLAKE2b-256 e76fdbe0b5199016ea65f151078561399661d7c5a884d3d2c13aee19468a3b00

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page