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

Uploaded Source

Built Distributions

iminuit-2.20.0-cp311-cp311-win_amd64.whl (329.3 kB view details)

Uploaded CPython 3.11 Windows x86-64

iminuit-2.20.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (379.9 kB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

iminuit-2.20.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (352.4 kB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ ARM64

iminuit-2.20.0-cp311-cp311-macosx_10_9_universal2.whl (630.2 kB view details)

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

iminuit-2.20.0-cp310-cp310-win_amd64.whl (329.3 kB view details)

Uploaded CPython 3.10 Windows x86-64

iminuit-2.20.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (379.9 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

iminuit-2.20.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (352.4 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ ARM64

iminuit-2.20.0-cp310-cp310-macosx_10_9_universal2.whl (630.2 kB view details)

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

iminuit-2.20.0-cp39-cp39-win_amd64.whl (329.4 kB view details)

Uploaded CPython 3.9 Windows x86-64

iminuit-2.20.0-cp39-cp39-win32.whl (285.7 kB view details)

Uploaded CPython 3.9 Windows x86

iminuit-2.20.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (352.6 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ ARM64

iminuit-2.20.0-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (351.3 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.12+ x86-64

iminuit-2.20.0-cp39-cp39-manylinux_2_12_i686.manylinux2010_i686.whl (364.7 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.12+ i686

iminuit-2.20.0-cp39-cp39-macosx_10_9_universal2.whl (630.5 kB view details)

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

iminuit-2.20.0-cp38-cp38-win_amd64.whl (329.4 kB view details)

Uploaded CPython 3.8 Windows x86-64

iminuit-2.20.0-cp38-cp38-win32.whl (285.6 kB view details)

Uploaded CPython 3.8 Windows x86

iminuit-2.20.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (352.6 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ ARM64

iminuit-2.20.0-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (351.0 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.12+ x86-64

iminuit-2.20.0-cp38-cp38-manylinux_2_12_i686.manylinux2010_i686.whl (364.4 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.12+ i686

iminuit-2.20.0-cp38-cp38-macosx_10_9_universal2.whl (630.6 kB view details)

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

File details

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

File metadata

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

File hashes

Hashes for iminuit-2.20.0.tar.gz
Algorithm Hash digest
SHA256 a73fe6e02f35e3180fc01bc5c1794edf662ff1725c3bc2a4f433567799da7504
MD5 8e308f11866b1bd8fd35d58539a1da92
BLAKE2b-256 2246fe5ea079cf0d4bfec8c5d841578bbfa6a1e3550e71f529ac19a03fb9268a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: iminuit-2.20.0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 329.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.20.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 2bca7fd96326a330d2f94cebcfb567953525157001b619de7eb4be1089ba9a64
MD5 5637ebddd2757646d391ca6204e02f50
BLAKE2b-256 399e0a327a1de0da144954916faf19ecb35a592efbe736a5a682fdf6a602d7a5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for iminuit-2.20.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a1f728675b2c81a5a6f0a764a75f375043ca7f1edd276bcceb294be2c147e20f
MD5 774b418f8d81ec713f596eee39e264b5
BLAKE2b-256 d4609e679d256d8dcb4bbce52daddf81f722d75d7de1db0030201ca710dcb835

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for iminuit-2.20.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 2e86a13fd9437c6d8c0e6755c125cf260605cf5d727ee76b8746bedb2dd1468a
MD5 de2906496fee99fb8755cdca4e025aef
BLAKE2b-256 dbf0668e6bf6966ea4b4fc68f3e921cda1211decf13ef95d72723d6d99db0b57

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for iminuit-2.20.0-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 2db2a5d7f59354b33f6ce15d1e23bfec744a6bf3973cc017d7e40750bd9a203f
MD5 a50e855ff833be8c68f365b8a5264ba5
BLAKE2b-256 c8f9573f040a3a3948b639715fa6e2f81fe5b2253f95a6cae1bb4250c3c80426

See more details on using hashes here.

File details

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

File metadata

  • Download URL: iminuit-2.20.0-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 329.3 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.20.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 d7afce18ea223c3f25b582752fab4c3a74cc19ed774d610c42f953ddc5f5d9f4
MD5 c1dfaf517c619f8399c6a2ec776d478e
BLAKE2b-256 33665d687afbcc70498860c312f1e36de92c9d6355cd20d243e0a576425e87d4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for iminuit-2.20.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0f848736f6b1d78a597f7cbdaf3c6d222a8ed3e85b46e4abd26f4de41b2da2c7
MD5 d36637d8f036c77103967b7a95fe6fff
BLAKE2b-256 89cf35b63f9959b63b68d1f6e90e6674e2bb826277f4b0ac4cbc33acc0416940

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for iminuit-2.20.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 c4410a9c6d8367d14f6544877b6fa04771d361422b90dae22824d8e53965dc4c
MD5 8dbda5490c6a2d8c5c221f88d9c516ec
BLAKE2b-256 524874bd1c51bd7f77eafcec292cdeb7f3e746ab092944efa720124e576f5b08

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for iminuit-2.20.0-cp310-cp310-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 6432c320acfd9f761e8f5f3c433960810ec281533dba808e7fbb689c4ed9cd15
MD5 63769b181fe6346ca9bbd0387f675320
BLAKE2b-256 c65e7c3b6f6a37b560d39c638aa2e93ae8cd6d081b9d6486cd7642d4ef3aafc1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: iminuit-2.20.0-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 329.4 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.20.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 6906a01a7282cb68dd6157cd8aa1af53e335fb4b7f6b06e36921b4c2daf31be3
MD5 21ea09f917bcf8b5ed98318381761219
BLAKE2b-256 d5c32e80e769774cc49dcf089f0b25d11757d2d1182d9505e864461db4f2675a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: iminuit-2.20.0-cp39-cp39-win32.whl
  • Upload date:
  • Size: 285.7 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.20.0-cp39-cp39-win32.whl
Algorithm Hash digest
SHA256 f2e952f2efbb8e91828c5efc8c86a9e4803ef6eec086b8153d80d5e10666b4f2
MD5 432f5a7e2e8ac3bde2a923ad8f1c118b
BLAKE2b-256 a4d7c252d69ca6ae5ca1bb3d7418008246c06d00860843b0325f3f20ebe24ea5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for iminuit-2.20.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 9bde71a141b2d7ae8c17db7d00527ab2035771c0139d8727a054d287fe238140
MD5 2d248f0989cd9622982f0d3a6c6d0f6e
BLAKE2b-256 94830b2e769066b34bfc3a230896928dfae61be09b8cc2481590b203763a37b6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for iminuit-2.20.0-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 06b0d96610027a8b137e5fdf4db12b3464427f7c83c069e3f13eafcc64b4d90d
MD5 0410147e1b1e1fc6fac46c81f65f450c
BLAKE2b-256 cdf051bbb9324996310bbcd4097781ec42377d9a759135fbe87e07e6153a2db3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for iminuit-2.20.0-cp39-cp39-manylinux_2_12_i686.manylinux2010_i686.whl
Algorithm Hash digest
SHA256 3f3b5cda81c5770d85584fdd6443898dc850fb01f0333741d62760e43ab1f0b4
MD5 5a63617dd5b590226c1c3a3c4534f4bb
BLAKE2b-256 4faffd9e26352e029283aa3f8bd76ab49adc7260f48ccf023dacdb89dc7e961b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for iminuit-2.20.0-cp39-cp39-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 a1c3e593f4bfe3a466bd7b7ad83c030ae2092a27d68611ec935051803d4239c2
MD5 389b27096a71798d75477cf791eb75f2
BLAKE2b-256 efc1c85d30a9c967fa706877eca9ad1357b4b8e3f12dace6086b88e4feb5bafe

See more details on using hashes here.

File details

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

File metadata

  • Download URL: iminuit-2.20.0-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 329.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.20.0-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 c4eeb2d21b75b255d385fc718e2de65c630856f6c2d2f19b3b5c8600ce0e40bf
MD5 8d7717ecf6e675ba9c256f31b85525bf
BLAKE2b-256 01f7567301c8373f3ee0a05d253c537c37b116f5c1ecda11d0145c94a32fdabe

See more details on using hashes here.

File details

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

File metadata

  • Download URL: iminuit-2.20.0-cp38-cp38-win32.whl
  • Upload date:
  • Size: 285.6 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.20.0-cp38-cp38-win32.whl
Algorithm Hash digest
SHA256 43002a30b735d2cb190c479db69ea47bca50796ed6843f1574b6716259b3ecb9
MD5 3ae55bb2c9c7623531659e716248df61
BLAKE2b-256 7636ad1319188b417adf348b0a98831032264e800129dbd09a2478b7be72b7b1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for iminuit-2.20.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 00711b39f21eceb6e3cb7852eae67f394f3ccbbc59293f9d35eb8c0d18a1ddf6
MD5 3e78287bb59a3cf176546f468923d79e
BLAKE2b-256 5a0b861508705ba014f87d07779762b166b30bb925b8705fe68cfb96e07152ed

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for iminuit-2.20.0-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 e3a3782335fd9d905683e129d4e35d37b014bec2e40cbd39e08591e6dee567e5
MD5 4a863bee6a9947025fd7680b17c7b1a8
BLAKE2b-256 9b33548055a5dfb3a71bf882db33401730b8518ad067fb2674338d6fa2b3c6ab

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for iminuit-2.20.0-cp38-cp38-manylinux_2_12_i686.manylinux2010_i686.whl
Algorithm Hash digest
SHA256 000ce41703e8ebb17ec3dcec105bba20c4a6ff961920c54b717b42acf5592b6b
MD5 c0ed6763d70ab7c038e37e1024d58b11
BLAKE2b-256 431236a34b682742e54758da9e871a90c0a5fd2875fa5eb48c3103ea1ecd4840

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for iminuit-2.20.0-cp38-cp38-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 371ef22b0399f5863675d88c014d9407f0900dde00e4fec13c04c630f5de6d3c
MD5 05921216121f76c26af5ed43cb3c9b64
BLAKE2b-256 2c502ac2a6699a9cb8334da7c1c057d939bbf15dbc3dca13224c10e00b71ab1d

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