Skip to main content

Jupyter-friendly Python frontend for MINUIT2 in C++

Project description

https://scikit-hep.org/assets/images/Scikit--HEP-Project-blue.svg https://img.shields.io/pypi/v/iminuit.svg https://img.shields.io/conda/vn/conda-forge/iminuit.svg https://coveralls.io/repos/github/scikit-hep/iminuit/badge.svg?branch=develop https://readthedocs.org/projects/iminuit/badge/?version=latest https://zenodo.org/badge/DOI/10.5281/zenodo.3949207.svg ascl:2108.024 https://img.shields.io/gitter/room/Scikit-HEP/iminuit https://mybinder.org/badge_logo.svg

iminuit is a Jupyter-friendly Python interface for the Minuit2 C++ library maintained by CERN’s ROOT team.

Minuit was designed to minimise statistical cost functions, for likelihood and least-squares fits of parametric models to data. It provides the best-fit parameters and error estimates from likelihood profile analysis.

  • Supported CPython versions: 3.6+

  • Supported PyPy versions: 3.6+

  • Supported platforms: Linux, OSX and Windows.

The iminuit package comes with additional features:

  • Builtin cost functions for statistical fits

    • Binned and unbinned maximum-likelihood

    • Non-linear regression with (optionally robust) weighted least-squares

    • Gaussian penalty terms

    • Cost functions can be combined by adding them: total_cost = cost_1 + cost_2

  • Support for SciPy minimisers as alternatives to Minuit’s Migrad algorithm (optional)

  • Support for Numba accelerated functions (optional)

Documentation

Checkout our large and comprehensive list of tutorials that take you all the way from beginner to power user. For help and how-to questions, please use the discussions on GitHub or gitter.

Lecture by Glen Cowan

In the exercises to his lecture for the KMISchool 2022, Glen Cowan shows how to solve statistical problems in Python with iminuit. You can find the lectures and exercises on the Github page, which covers both frequentist and Bayesian methods.

Glen Cowan is a known for his papers and international lectures on statistics in particle physics, as a member of the Particle Data Group, and as author of the popular book Statistical Data Analysis.

In a nutshell

iminuit is intended to be used with a user-provided negative log-likelihood function or least-squares function. Standard functions are included in iminuit.cost, so you don’t have to write them yourself. The following example shows how iminuit is used with a dummy least-squares function.

from iminuit import Minuit

def cost_function(x, y, z):
    return (x - 2) ** 2 + (y - 3) ** 2 + (z - 4) ** 2

m = Minuit(cost_function, x=0, y=0, z=0)

m.migrad()  # run optimiser
m.hesse()   # run covariance estimator

print(m.values)  # x: 2, y: 3, z: 4
print(m.errors)  # x: 1, y: 1, z: 1

Interactive fitting

iminuit optionally supports an interactive fitting mode in Jupyter notebooks.

Animated demo of an interactive fit in a Jupyter notebook

Partner projects

  • boost-histogram from Scikit-HEP provides fast generalized histograms that you can use with the builtin cost functions.

  • numba_stats provides faster implementations of probability density functions than scipy, and a few specific ones used in particle physics that are not in scipy.

  • jacobi provides a robust, fast, and accurate calculation of the Jacobi matrix of any transformation function and building a function for generic error propagation.

Versions

The current 2.x series has introduced breaking interfaces changes with respect to the 1.x series.

All interface changes are documented in the changelog with recommendations how to upgrade. To keep existing scripts running, pin your major iminuit version to <2, i.e. pip install 'iminuit<2' installs the 1.x series.

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

iminuit-2.21.2.tar.gz (437.3 kB view details)

Uploaded Source

Built Distributions

iminuit-2.21.2-cp311-cp311-win_amd64.whl (331.3 kB view details)

Uploaded CPython 3.11 Windows x86-64

iminuit-2.21.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (381.8 kB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

iminuit-2.21.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (354.4 kB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ ARM64

iminuit-2.21.2-cp311-cp311-macosx_10_9_universal2.whl (632.2 kB view details)

Uploaded CPython 3.11 macOS 10.9+ universal2 (ARM64, x86-64)

iminuit-2.21.2-cp310-cp310-win_amd64.whl (331.2 kB view details)

Uploaded CPython 3.10 Windows x86-64

iminuit-2.21.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (381.8 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

iminuit-2.21.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (354.4 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ ARM64

iminuit-2.21.2-cp310-cp310-macosx_10_9_universal2.whl (632.1 kB view details)

Uploaded CPython 3.10 macOS 10.9+ universal2 (ARM64, x86-64)

iminuit-2.21.2-cp39-cp39-win_amd64.whl (331.3 kB view details)

Uploaded CPython 3.9 Windows x86-64

iminuit-2.21.2-cp39-cp39-win32.whl (287.6 kB view details)

Uploaded CPython 3.9 Windows x86

iminuit-2.21.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (354.6 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ ARM64

iminuit-2.21.2-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (353.2 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.12+ x86-64

iminuit-2.21.2-cp39-cp39-manylinux_2_12_i686.manylinux2010_i686.whl (366.6 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.12+ i686

iminuit-2.21.2-cp39-cp39-macosx_10_9_universal2.whl (632.4 kB view details)

Uploaded CPython 3.9 macOS 10.9+ universal2 (ARM64, x86-64)

iminuit-2.21.2-cp38-cp38-win_amd64.whl (331.4 kB view details)

Uploaded CPython 3.8 Windows x86-64

iminuit-2.21.2-cp38-cp38-win32.whl (287.7 kB view details)

Uploaded CPython 3.8 Windows x86

iminuit-2.21.2-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (354.5 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ ARM64

iminuit-2.21.2-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (353.0 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.12+ x86-64

iminuit-2.21.2-cp38-cp38-manylinux_2_12_i686.manylinux2010_i686.whl (366.3 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.12+ i686

iminuit-2.21.2-cp38-cp38-macosx_10_9_universal2.whl (632.5 kB view details)

Uploaded CPython 3.8 macOS 10.9+ universal2 (ARM64, x86-64)

File details

Details for the file iminuit-2.21.2.tar.gz.

File metadata

  • Download URL: iminuit-2.21.2.tar.gz
  • Upload date:
  • Size: 437.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.2

File hashes

Hashes for iminuit-2.21.2.tar.gz
Algorithm Hash digest
SHA256 449b738f21e3d57510b3c786eefc867ba03a78e94351e0a05450f8db4c034a74
MD5 1bb9ca88335e5f3b481ee5049280dc54
BLAKE2b-256 e51b6975bc5348c86b9f4e67783f5a8c24ebc2e184b755ecf16c3e00cc5a7b97

See more details on using hashes here.

File details

Details for the file iminuit-2.21.2-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: iminuit-2.21.2-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 331.3 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.2

File hashes

Hashes for iminuit-2.21.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 411e6f37599822c61f2c91cc1ae4842b588fc14ede615cab712ccd556007bf15
MD5 cd0f0a2a6669a64bed0f483ff0dac469
BLAKE2b-256 254a8faa19b53dcd9cc1272f9f3337099ff918188dde4b26bbfa5e005317277f

See more details on using hashes here.

File details

Details for the file iminuit-2.21.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for iminuit-2.21.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b54e5ce77b7e62849fab60b340bacc4107ea3c2c02b5a5fb96407ada64f6c961
MD5 be243b96010204f0969c96d50808a184
BLAKE2b-256 64b7566746b5dffe5c196acdbca7d6006121c92d01631f635431ea23721b0cd6

See more details on using hashes here.

File details

Details for the file iminuit-2.21.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for iminuit-2.21.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 c61d53d97d812fc92ac1a96ba50df2f4081c6021c5becd0693ef34976bcb526a
MD5 21bd99621a4236fe12bf540b356c004a
BLAKE2b-256 eb700f1124968cccefc03db1e90162149111345466b05f562dd21fdbf7332dfe

See more details on using hashes here.

File details

Details for the file iminuit-2.21.2-cp311-cp311-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for iminuit-2.21.2-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 60b8db6ff9d59b098b5db5f7945885fdce9c7e049471fc5165df24f1ad5dfc9c
MD5 5848acf9b9fedf96781b6f7a2785e8dd
BLAKE2b-256 0f5ae044f84aa04259b1f51862795e019a9dd85db6bf6c1145e08963ae587093

See more details on using hashes here.

File details

Details for the file iminuit-2.21.2-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: iminuit-2.21.2-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 331.2 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.2

File hashes

Hashes for iminuit-2.21.2-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 fa7947a2172aa128bb7c0edfd53e095ca774ac6e12327c3a37771bbef663c54a
MD5 c6d6d32c77b7b70a7e56d4f70f13e931
BLAKE2b-256 70119fecd0e25fd659585a8f07fa3fb684f15b4aca529f19b3191ec27e3966f2

See more details on using hashes here.

File details

Details for the file iminuit-2.21.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for iminuit-2.21.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 43913be5324a18da4787ca0920401d31cb2a47811eb66481601110082bdd9b74
MD5 58566ae3f9f3fb0a803e4fd89006cd9e
BLAKE2b-256 085c121da9ac7a52c3ccc8e22d65652cdb68fcfd1b8e87d462a2d7115d479d90

See more details on using hashes here.

File details

Details for the file iminuit-2.21.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for iminuit-2.21.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 98e00cc0e0da60a595ea897f6463fbfbe4a99cd8479ee0bde60cdfd5de1e8c62
MD5 470289f2ed215674dc67c0ed8697b488
BLAKE2b-256 40f03f85d4fe883e600c77fb49cbaf388b41e6204db657e320261b7c0d3d1639

See more details on using hashes here.

File details

Details for the file iminuit-2.21.2-cp310-cp310-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for iminuit-2.21.2-cp310-cp310-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 2a7bf97cf68472d33d832b2d332c5458356d732e00767ab25bece119ef4bafe1
MD5 df421c6125c07f009ed49b0561edc321
BLAKE2b-256 92a19f5dcf21c2669b7c93ecb75a6776a3098ede677d07276717b87ace651bd8

See more details on using hashes here.

File details

Details for the file iminuit-2.21.2-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: iminuit-2.21.2-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 331.3 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.2

File hashes

Hashes for iminuit-2.21.2-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 3197393f1ec757e2aa83aa44341824efa8df564db8783fda26b9baf3ee09ffc8
MD5 f11aa4cec19217651b25dbef6f0577de
BLAKE2b-256 ab89f156ff427150d041fe1e3272d6fec41fddc0d13dfbb9e76930ea0eaa544f

See more details on using hashes here.

File details

Details for the file iminuit-2.21.2-cp39-cp39-win32.whl.

File metadata

  • Download URL: iminuit-2.21.2-cp39-cp39-win32.whl
  • Upload date:
  • Size: 287.6 kB
  • Tags: CPython 3.9, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.2

File hashes

Hashes for iminuit-2.21.2-cp39-cp39-win32.whl
Algorithm Hash digest
SHA256 d6e7f9f50cc88b0697dffa9253f22e94a08f5729e9f3318e0613d5a21327958d
MD5 37606a0cbfd81f73188fa9f486c495ee
BLAKE2b-256 d5029f2d9c9bd8b38607450bca48bb47a2ec0be6d1493b3b0247a56b0d3997e5

See more details on using hashes here.

File details

Details for the file iminuit-2.21.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for iminuit-2.21.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 2cc28c7911edf331273ecc4ea5022422c2e8737366df37df9b435b0067c11b85
MD5 d9290cbcdc8d1319643456f91b914654
BLAKE2b-256 ed0008b70258395e6574d6c46d23fdd358905f3852dd974b4ea2e8270c304050

See more details on using hashes here.

File details

Details for the file iminuit-2.21.2-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for iminuit-2.21.2-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 ebdfeef5e398cc4be7a71619f139f4239fc09d4c38d714441a6cfa2ae220448a
MD5 86fd981b9d55989b0f494a5323b627c6
BLAKE2b-256 c8b56e82e669d9fcea36061c4f3cf39f7ac60aa10b2d1321685922bc4dd5deb3

See more details on using hashes here.

File details

Details for the file iminuit-2.21.2-cp39-cp39-manylinux_2_12_i686.manylinux2010_i686.whl.

File metadata

File hashes

Hashes for iminuit-2.21.2-cp39-cp39-manylinux_2_12_i686.manylinux2010_i686.whl
Algorithm Hash digest
SHA256 5909671e43ba18bbdea85edee7a736192dff432346ce9f941e776a196b7efddc
MD5 5e7dd5c3aed8c24a6b5279d5ccde5a97
BLAKE2b-256 043b8e4b02a378c67ce90745ff83ad97bc61ed6e0c5c3ae9a4ae7a4a07646c9d

See more details on using hashes here.

File details

Details for the file iminuit-2.21.2-cp39-cp39-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for iminuit-2.21.2-cp39-cp39-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 4b7c0593379cd77d4565b819067bd0f03946ea9b0b19e807416fcd40bdad904c
MD5 85ce26428b69e5d7490ed4524f0f15ba
BLAKE2b-256 b21f90845803bf6805f7aa8f4fdd239e50f707c8c161c7d92dbd474004f5513d

See more details on using hashes here.

File details

Details for the file iminuit-2.21.2-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: iminuit-2.21.2-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 331.4 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.2

File hashes

Hashes for iminuit-2.21.2-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 2f89fb7d2253493d64392048173f442324d2fa1ec17aa7388208fcfe788eb75d
MD5 8de1b540b508ab5160c8a3ba2d674ce5
BLAKE2b-256 dd8d654c182c67de54f098d489b4fcf636ec42f78225c918fa7c2528179ea6d6

See more details on using hashes here.

File details

Details for the file iminuit-2.21.2-cp38-cp38-win32.whl.

File metadata

  • Download URL: iminuit-2.21.2-cp38-cp38-win32.whl
  • Upload date:
  • Size: 287.7 kB
  • Tags: CPython 3.8, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.2

File hashes

Hashes for iminuit-2.21.2-cp38-cp38-win32.whl
Algorithm Hash digest
SHA256 184a3fe472080f997ae2bd30b9158e52a1279a72903dc16078484aae422a9ed0
MD5 b1688cba2bfac9f300913e6c4e6a1079
BLAKE2b-256 561fe87a07cb84e4a2f0544e8f6268d30f38080c777aa866710845f4f04f7a35

See more details on using hashes here.

File details

Details for the file iminuit-2.21.2-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for iminuit-2.21.2-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b297b56b94918ec8bcc7a761722d3a86c7f37bd346aebc4ae30685a489d58e12
MD5 1d70d18a69515a54b3d2661d26cbdc71
BLAKE2b-256 303659c990f5028c2b462de354619dbf7928ce672d0928f841c3b1045a971528

See more details on using hashes here.

File details

Details for the file iminuit-2.21.2-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for iminuit-2.21.2-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 31abb89b3578a104f0a901469485016872cdd83046638bfa2f30fba61765de8e
MD5 756c996b3b837f7180fccf670159e584
BLAKE2b-256 8fb06a801763786a735acd89df31257c2ca182c449153815a9d5558348282590

See more details on using hashes here.

File details

Details for the file iminuit-2.21.2-cp38-cp38-manylinux_2_12_i686.manylinux2010_i686.whl.

File metadata

File hashes

Hashes for iminuit-2.21.2-cp38-cp38-manylinux_2_12_i686.manylinux2010_i686.whl
Algorithm Hash digest
SHA256 24fb8c142df75597b69963f166fd733b33c662fbc44b98a1c4292b258ed6c527
MD5 a23bac0a5905610beacf3b05bc096e4c
BLAKE2b-256 f807964f145f5ad1ecfb81dd3c217ec5f327d171bf2b85024e7dc400b62ebee9

See more details on using hashes here.

File details

Details for the file iminuit-2.21.2-cp38-cp38-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for iminuit-2.21.2-cp38-cp38-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 c06586b84004a719d400427ebac0a220c76a392204d0d2558b9d77629a49bd0a
MD5 630c142ced220c11b105302b8092fa8f
BLAKE2b-256 8c36a104d7e30d9399a07b17648696430ae5ba56e48dda640be58bb5faef9eb7

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page