FitPy documentation
Welcome! This is the documentation for FitPy – a framework for the advanced fitting of models to spectroscopic data focussing on reproducibility. Supported are semi-stochastic sampling of starting conditions, global fitting of several datasets at once, and fitting several concurrent models to one dataset. FitPy builds upon and extends the ASpecD framework. At the same time, it relies on the SciPy software stack and on lmfit for its fitting capabilities.
Making use of the concept of recipe-driven data analysis, actual fitting no longer requires programming skills, but is as simple as writing a text file defining both, the model and the fitting parameters in an organised way. Curious? Have a look at the following example:
1format:
2 type: ASpecD recipe
3 version: '0.2'
4
5datasets:
6 - /path/to/dataset
7
8tasks:
9 - kind: model
10 type: Gaussian
11 properties:
12 parameters:
13 position: 1.5
14 width: 0.5
15 from_dataset: /path/to/dataset
16 output: model
17 result: gaussian_model
18
19 - kind: fitpy.singleanalysis
20 type: SimpleFit
21 properties:
22 model: gaussian_model
23 parameters:
24 fit:
25 amplitude:
26 start: 5
27 range: [3, 7]
28 result: fitted_gaussian
For more general information on the FitPy framework see its Homepage, and for how to use it, carry on reading. Interested in more real-live examples? Check out the use cases section and the growing list of examples providing complete recipes for different needs.
Features
A list of features, not all implemented yet, but planned for the next releases:
Advanced fitting of models to spectroscopic data focussing on reproducibility.
Simple user interface requiring no programming skills.
Semi-stochastic sampling of starting conditions (Latin hypercube sampling, LHS)
Global fitting of several datasets at once
Fitting of several concurrent models (i.e., “species”) to one dataset
And to make it even more convenient for users and future-proof:
Open source project written in Python (>= 3.7)
Developed fully test-driven
Extensive user and API documentation
Warning
FitPy is currently under active development and still considered in Beta development state. Therefore, expect frequent changes in features and public APIs that may break your own code. Nevertheless, feedback as well as feature requests are highly welcome.
How to cite
FitPy is free software. However, if you use FitPy for your own research, please cite it appropriately:
Till Biskup. FitPy (2022). doi:10.5281/zenodo.5920380
As FitPy is based on the SciPy and lmfit packages, you are highly encouraged to cite these two packages as well: SciPy: doi:10.1038/s41592-019-0686-2, lmfit: doi:10.5281/zenodo.598352.
To make things easier, FitPy has a DOI provided by Zenodo, and you may click on the badge below to directly access the record associated with it. Note that this DOI refers to the package as such and always forwards to the most current version.
Where to start
Users new to FitPy should probably start at the beginning, those familiar with its underlying concepts may jump straight to the section explaining how working with the FitPy framework looks like, particularly in context of recipe-driven data analysis.
The API documentation is the definite source of information for developers, besides having a look at the source code.
Installation
To install the FitPy framework on your computer (sensibly within a Python virtual environment), open a terminal (activate your virtual environment), and type in the following:
pip install fitpy
Have a look at the more detailed installation instructions as well.
License
This program is free software: you can redistribute it and/or modify it under the terms of the BSD License. However, if you use FitPy for your own research, please cite it appropriately. See How to cite for details.
A note on the logo
The logo shows a Latin square, usually attributed to Leonhard Euler. In the context of statistical sampling, a Latin square consists of only one sample in each row and each column. Its n-dimensional generalisation, the Latin hypercube, is used to generate a near-random sample of parameter values from a multidimensional distribution in statistics, e.g., for obtaining sets of starting parameters for minimisation and fitting tasks. The logo shows a snake (obviously a Python) distributed such over a 4x4 square that it visits each row and each column only once. The copyright of the logo belongs to J. Popp.