Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

https://travis-ci.org/mramospe/minkit.svg?branch=master https://img.shields.io/badge/documentation-link-blue.svg https://codecov.io/gh/mramospe/minkit/branch/master/graph/badge.svg

This package provides tools to fit probability density functions (PDFs) to both unbinned and binned data, using different minimizers (like Minuit). The MinKit package appears as an alternative to existing minimization packages, like RooFit. The idea is to provide a friendly pure python API to do minimization and calculations with PDFs. It has support for both CPU and GPU backends, being very easy for the user to change from one to the other. PDFs are implemented in C++, OpenCL and CUDA, allowing a fast evaluation of the functions.

The package is built on top of the numpy and iminuit packages. The interface with CUDA and OpenCL is handled using reikna, which is itself an API for PyCUDA and PyOpenCL.

Basic example

Classes meant for the user are imported directly from the main module

import minkit

x = minkit.Parameter('x', bounds=(-10, +10))
c = minkit.Parameter('c', 0.)
s = minkit.Parameter('s', 1.)
g = minkit.Gaussian('Gaussian', x, c, s)

data = g.generate(10000)

These lines define the parameters used by a Gaussian function, and a data set is generated following this distribution. The sample can be easily fitted calling:

with minkit.unbinned_minimizer('uml', g, data) as minimizer:
   r = minimizer.migrad()

In this case minimizer is a Minuit instance, since by default Minuit is used to do the minimization. The string uml specifies the type of figure to minimize (FCN), unbinned-maximum likelihood, in this case.

The compilation of C++ sources is completely system dependent (Linux, MacOS, Windows), and it also depends on the way python has been installed. The PDFs in this package need the C++ standard from 2011. Depending on the system, functions might need to be compiled with extra flags that are not used by default in distutils. If you get errors of the type:

relocation R_X86_64_PC32 against undefined symbol

suggesting to use -fPIC option (when the system is using gcc to compile C code) or

error: ‘erf’ is not a member of ‘std’

more likely it is needed to specify the flags to use. In order to do so, simply execute your script setting the value of the environmental variable CFLAGS accordingly:

CFLAGS="-fPIC -std=c++11" python script.py

Fast installation:

This package is available on PyPi, so simply type

pip install minkit

to install the package in your current python environment. To use the latest development version, clone the repository and install with pip:

git clone https://github.com/mramospe/minkit.git
pip install minkit

In order to profit from certain features of the package, like numerical integration, it is necessary that the system has the GSL libraries visible to the compiler. To install them on Linux, you can simply run

sudo apt-get install libgsl-dev

Depending on the system, you might need to set also the necessary environment variables specifying the path to the include and libraries directory, like

export CFLAGS="$CFLAGS -I/usr/include -L/usr/lib/x86_64-linux-gnu"

Metadata

Release files for minkit 0.0.0.dev1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for minkit 0.0.0.dev1
File Size Uploaded
minkit-0.0.0.dev1.tar.gz 88.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for minkit 0.0.0.dev1
File Interpreter ABI Platform
minkit-0.0.0.dev1-py3-none-any.whl Python 3 none any Details

Total release size: 191.5 kB

Release files / minkit-0.0.0.dev1.tar.gz

Download URL minkit-0.0.0.dev1.tar.gz
Size 88.6 kB
Tags Source
SHA-256 checksum
How to use checksums
6a8d02b6c24c32efe328934d0ecea84ee8b2bb244d6a5c4092fad20ddef0d884
BLAKE2b-256 checksum
How to use checksums
750f9808bd90f19f4955cacf8bc0d76cbe427ff77749e7d666f34b200e172d8d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.6.8

Release files / minkit-0.0.0.dev1-py3-none-any.whl

Download URL minkit-0.0.0.dev1-py3-none-any.whl
Size 102.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3601d18177059aeb104468f6de76abaf66b2a6cb78b345ed717061d60a018bc6
BLAKE2b-256 checksum
How to use checksums
4742f9bc37d6a99cab121dd04e9524240049b7fd59df85cb1054e3ef9e09164d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.6.8

Release history Release notifications | RSS feed

This release

0.0.0.dev1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page