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

Uploaded Source

Built Distributions

iminuit-2.21.0-cp311-cp311-win_amd64.whl (331.2 kB view details)

Uploaded CPython 3.11 Windows x86-64

iminuit-2.21.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (381.6 kB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

iminuit-2.21.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (354.2 kB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ ARM64

iminuit-2.21.0-cp311-cp311-macosx_10_9_universal2.whl (632.0 kB view details)

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

iminuit-2.21.0-cp310-cp310-win_amd64.whl (331.0 kB view details)

Uploaded CPython 3.10 Windows x86-64

iminuit-2.21.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (381.6 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

iminuit-2.21.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (354.2 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ ARM64

iminuit-2.21.0-cp310-cp310-macosx_10_9_universal2.whl (632.0 kB view details)

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

iminuit-2.21.0-cp39-cp39-win_amd64.whl (331.1 kB view details)

Uploaded CPython 3.9 Windows x86-64

iminuit-2.21.0-cp39-cp39-win32.whl (287.5 kB view details)

Uploaded CPython 3.9 Windows x86

iminuit-2.21.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (354.4 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ ARM64

iminuit-2.21.0-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (353.1 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.12+ x86-64

iminuit-2.21.0-cp39-cp39-manylinux_2_12_i686.manylinux2010_i686.whl (366.4 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.12+ i686

iminuit-2.21.0-cp39-cp39-macosx_10_9_universal2.whl (632.3 kB view details)

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

iminuit-2.21.0-cp38-cp38-win_amd64.whl (331.2 kB view details)

Uploaded CPython 3.8 Windows x86-64

iminuit-2.21.0-cp38-cp38-win32.whl (287.5 kB view details)

Uploaded CPython 3.8 Windows x86

iminuit-2.21.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (354.3 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ ARM64

iminuit-2.21.0-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (352.8 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.12+ x86-64

iminuit-2.21.0-cp38-cp38-manylinux_2_12_i686.manylinux2010_i686.whl (366.2 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.12+ i686

iminuit-2.21.0-cp38-cp38-macosx_10_9_universal2.whl (632.4 kB view details)

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

File details

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

File metadata

  • Download URL: iminuit-2.21.0.tar.gz
  • Upload date:
  • Size: 437.1 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.0.tar.gz
Algorithm Hash digest
SHA256 8af46cc1e688be488171e4df008e39ef037eb5b9ed277b781d3ca759fdbdbc02
MD5 112b8fdbf2e55f18345378b62c407211
BLAKE2b-256 015340d7ecf0d511c4f76cf831ec60123505351109d864a5d78dcee8bf2e297d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: iminuit-2.21.0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 331.2 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.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 a7f72b0af2e60d0fa46f29565dc9302468958d0483d15fd0fea33166265ad70d
MD5 90f1626dc393d3033f01fed5abd318d8
BLAKE2b-256 a744c396e426eed7bfd746a73ed794648febc0de53d3c807ae64e773a41e9a21

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for iminuit-2.21.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a97f458a76a7d1ea58f153820f9226a6c3b811b5e71a77bbef8bbca24ab35489
MD5 60b14f869e37eb9cd6780200bd68df46
BLAKE2b-256 c5261ca6c5e9e4a4dd16a657a47a2600cb608632404d31b81bbbc2190d438e48

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for iminuit-2.21.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 551913a1f51754e365bff68a49dc3118f050504888b9a35390b82ad6a121aa3c
MD5 db939a8ff5f9547b962e0a06bcdf6e1d
BLAKE2b-256 dd8dc430e6bab1c956df0736796d1dcf8d78b684bd76cc0d80b67adbd6b5a236

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for iminuit-2.21.0-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 6972db01a25071bd5ed4776bb0e15a623a2318ecf94d4a7141ca5b6c6f5d1efd
MD5 0ace07f5a3d2c9704c01dd9e03097554
BLAKE2b-256 703358fd47ae661904787b22443abf3f9211ea80fc2f08b16271159050111604

See more details on using hashes here.

File details

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

File metadata

  • Download URL: iminuit-2.21.0-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 331.0 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.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 25fedc082b7a9ea0fed25103782633c0472ff16defbcb255930f5d1123a2c890
MD5 2965700c7e01ff0e79993856f15c6e1a
BLAKE2b-256 a03481527ade53adfe5832a9c34be4fc407c08f5be5f425bc4f4bfee4b895759

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for iminuit-2.21.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2ed14c9279407d916bcbea5a73d06cb6170a5716e8a5a2a83582aa525f4b7140
MD5 5cf8d872323456e9c82a1bac37673c6b
BLAKE2b-256 3d83100e2308579097755b53ab4eac127fb0a9107c9f6038b54bb463a34fd655

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for iminuit-2.21.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 ae7af9f1ee30916d147a8cec1234c991ba9b7fd2d01a39a796143235044400c9
MD5 0a8d343ab10b5d69eb0a376bc7ae13c6
BLAKE2b-256 a1386be121e3b76d6941d825d310b9beda6e2bd8bf0a25766a701b74ccad87f6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for iminuit-2.21.0-cp310-cp310-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 319d6daa51f3e0e9117fc4fbc93c08d2d9c392ad091cb7f0f01b03c28e194ae2
MD5 a26334d49e762dce4eceb6cd7cc8fe5d
BLAKE2b-256 b254b3b35f41376ce7c94e272de321f92b5d1c6e2807a453a801fe9d595b3399

See more details on using hashes here.

File details

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

File metadata

  • Download URL: iminuit-2.21.0-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 331.1 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.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 6412c03db7dada7ad1e83c41635cb27d27eb7aefb8d1e01b0551ce17bbdb48c9
MD5 2d142aedc380453faaa75b1a21e648b6
BLAKE2b-256 17b6ebbb32c3b8bc6f21fef0392062c9b6e80ce95999bbf6f17d2cd0da05893d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: iminuit-2.21.0-cp39-cp39-win32.whl
  • Upload date:
  • Size: 287.5 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.0-cp39-cp39-win32.whl
Algorithm Hash digest
SHA256 b93c498d1547c9e0986f04b45718d685b822835a5f1c58198155743151dbe58c
MD5 642ce94ecf12c58316093d6f43fc2232
BLAKE2b-256 943f0a4d23437173b8c61190c899835ee4913e142464744def6da8c25ada624c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for iminuit-2.21.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 83cc8eb959fe26e270bd3630412e3b76918b4c2275004273e4a9586ca56ca25d
MD5 924a4d3e2822053b6ed190fb653909b7
BLAKE2b-256 a1bfd6cd0a95ee6dd04b7ec6354c337ccdc2136e6e65fc1d11b4beb222bac7bd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for iminuit-2.21.0-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 6dc7fdb1c2bacbf3463bfad533b76fd45cc68cd9dd0ca26f6579883aae11e03b
MD5 940447427daeaf2303db69ce4c05e328
BLAKE2b-256 2f2ee7f7a3c58da1b9228928acfc5a21c349be993068d82f3220cbf7d278c33b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for iminuit-2.21.0-cp39-cp39-manylinux_2_12_i686.manylinux2010_i686.whl
Algorithm Hash digest
SHA256 f0c2242e61a8d4b7c923d1f1b6a07157b7e7f92a014c24b766db3e87afeba3c2
MD5 7d0345ba9980cd498cc07f37b9f08dd6
BLAKE2b-256 963fe094fc7e0917639581a55a8e64572b229384088ad1ff856ed22939dfb2aa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for iminuit-2.21.0-cp39-cp39-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 74a2321503b19ae630d5c579462fe4602111efa8e0bf749745eb36108f481886
MD5 54c0d98ad58a678fd9bbfb3ae1bc36a1
BLAKE2b-256 522c837eaea30ab9e3549b62886c425215126b694bf7e1692ba6484215ba5819

See more details on using hashes here.

File details

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

File metadata

  • Download URL: iminuit-2.21.0-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 331.2 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.0-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 404be39955237a6bc0cd1461d736eec774e957dfdc562232fd981b3ba5567a06
MD5 0f63b42c49efb06618bad0625987a5d3
BLAKE2b-256 9a427ba76d78159b1dbe3ebecb9aa1f29a9b4bfab62950e768c90db1bc512506

See more details on using hashes here.

File details

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

File metadata

  • Download URL: iminuit-2.21.0-cp38-cp38-win32.whl
  • Upload date:
  • Size: 287.5 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.0-cp38-cp38-win32.whl
Algorithm Hash digest
SHA256 79420d5cd6b773d11c8455d92a749286312f7cd2dd7f296e182a1ce125ce86d6
MD5 da0bf6acd9aeea75423e9d6c93e31520
BLAKE2b-256 b42109502b8e07f7d8f3733a32cb13b7c499fdb5405ab2e954e872c97a5ff9fc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for iminuit-2.21.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 6ec515639124d11e4e34a24d5cd4fb74812f7dec8cea77594eebabe45a24ba9b
MD5 bc38b32e4a56401c9fedac740004d961
BLAKE2b-256 293f97add44ad343974e040b5ef11268ccfdc78aac2cf33d8713389eddcec94b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for iminuit-2.21.0-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 2b46ce60d4d1d7371f9c0ad050a9b42701c833b3ae5b80c5a715392775e718ac
MD5 1d135bd324c03dae95d2b86d073f8c11
BLAKE2b-256 7415e3ab68548384fe88ada186520455209e0cb6caa690fd2736edb7f7c396a3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for iminuit-2.21.0-cp38-cp38-manylinux_2_12_i686.manylinux2010_i686.whl
Algorithm Hash digest
SHA256 061c179d34253190302d091f606961fc8bc1c8d7abd93f2edab7cfd2c0286a05
MD5 61fca277fc73d3884428d26b351d9089
BLAKE2b-256 a2f73386396189cb0b58bf487f2e2dcd8a79172101f837b5125eee542cb69c57

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for iminuit-2.21.0-cp38-cp38-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 672d8c9dd20682636e417235dee883f24432924fda55c6854c101d9640655f1e
MD5 11fbfbb31e0788a5340b4a7dad97c8da
BLAKE2b-256 055bd1a41f57f1c4998b7b6534cb0a8fb80388954c30d32b09a18865daa2ff8b

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