Karlsruhe Fit Environment 2: a package for fitting and elementary data analysis
Project description
About
kafe2 is an open-source Python package designed to provide a flexible Python interface for the estimation of model parameters from measured data. It is the spiritual successor to the original kafe package.
kafe2 offers support for several types of data formats (including series of indexed measurements, xy value pairs, and histograms) and data uncertainty models, as well as arbitrarily complex parametric models. The numeric aspects are handled using the scientific Python stack (numpy, scipy, …). Visualization of the data and the estimated model are provided by matplotlib.
While kafe2 supports both Python 2 and Python 3, the use of Python 3 is recommended.
Note
kafe2 is currently in a beta state. Most features are working as intended. However, bugs may occur during use. If you encounter any bugs or have an improvement proposal, please let us know by opening an issue here.
A user guide can be found on kafe2.readthedocs.io.
Requirements
kafe2 needs some additional Python packages. When kafe2 is installed via pip, those packages are automatically installed as dependencies:
Since kafe2 relies on matplotlib for graphics it might be necessary to install external programs:
Tkinter, the default GUI used by matplotlib
Optionally, a function minimizer other than scipy.optimize.minimize can be used. kafe2 implements interfaces to two function minimizers and will use them by default if they’re installed:
Installation notes (Linux)
The easiest way to install kafe2 is via pip, which is already included for Python >= 2.7.9. Installing via pip will automatically install the minimal dependencies. Please note that commands below should be run as root.
For Python 2:
pip2 install kafe2
For Python 3:
pip3 install kafe2
If you don’t have pip installed, get it from the package manager.
In Ubuntu/Mint/Debian, do:
apt-get install python-pip python3-pip
In Fedora/RHEL/CentOS, do:
yum install python2-pip python3-pip
or use easy_install (included with setuptools):
easy_install pip
You will also need to install Tkinter if it didn’t already come with your Python distribution.
For Python 2, Ubuntu/Mint/Debian:
apt-get install python-tk
For Python 2, Fedora/RHEL/CentOS:
yum install tkinter
For Python 3, Ubuntu/Mint/Debian:
apt-get install python3-tk
For Python 3, Fedora/RHEL/CentOS:
yum install python3-tkinter
Optional: Install ROOT
Note: Starting with Ubuntu 16.10, ROOT is no longer available in the official repositories.
In older versions of Ubuntu (and related Linux distributions), ROOT and its Python bindings can be obtained via the package manager via:
apt-get install root-system libroot-bindings-python5.34 libroot-bindings-python-dev
Or, in Fedora/RHEL/CentOS:
yum install root root-python
This setup is usually sufficient. However, you may decide to build ROOT yourself. In this case, be sure to compile with PyROOT support. Additionally, for Python to see the PyROOT bindings, the following environment variables have to be set correctly:
export ROOTSYS=<directory where ROOT is installed>
export LD_LIBRARY_PATH=$ROOTSYS/lib:$PYTHONDIR/lib:$LD_LIBRARY_PATH
export PYTHONPATH=$ROOTSYS/lib:$PYTHONPATH
For more info, refer to http://root.cern.ch/drupal/content/pyroot.
Optional: Install iminuit
iminuit is a Python wrapper for the Minuit minimizer which is independent of ROOT. This minimizer can be used instead of ROOT.
To install the iminuit package for Python, the Pip installer is recommended:
pip install iminuit
You might also need to install the Python headers for iminuit to compile properly.
In Ubuntu/Mint/Debian, do:
apt-get install libpython2-dev libpython3-dev
In Fedora/RHEL/CentOS, do:
yum install python2-devel python3-devel
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.