一个用于从Les Houches事件文件中获取结构化数据的小型包
项目描述
pylhe: Python LHE接口
轻量级的Python接口,用于读取Les Houches事件(LHE)文件
安装
要从PyPI安装pylhe,您可以这样做:
python -m pip install pylhe
可视化功能需要外部依赖项Graphviz。
开始使用
以下示例提供了一个简单的概述。完整功能可以通过pylhe模块提供的函数进行检查。
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)
引用
引用pylhe的首选BibTeX条目是
@software{pylhe,
author = {Lukas Heinrich and Matthew Feickert and Eduardo Rodrigues},
title = "{pylhe: v0.9.0}",
version = {v0.9.0},
doi = {10.5281/zenodo.1217031},
url = {https://github.com/scikit-hep/pylhe},
}
贡献者
我们在此感谢使此项目成为可能的贡献者(表情符号键)
此项目遵循所有贡献者规范。
项目详情
下载文件
下载适合您平台的文件。如果您不确定要选择哪个,请了解更多关于安装软件包的信息。
源代码发行版
pylhe-0.9.0.tar.gz (17.3 kB 查看哈希)
构建发行版
pylhe-0.9.0-py3-none-any.whl (13.4 kB 查看哈希)