A Python Software Framework for Amplitude/Partial-Wave Analyses


The PyPWA Project
Thomas Jefferson National Accelerator Facility
and Norfolk State University
Virginia, USA

Partially supported by NSF grants #1507208 and #1820235


Make (python) tools (numpy,scipy,pandas,pytables,...) easy available for amplitude analyses.

What is PyPWA?

A set of libraries written in python(numpy) and other scripts untilities for parametric modeling (simulation and fitting).

Where do I start?

(General Description)--->Installation--->Tutorials--->Documetation--->GitHub page


The PyPWA Project aims to develop a software framework that can be used to perform parametric model fitting to data. Examples (tutorials) are given for the Partial-Wave/Amplitude Analysis (PWA) of multiparticle final states in photoproduction experiments using linearly polarized photon beams. PyPWA extracts model parameters by performing fits to data. Tutorials (Step-by-step instructions) leading to a full fit of data, and the use of simulation are included. Most of the code is written in Python (numpy), but hybrid code (in Cyhon or Fortran) has been used when appropiate. The software of the library is very flexible, it can be organized in a diversity of ways to perform the basic tasks of fitting a pdf (probability-distribution-functions) to data, simulating distributions from a given pdf or "predicting "data" from a given pdf. Scripting to make easy use of GPUs is expected in the near future. The use of AI in amplitude analysis to the inclusin of python based frameworks (i.e. Tensorflow) are being explored for future inclusion. The PyPWA Project software expects to be in a continous flow (of improvements!), therefore, please check on the more recent software download version.

Release v4.00 - 2022-9-26

This includes some important changes due to iMinuit changes, PyTorch and GPU use. (New TUTORIALS are being workout, some old tutorials might not work under v4.0)

Release v3.4.0 - 2021-7-23

This includes some minor fixes, depreciates some features, and includes MCMC.

Release v3.0.0 - 2020-6-4

Fast Installation

for ALL platforms (minus Windows)

You should have/install anaconda

> conda activate

> conda install -c markjonestx pypwa

We recommend to lunch "jupyter --ip=" to run the tutorials and test installation

See Installation for more possibilities`/details and Tutorials to download tutorials


ProjectDatabase has been added handle large data manipulation on disk instead of in memory.

Reader/Writer now share path of the file being operated on. Binning now works in both fixed count and ranges, and can be done entirely in memory. Initial Jupyter and IPython support. Adding lego plotting. Likelihoods are now standalone objects that can be combined with any optimizer. Resonance support now builtin using DataFrames as a backbone. Resonances are now saved as a two sheet excel file, and can be modified using the supplied wave and resonance objects. Adds support for Numexpr to accelerate computation. Simulation can be done as two separate parts through PyPWA.simulate Github Templates to help users and developers contribute to PyPWA Changed Separate release tag from version info Package info is now stored in PyPWA.info pydata has officially been updated to PyPWA 3.0. Structured Arrays have been replaces for Pandas DataFrames in some cases. Vectors still wrap regular numpy arrays to maintain performance. Reactions have been merged into ParticlePool. Vectors have been simplified to be easier to test while still being powerful to use. ProcessInterfaces now must be closed after use. This includes all Likelihood objects. Cache has been refactored to be easier to be completely usable by itself.


SlotTable has been removed in favor of Project. Both use PyTables for the backend. Unsupported Python versions removed from package's classifiers.


GAMP no longer claims that it can read PF files. Cache will correctly report invalid when it's contents differ from the source file. monte_carlo_simulation and likelihoods now correctly handle exceptions that occur in the child processes. Pipes are correctly closed now. Extended Log-likelihood is now correctly calculated Sv Writer will now write data. Kv Reader will now read data.

Pre-Release v3.0.0a1 (June 2019)


Added numpy reader and writer.

Adds a helper script to clean the project directory of caches.

Adds initial documentation for PyPWA.

Added support for 3 Vectors, 4 Vectors, and Particles

Added ParticlePool to aid in working with multiple Particles

Added a binning utility that supports multiple binning variables and dimensions

Added PyTables support, so that large datasets can be easily managed


All program names have been lowercased

Configuration package has been compressed into a single module

PySimulate now is a library that has no UI, and has a UI portion

that exclusively works with interfacing

Fuzzywuzzy is now optional

Process package is now a single module. Interface no longer uses IS_DUPLEX

Bulk of program functionality moved to libs, progs being just for UI

Builtin Plugins moved to libs, old plugin's plugins have still reside in plugins, but under a package with the appropriate name. I.E. data plugins are in plugins/data.

All file related libs have been moved to libs/file

Combined optimizers with fit library

GAMP was updated to use Particles and ParticlePool

Files with extra newline should parse correctly now CSV and TSV files will be lf instead of crlf on linux systems now

Removed Temporaly

Nestle Minimization. There is currently no clear way to have Minuit and Nestle to operate with each other nicely. Implementation for multiple optimizers will remain, as well as new associated issues created.

Removed support for all version of Python before 3.7

Release Version 2.2.0 (July 27, 2017)


Process Plugin support for List Data

Adds Exception handling to Processes

PyMask support for multiple masking files.

PyFit will now filter out events if the Bin value is 0

The user can AND, OR, or XOR masks together with PyMask


Removed previous_event from Process Interface

Duplex Pipes are used over Simplex Pipes for Duplex Processes

Changes get_file_length to using a binary buffered search.

Moved PyPWA.core.shared to PyPWA.libs

Split interface's plugins and internals to their own separate file based on the interfaces purpose.

PyFit no longer assumes bins are named 'BinN' you must specify Bin names in 'internal data'.

Multipler effect for the Miminzers has been moved to the individual likelihoods.

PyMask defaults to AND operations instead of or now.


PyFit will now shutdown correctly when killed with Ctrl-C or other interrupt.

The ChiSquared will no longer be multiplied by -1 when being minimized.

Data Parser's Cache would crash on very large files.

Release Version 2.0.0 (November 23, 2015)

Initial Beta Release!

This is the initial release of the PyPWA package using the multiprocessing module and setup tools for distribution. The package isn't a complete feature parity with the previous package, and until it is will remain in a beta state.


This package is beta, however the tools included should work faster than previous version though some functionality may not be included, if you find a bug please submit them to the bug tracker on GitHub with a trace-back and anything you can give us, the more information the easier we can reproduce it and fix it.


We attempted to make this as simple as possible, all you need is python and pip installed to you machine, and should work with Mac OS or Linux, or any system with Anaconda installed. All dependencies will be handled automatically for you, simply run:

pip install PyPWA-2.0.0b0.tar.gz

Tools included in this package are:




Setup tools for distribution so you can install the package as a normal program.

Yaml Configuration to be user friendly but still powerful

Multiprocessing intensities to get the most power from your hardware.

Sphinx documentation in the source.

Google Style inline documentation

Support for CSV Kinematic Variables

Bonus Note!

Isobar and all other tools that haven't been merged yet live on in PyPWA-limbo-v1.1-tar.gz these tools will function exactly the same way as they would have in the previous version. The tools are being merged over, and eventually when they are all in the Package properly we will release v2.0.0

Release Version 1.1 (June 22, 2015)

Version 1.1 includes several improvements, including the ability to reload the text files parsed in the General Shell, as well as a more general gampTranslator which allows for non-uniform white space in gamp files.

Bug fixes: Directory variable mistake in generalFitting is fixed.