Fast fitting of 2D-Spectra with established routines
Project description
SpectraFit
SpectraFit
is a command line tool for quick data fitting based on the regular
expression of distribution and linear functions. Furthermore, it can be also
used as a module in existing python code. A previous version of SpectraFit
was
used for the following publication:
Now, it is completely rewritten and is more flexible.
Scope:
- Fitting of 2d data
- Using established and advanced solver methods
- Extensibility of the fitting function
- Guarantee traceability of the fitting results
- Saving all results for publications in a
CSV
-format - Saving all results in a NoSQL-format (
JSON
) for project management - Having an API interface for Graph-databases
Installation:
via pip:
pip install spectrafit
Usage:
SpectraFit
needs as command line tool only two things:
- The reference data, which should be fitted.
- The input file, which contains the initial model.
As model files json,
toml, and
yaml are supported. By making use of the
python **kwargs
feature, the input file can call most of the following
functions of LMFIT. LMFIT is the
workhorse for the fit optimization, which is macro wrapper based on:
In case of SpectraFit
, we have further extend the package by:
- Pandas
- Statsmodels
- numdifftools
- Matplotlib in combination with Seaborn
spectrafit data_file.txt input_file.json
spectrafit -h
usage: spectrafit [-h] [-o OUTFILE] [-i INPUT] [-ov] [-disp] [-e0 ENERGY_START] [-e1 ENERGY_STOP] [-s SMOOTH] [-sh SHIFT] [-c COLUMN COLUMN] [-sep { ,,,;,:,|, ,s+}] [-dec {.,,}] [-hd HEADER] [-np] [-v] [-vb] infile
Fast Fitting Program for ascii txt files.
positional arguments:
infile Filename of the specta data
optional arguments:
-h, --help show this help message and exit
-o OUTFILE, --outfile OUTFILE
Filename for the export, default to set to 'spectrafit_results'.
-i INPUT, --input INPUT
Filename for the input parameter, default to set to 'fitting_input.toml'.Supported fileformats are: '*.json', '*.yml', '*.yaml', and '*.toml'
-ov, --oversampling Oversampling the spectra by using factor of 5; default to False.
-disp Hole or splitted Table on the Screen; default to 'hole'.
-e0 ENERGY_START, --energy_start ENERGY_START
Starting energy in eV; default to start of energy.
-e1 ENERGY_STOP, --energy_stop ENERGY_STOP
Ending energy in eV; default to end of energy.
-s SMOOTH, --smooth SMOOTH
Number of smooth points for lmfit; default to 0.
-sh SHIFT, --shift SHIFT
Constant applied energy shift; default to 0.0.
-c COLUMN COLUMN, --column COLUMN COLUMN
Selected columns for the energy- and intensity-values; default to 0 for energy (x-axis) and 1 for intensity (y-axis).
-sep { ,,,;,:,|, ,s+}, --seperator { ,,,;,:,|, ,s+}
Redefine the type of seperator; default to ' '.
-dec {.,,}, --decimal {.,,}
Type of decimal seperator; default to '.'.
-hd HEADER, --header HEADER
Selected the header for the dataframe; default to None.
-np, --noplot No plotting the spectra and the fit of `spectrafit`.
-v, --version Display the current version of `spectrafit`.
-vb, --verbose Display the initial configuration parameters as a dictionary.
Documentation:
Please see the extended documentation
for the full usage of SpectraFit
.
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
Built Distribution
Hashes for SpectraFit-0.3.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5e41ef5dfd7afb833f8b63d8b2c105f0a99db5c33e7c81e078f8c87b383dd55a |
|
MD5 | 356cd75353cca3b48b9a8b9419f6e76d |
|
BLAKE2b-256 | a501f00e86e7fa196040059fb87c4f46abb23eea67741ea1d0bcd2c12f1b94b2 |