PyFeyn is hosted by Hepforge, IPPP Durham


PyFeyn is a Python-language based system for drawing Feynman diagrams. It was inspired by the C++ FeynDiagram system, and aims to provide the same functionality and quality of output as that, with the added benefits of a modern interpreted language, an improved interface and output direct to both EPS and PDF. Behind the scenes, PyFeyn uses the excellent PyX system - you can use PyX constructs in PyFeyn diagrams if you want, too.


There are a range of demonstrations of PyFeyn's capabilities on the examples page.

Getting PyFeyn

Our first stable release has finally happened! The current PyFeyn version is 1.0.0 and is compatible with both Python 2 and Python 3 (required for recent versions of PyX). You can get it from the HepForge downloads area as a source tarball. You can also use the Python "easy install" system - see the PyFeyn entry on PyPI. Or you can check it out directly from HepForge Subversion if you fancy following the bleeding edge releases.

Please see the installation guide page for installation instructions if you're unfamiliar with installing Python packages. Note that PyFeyn depends on PyX as its rendering back-end, so you'll need to have PyX installed before PyFeyn will work.

Using PyFeyn

PyFeyn is used primarily as a Python package, i.e. a class library of useful object types and operations for drawing diagrams. Thanks to Georg von Hippel's work on our FeynML interface, we also have a command line program called mkfeyndiag which will build diagrams direct from FeynML XML files without having to write any Python at all.

There's currently no "proper" manual, but there is automatically generated code documentation which should hopefully be enough to work as a library reference. A more amenable introduction may be to have a look at the gallery examples to get a feel for how it works - hopefully these are fairly self-explanatory, please let us know by email (to if you get confused.

A few things that might not be so obvious are the options, which can be set via command line switches: any Python script that uses PyFeyn can add the PyFeyn options to its option parser by using the optparse standard module and the pyfeyn.config module. In particular, for examples with lots of cut-out line crossings, such as 3D gluons, gluinos etc., you may want to make use of the "draft mode" -d switch when not building the final version — this will speed things up no end.

Lastly, have fun: it was (mostly) fun to write!

PyFeyn is written by Andy Buckley, Georg von Hippel and George S. Williams.