Skip to main content

Next-generation Python interface to the HepMC3 C++ library

Project description

A Python wrapper for the HepMC3 C++ library.

Another wrapper is pyhepmc. Why should you use this one?

pyhepmc-ng is easy to install

The command pip install pyhepmc-ng just works! You only need a compiler that supports C++11, everything else is handled by pip.

Under the hood, the bindings are build with the excellent pybind11 library. External installations of pybind11 or HepMC3 are not required, pyhepmc-ng includes the lightweight source code of both libraries with the submodule feature of git.

pyhepmc-ng is actively developed

pyhepmc-ng is part of the Scikit-HEP project, which aims to provide all tools needed by particle physicists to do data analysis in Python. It is also gets official support from the HepMC3 project.

pyhepmc-ng is unit tested

Everything in pyhepmc-ng is unit tested.

pyhepmc-ng is Pythonic

pyhepmc-ng is a hand-crafted mapping of C++ code to Python. It supports Python idioms where appropriate.

  • C++ methods which act like properties are represented as properties, e.g. GenParticle::set_status and GenParticle::status are mapped to a single GenParticle.status field in Python
  • Tuples and lists are implicitly convertible to FourVectors
  • Vectors of objects on the C++ side are mapped to Python lists
  • ReaderAscii and WriterAscii support the context manager protocol
  • A convenient open function is provided for reading and writing HepMC files


pyhepmc-ng currently has no separate documentation, but it mirrors the C++ interface of the HepMC3 library, which is documented here:

Project details

Download files

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

Files for pyhepmc-ng, version 0.4.3
Filename, size File type Python version Upload date Hashes
Filename, size pyhepmc_ng-0.4.3.tar.gz (220.4 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page