All Projects → scikit-hep → pylhe

scikit-hep / pylhe

Licence: Apache-2.0 license
Lightweight Python interface to read Les Houches Event (LHE) files

Programming Languages

python
139335 projects - #7 most used programming language
Dockerfile
14818 projects

Projects that are alternatives of or similar to pylhe

particle
Package to deal with particles, the PDG particle data table, PDGIDs, etc.
Stars: ✭ 113 (+289.66%)
Mutual labels:  hep, particle-physics, scikit-hep
decaylanguage
Package to parse decay files, describe and convert particle decays between digital representations.
Stars: ✭ 34 (+17.24%)
Mutual labels:  hep, particle-physics, scikit-hep
ml-lpi
Materials for ML course at Lebedev Physical Institute
Stars: ✭ 31 (+6.9%)
Mutual labels:  hep, particle-physics
Corpuscles.jl
Julia package for particle physics
Stars: ✭ 25 (-13.79%)
Mutual labels:  hep, particle-physics
LatticeQCD.jl
A native Julia code for lattice QCD with dynamical fermions in 4 dimension.
Stars: ✭ 85 (+193.1%)
Mutual labels:  hep, particle-physics
numpythia
The interface between PYTHIA and NumPy
Stars: ✭ 33 (+13.79%)
Mutual labels:  hep, scikit-hep
alice-rs
Analyze the public data from the CERN base ALICE collaboration with Rust
Stars: ✭ 81 (+179.31%)
Mutual labels:  hep, particle-physics
UnROOT.jl
Native Julia I/O package to work with CERN ROOT files
Stars: ✭ 52 (+79.31%)
Mutual labels:  hep, particle-physics
root pandas
A Python module for conveniently loading/saving ROOT files as pandas DataFrames
Stars: ✭ 108 (+272.41%)
Mutual labels:  hep, scikit-hep
pyjet
The interface between FastJet and NumPy
Stars: ✭ 31 (+6.9%)
Mutual labels:  hep, scikit-hep
Delphes
A framework for fast simulation of a generic collider experiment
Stars: ✭ 70 (+141.38%)
Mutual labels:  hep
Uproot4
ROOT I/O in pure Python and NumPy.
Stars: ✭ 80 (+175.86%)
Mutual labels:  hep
Rootpy
A pythonic interface for the ROOT libraries on top of the PyROOT bindings.
Stars: ✭ 186 (+541.38%)
Mutual labels:  hep
Aliphysics
ALICE Analysis Repository
Stars: ✭ 61 (+110.34%)
Mutual labels:  hep
Pyhf
pure-Python HistFactory implementation with tensors and autodiff
Stars: ✭ 171 (+489.66%)
Mutual labels:  hep
Flavio
A Python package for flavour physics phenomenology in the Standard model and beyond
Stars: ✭ 49 (+68.97%)
Mutual labels:  hep
Homer7 Docker
HOMER 7 Docker Images
Stars: ✭ 47 (+62.07%)
Mutual labels:  hep
Fitsio
fitsio is a pure-Go package to read and write `FITS` files
Stars: ✭ 40 (+37.93%)
Mutual labels:  hep
Statistics-Notes
Personal notes on statistics with a focus on applications to experimental high energy physics
Stars: ✭ 19 (-34.48%)
Mutual labels:  hep
Unity DataVisualization
This is a collection of Unity Particle System for data visualization
Stars: ✭ 22 (-24.14%)
Mutual labels:  particle-physics

pylhe: Python LHE interface

GitHub Project DOI Scikit-HEP

PyPI 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 external dependencies of Graphviz and LaTeX.

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)

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.4.0}",
  version = {v0.4.0},
  doi = {10.5281/zenodo.1217031},
  url = {https://github.com/scikit-hep/pylhe},
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].