MINUIT from Python - Fitting like a boss

What is iminuit?

Interactive IPython-friendly mimizer based on SEAL Minuit.

(It’s included in the package, no need to install it separately.)

iminuit is designed from ground up to be fast, interactive and cython friendly. iminuit extract function signature very permissively starting from checking func_code down to last resort of parsing docstring (or you could tell iminuit to stop looking and take your answer). The interface is inspired heavily by PyMinuit and the status printout is inspired by ROOT Minuit. iminuit is mostly compatible with PyMinuit (with few exceptions). Existing PyMinuit code can be ported to iminuit by just changing the import statement.

In a nutshell

from iminuit import Minuit
def f(x, y, z):
    return (x - 2) ** 2 + (y - 3) ** 2 + (z - 4) ** 2
m = Minuit(f)
print(m.values)  # {'x': 2,'y': 3,'z': 4}
print(m.errors)  # {'x': 1,'y': 1,'z': 1}

If you are interested in fitting a curve or distribution, take a look at probfit.


All the tutorials are in tutorial directory. You can view them online too:

Technical Stuff

Using it as a black box is a bad idea. Here are some fun reads; the order is given by the order I think you should read.

You can help

Github allows you to contribute to this project very easily just fork the repository, make changes and submit a pull request.

Here’s the list of concrete open issues and feature requests:

More generally any contribution to the docs, tests and package itself is welcome!

  • Documentation. Tell us what’s missing, what’s incorrect or misleading.
  • Tests. If you have an example that shows a bug or problem, please file an issue!
  • Performance. If you are a C/cython/python hacker go ahead and make it faster.


iminuit was created by Piti Ongmongkolkul (@piti118). It is a logical successor of pyminuit/pyminuit2, created by Jim Pivarski (@jpivarski).


  • Piti Ongmongkolkul (@piti118)
  • Chih-hsiang Cheng (@gitcheng)
  • Christoph Deil (@cdeil)
  • Hans Dembinski (@HDembinski)


  • Jim Pivarski (@jpivarski)
  • David Men’endez Hurtado (@Dapid)
  • Chris Burr (@chrisburr)
  • Andrew ZP Smith (@energynumbers)
  • Fabian Rost (@fabianrost84)
  • Alex Pearce (@alexpearce)
  • Lukas Geiger (@lgeiger)
  • Omar Zapata (@omazapa)