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

Uploaded Source

Built Distributions

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

Uploaded CPython 3.11 Windows x86-64

iminuit-2.21.1-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.1-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.1-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.1-cp310-cp310-win_amd64.whl (331.2 kB view details)

Uploaded CPython 3.10 Windows x86-64

iminuit-2.21.1-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.1-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.1-cp310-cp310-macosx_10_9_universal2.whl (632.2 kB view details)

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

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

Uploaded CPython 3.9 Windows x86-64

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

Uploaded CPython 3.9 Windows x86

iminuit-2.21.1-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.1-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.1-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.1-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.1-cp38-cp38-win_amd64.whl (331.4 kB view details)

Uploaded CPython 3.8 Windows x86-64

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

Uploaded CPython 3.8 Windows x86

iminuit-2.21.1-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.1-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (352.9 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.12+ x86-64

iminuit-2.21.1-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.1-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.1.tar.gz.

File metadata

  • Download URL: iminuit-2.21.1.tar.gz
  • Upload date:
  • Size: 437.4 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.1.tar.gz
Algorithm Hash digest
SHA256 b151059621e252b6ca310a16d044b82c329521346b9d5d0668cdb14421cb5e0f
MD5 434885f9b98b35e304ac69a6c19e4eac
BLAKE2b-256 82dca005ccf61cb7c33998179d4f1054ce804c0fcd31b9509508693bb647cdf0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: iminuit-2.21.1-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.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 e4e29518f52ac6f8aee7468afd7dd380916d66a4074cab6aea1160beb9d43e18
MD5 d56b86c1e911b6da1dc1feb1c10d8951
BLAKE2b-256 1c53125c4b11a494dd72f7bb5c11c5df96e12c94e772a4a699bfc2b7c133b34f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for iminuit-2.21.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 61d333f1440e60a8dc0899571d587533b0f6ac97f52e0d7cbe542498da80b1d5
MD5 72c20258a9583d6aefda23c82050018d
BLAKE2b-256 63804a07294db55dc8297c97514d87d3976ba4ec2eceb490bc92d1f15c76ca44

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for iminuit-2.21.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 0e5dc0215056467d59d23692b31196b212bd474d60e511767d085593b7b76291
MD5 821a7b10492a72df21d86b71f556d495
BLAKE2b-256 00ba195012ab7cfc4030bd274241ae56cdaf64ca1a05a5e4a6391cf7852359c5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for iminuit-2.21.1-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 1d3b9d118b54ecf48d32aec4f6111e7518c530240e98a003ed538ef70e7d991b
MD5 e180438132d63e386cb04924d6f483f5
BLAKE2b-256 cf7904dad74db44ffaa8d46155b36decaff77564bc72d7a755abe0575784f271

See more details on using hashes here.

File details

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

File metadata

  • Download URL: iminuit-2.21.1-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.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 a65f109cf1849c479ded0a7359d9066b7eef3116ea39550500bc28d3ad46ec19
MD5 de8c6ce1cddb2c0958ae2ed8a07e2982
BLAKE2b-256 214a9443d53dd85c7671182657ee12728fa4b65e8c516a8cfea016906a2036ee

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for iminuit-2.21.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c1d9797b14c6482c768ebe0746d53e3aeddbe8c60b7015f729dbbe19c05c95c4
MD5 d5a6f1ffe4dc83d8f4f637a74a68e344
BLAKE2b-256 4a2bac239f120cca3a57039680d87d5ccaa8cc6197efdd85727318a7994a76af

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for iminuit-2.21.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 5f9f3c2856897d00c617c9592f2709f01d4484b818d13e2d3d8240ae6d73ca5b
MD5 7202b12271086957584c66f64a73be06
BLAKE2b-256 964da78ccb4836b3ba4c8a39f535aeccd28cb97d49ed647d0e323518ce2831fd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for iminuit-2.21.1-cp310-cp310-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 46bf3217f4a38f48781dfeaf489ddc5beceb6a38c3412fe0a2241ec89cfb2723
MD5 b3ece1a99c82d5ae83fd6a0fe4405215
BLAKE2b-256 d9a8e1dcb95587f3bb4ea7dca024dfb5a56f5235af6a7beb15b2652294ef7cde

See more details on using hashes here.

File details

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

File metadata

  • Download URL: iminuit-2.21.1-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.1-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 dde7f7ae38c5bc3a031c900ac977a8f59d875e34ea797a237e8c7ff253090364
MD5 1ae21bccdf67a6248c581c89a17432cb
BLAKE2b-256 c0cf1c04614f5084e029d023a3d2ccdc757000f89ef7f7ee692c80bc61b74aee

See more details on using hashes here.

File details

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

File metadata

  • Download URL: iminuit-2.21.1-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.1-cp39-cp39-win32.whl
Algorithm Hash digest
SHA256 181063652fb795775e1cc3534bf4a7d0263acb1392a5b68688b112c3f7eab79c
MD5 9da1e03a94dd14701e50a500b9b8f1a3
BLAKE2b-256 8d5ea3f4246f2df9a551c946a0738c5fa950529097018a10f25f564353d41ba3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for iminuit-2.21.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f7f074b79416a1bddd75ac70eacb88174a80f571c5c7c5e6975ded4770fde3fb
MD5 659d1ef02d343e72866b705d78d34011
BLAKE2b-256 27aa9da2f38705453e8125f56ed24dabfc53d2f66436062655423fbdc6e6674c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for iminuit-2.21.1-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 f1bafc37143f9c5732631cbadffb7eeedf7fba373fb7b7cff0251a452c65badd
MD5 34f17dec01d3dd62ff25da52d1e80214
BLAKE2b-256 f05adc6939b71ec206256407bce94f2c8957776770a0ce14d8f2a20ca22598dc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for iminuit-2.21.1-cp39-cp39-manylinux_2_12_i686.manylinux2010_i686.whl
Algorithm Hash digest
SHA256 c6532ecf6ff972583c608cead5110c707e868740d5791808b3ee85528268ba8f
MD5 5c7a27c57b443d0649dd33954dcc1f05
BLAKE2b-256 715ff812d81eca43b4d8ebb3a594f6e4e4b0886b06d6072863d20d8644c03ac0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for iminuit-2.21.1-cp39-cp39-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 4c6f6a1a4e1a198c1f7959ab1a6a6d28c1daf7c637819a9dde5876b8ac2102a9
MD5 f6a5525a464dde481eeb947c6db51835
BLAKE2b-256 0b49fbedef7714af115adf766e9b2cd4a6ff0bfe52f1c338ae3864fd2184a9e6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: iminuit-2.21.1-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.1-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 f5399c05198da98f3086ec2fb336bde46dd05a00664d026f877013c10b108247
MD5 6826bcb77032b93c4a77f012676b2f81
BLAKE2b-256 19cb01c5d4176f4d20b4ea7b8971eaa3a4e7d6120c2c133ac41a0e873ff20aee

See more details on using hashes here.

File details

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

File metadata

  • Download URL: iminuit-2.21.1-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.1-cp38-cp38-win32.whl
Algorithm Hash digest
SHA256 7d8ef1eaa26b11451f4d56a9e2bfae9b63a157bd2b7dc04745c72820ae49bf82
MD5 fc24576037012e598bdb0430ba514fde
BLAKE2b-256 31abd0d04e3e41bd338b44189d44458444f38c03fa73040637053e801babf534

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for iminuit-2.21.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 5258d84d1afb1d8c208171cefc20aabd352f604820faf33720ba05928b799454
MD5 ecba617102ee78a8641e58b8525da6b5
BLAKE2b-256 50bed666b815b395fe5c69c66d963fcd6af40bcefdc57b9c4715b1d931ec0972

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for iminuit-2.21.1-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 87c3f73ba7bd8cc47dd97ae34cc1b624a20033065c76f3115dde09d6b8105ffe
MD5 361c6f7722e8b1ae018fc92451e80a9c
BLAKE2b-256 7fa11ef6c83f441e9f84848d66a3f3ff1d9fad1ef68a2fbc64952a789fd7175c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for iminuit-2.21.1-cp38-cp38-manylinux_2_12_i686.manylinux2010_i686.whl
Algorithm Hash digest
SHA256 44a67b43f6bb8e9b0b9322a7b73fc17a6afe29b5753dbee516da261f4de1134d
MD5 599a5b8a87ca70bd30c1ee9ee23fa432
BLAKE2b-256 d5fc66cc13c6c56cbd357d40fc58edb68ff5b6c27329e9cf91d9b376a697941a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for iminuit-2.21.1-cp38-cp38-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 4454d0c1067a792a0858f70879a2b980bf853d996b9c3391f8c197fc1152da99
MD5 dae285e47e69efe57ef9484da401cb03
BLAKE2b-256 d50447b39093c2e47a5fd9fa2f8e873649882cb187bfb34fe71bb008c7d2f548

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