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.3.tar.gz (437.8 kB view details)

Uploaded Source

Built Distributions

iminuit-2.21.3-cp311-cp311-win_amd64.whl (331.7 kB view details)

Uploaded CPython 3.11 Windows x86-64

iminuit-2.21.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (382.1 kB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

iminuit-2.21.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (354.7 kB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ ARM64

iminuit-2.21.3-cp311-cp311-macosx_10_9_universal2.whl (632.5 kB view details)

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

iminuit-2.21.3-cp310-cp310-win_amd64.whl (331.5 kB view details)

Uploaded CPython 3.10 Windows x86-64

iminuit-2.21.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (382.1 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

iminuit-2.21.3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (354.7 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ ARM64

iminuit-2.21.3-cp310-cp310-macosx_10_9_universal2.whl (632.5 kB view details)

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

iminuit-2.21.3-cp39-cp39-win_amd64.whl (331.6 kB view details)

Uploaded CPython 3.9 Windows x86-64

iminuit-2.21.3-cp39-cp39-win32.whl (288.0 kB view details)

Uploaded CPython 3.9 Windows x86

iminuit-2.21.3-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (354.9 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ ARM64

iminuit-2.21.3-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (353.5 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.12+ x86-64

iminuit-2.21.3-cp39-cp39-manylinux_2_12_i686.manylinux2010_i686.whl (366.9 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.12+ i686

iminuit-2.21.3-cp39-cp39-macosx_10_9_universal2.whl (632.7 kB view details)

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

iminuit-2.21.3-cp38-cp38-win_amd64.whl (331.7 kB view details)

Uploaded CPython 3.8 Windows x86-64

iminuit-2.21.3-cp38-cp38-win32.whl (288.0 kB view details)

Uploaded CPython 3.8 Windows x86

iminuit-2.21.3-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (354.8 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ ARM64

iminuit-2.21.3-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (353.3 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.12+ x86-64

iminuit-2.21.3-cp38-cp38-manylinux_2_12_i686.manylinux2010_i686.whl (366.6 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.12+ i686

iminuit-2.21.3-cp38-cp38-macosx_10_9_universal2.whl (632.8 kB view details)

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

File details

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

File metadata

  • Download URL: iminuit-2.21.3.tar.gz
  • Upload date:
  • Size: 437.8 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.3.tar.gz
Algorithm Hash digest
SHA256 fb313f0cc27e221b9b221bcd779b3a668fb4c77b0f90abfd5336833ecbdac016
MD5 3b9bdd51d530ba63b5067f94107061af
BLAKE2b-256 be95a2888ba5fdcea6736370ad2aa988d3c471daf6287bca534897c5c72351d3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: iminuit-2.21.3-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 331.7 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.3-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 45862cb1a33e503ccdba143f59b19b2cf1d67c9f9366238594543c54a352522e
MD5 cc643c28c82dbf9ddd9748a20cc93f52
BLAKE2b-256 fb221b36c94ef343a61bd9aef7bb02fcfdf78d122b538fd7d96782cc18dda654

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for iminuit-2.21.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1b4a16912b36408a83c8d82f287d422a00e73b040423e0dc6b51d88f3d1b7cab
MD5 58451c0c904ea21ffcacd7917ff0581f
BLAKE2b-256 062135bde50db2c09f8a6c2c7580a6f6157eca99c59873f9d832aad37047f618

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for iminuit-2.21.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f208d435209bef184107e9b6cc556a7ed0f90fdacd5e516bdb943f2a460fbbba
MD5 107940e6dc7989e0783232f29101ad3c
BLAKE2b-256 f634a4bf60c47a0230e4fd7c2a020402fd961057212d8b584ff4b631edf4d881

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for iminuit-2.21.3-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 9cd8d93e2028501f2f0d06cd08408578552bfa367769f88f69dad440d0ae17f3
MD5 5eccc6aae7bebc4e878053f3b8990c4e
BLAKE2b-256 1b9524c20a16b1a9b7abc3c48d36901f56cbf89eeda470359a51c0afaf7c5bd8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: iminuit-2.21.3-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 331.5 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.3-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 671d8a95a245529068a021a05ea0d215a82ce159ee938f7afc9776a3341cf370
MD5 b8f598088988615be7944a89ec0b5332
BLAKE2b-256 56bca40c027cc97774ab7ee494e3dd82b7d5161094b7df93e0eb04bcf202415f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for iminuit-2.21.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c7f84db2ee7250a464bcd39838d761371f5c096e39240100413b2377c07e1555
MD5 b04bb6322cb3e6f784687566209eefa4
BLAKE2b-256 57c28b5ad009c0187eda8fc0a7e26867fb1d53a50ec6b018bd4dec4eac7e91d9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for iminuit-2.21.3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 0def0580df4809358b5a2a11c825851e79f290f8ba1bfb471d71c0dbee8ef2fa
MD5 11a74bc16da9130530ad4c8529316d1a
BLAKE2b-256 8f72346d342de19a6b1269f18d51deae3c816009c0c6fa58fd78bbbd8505ea32

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for iminuit-2.21.3-cp310-cp310-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 bd96ad4d67fe652a40c2160721499fa6d11cb9422946cd770def328ae8459e4c
MD5 bff4c360da7e50e428c397cb05d88efb
BLAKE2b-256 96e2b5dafc7fca8d90952bc310f29b469bb1e71b4d6b41d129d58eeaa48eda13

See more details on using hashes here.

File details

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

File metadata

  • Download URL: iminuit-2.21.3-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 331.6 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.3-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 4c01d1c35b1817ec1077fa7260fd7a77b56440b4bc194414f78e7df0417d5713
MD5 6815ee99f9d77473717c42873009ac51
BLAKE2b-256 9b1e092e21dcf0a4bd88cacf67ba3b64e67790cc8597a034c43b49b80d74cb5c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: iminuit-2.21.3-cp39-cp39-win32.whl
  • Upload date:
  • Size: 288.0 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.3-cp39-cp39-win32.whl
Algorithm Hash digest
SHA256 d5dde2fe22b7d99425313c541495c9597c91b2f460ac72cd037ae378253ca060
MD5 32366a69df59c473eadb62f633e98251
BLAKE2b-256 9a6ff487d956d8c873a8411f1c924c422b1dadee381e839a8927a6ede36314f7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for iminuit-2.21.3-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 edcd764d181bffd96ce43f4e0abdbd8b6168fa947f3ac655945efbea6626b0e8
MD5 bc68fa1e2a09ff20c0c855fcbc1449d4
BLAKE2b-256 edc1b8cd4ed1f5bcb3c6af2991b36b049e3b61180eedf7d8ca8b9932d50c57a8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for iminuit-2.21.3-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 c3d2c90f60d8915a73be063a1ebb4514fc7a4b5f145a6736307ed352ede5f7b0
MD5 0803a1dbccd8e325ab383e9ac8c4a809
BLAKE2b-256 f80ae486c98d464661eb754b111b541b678fc780e87f9fc796bd9e0d6defc542

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for iminuit-2.21.3-cp39-cp39-manylinux_2_12_i686.manylinux2010_i686.whl
Algorithm Hash digest
SHA256 7a39c6186497264bb75e64876e5995bced78c19e13174d5bc24008dd4975d4b1
MD5 2069c4c533ad5e2f38c00324e56fe54c
BLAKE2b-256 9e926aadb988d89daa183d4345ae8015368dcf2403a6932d96752fe496e8963e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for iminuit-2.21.3-cp39-cp39-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 e572b96fb65eda8b14d77d3bc366c77dcae1da252b0a5bac2f6c5dd78b676aa2
MD5 fe2733999a369c3955da1abfbbf2cc48
BLAKE2b-256 86f59963a1c5d57e7dc4863083d9d9e57956a9822e00aad5c88cd45447f34208

See more details on using hashes here.

File details

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

File metadata

  • Download URL: iminuit-2.21.3-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 331.7 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.3-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 325a9b842a76473e7cc6a3f03c9e4295300c7b669a7d28cadf3537f81a9e1005
MD5 7fd5226b08b9a08a006870b263d914f3
BLAKE2b-256 ad23008ba529b50dc9f2bd86d1dc1fc1e729ba37bcbb89f254071e0d3fdd3c1d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: iminuit-2.21.3-cp38-cp38-win32.whl
  • Upload date:
  • Size: 288.0 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.3-cp38-cp38-win32.whl
Algorithm Hash digest
SHA256 dd1946a5ba5cf45f9efda05789023a573df993b6ead8b1d5c3a4f1a6969b65ee
MD5 e7d40223fa04fba2dd47482bf3c0b060
BLAKE2b-256 196e012d38fafecb3d41f94688d744a7017f53713a9a8ab2976c5164e0ea1344

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for iminuit-2.21.3-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 83ea359d6c6eec17bfdcd218ccf2188fef6e335b80f6db4b6a68906d02b8cf0f
MD5 9fdeae7df24bcd45eeb7edd7196ec08d
BLAKE2b-256 2a26c07333c5f3487d1c3a1b7c203e70feb863ddbdd3d8b995c0640a1175487b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for iminuit-2.21.3-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 197e9d19a3587fc3a0a8a2ef9a5813a40709d7871106ba22f13b71f902d228e8
MD5 d4e6f5e51d35f302c4b66d7a5c1ad352
BLAKE2b-256 913a872600443004bee0a7ef0d3a69251e058e4e32b6862414d7a80c6fe4c56e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for iminuit-2.21.3-cp38-cp38-manylinux_2_12_i686.manylinux2010_i686.whl
Algorithm Hash digest
SHA256 8a019b73bc1e6255e241fdd089a5831749f75490bb468ed39b8c74ea91c54da2
MD5 938a7f4e5c69a197494abbb96e7e2a32
BLAKE2b-256 f6480257a8de395efbfd9c1188da1d9540aee3783605ab8ce797b2ac251aafe5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for iminuit-2.21.3-cp38-cp38-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 ebec374b0c2b3f94aef12227c3e3c1c66b5b444ce1c78d7db35dd2edec5666fe
MD5 af6c4c225b66d3492d77f5fc55e2e9e0
BLAKE2b-256 1d946a3d8bea2a03ea0b7c6ec3087988dd59c445fd238ed3713a09da88f6cc19

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