pybaselines
A Python library of algorithms for the baseline correction of experimental data.
Science Score: 54.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
✓Academic publication links
Links to: zenodo.org -
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (16.3%) to scientific vocabulary
Keywords
background-removal
baseline-correction
baseline-removal
chemistry
ftir
materials-characterization
materials-science
python
raman
spectroscopy
Last synced: 6 months ago
·
JSON representation
·
Repository
A Python library of algorithms for the baseline correction of experimental data.
Basic Info
- Host: GitHub
- Owner: derb12
- License: bsd-3-clause
- Language: Python
- Default Branch: main
- Homepage: https://pybaselines.readthedocs.io
- Size: 2.67 MB
Statistics
- Stars: 151
- Watchers: 6
- Forks: 19
- Open Issues: 2
- Releases: 14
Topics
background-removal
baseline-correction
baseline-removal
chemistry
ftir
materials-characterization
materials-science
python
raman
spectroscopy
Created almost 5 years ago
· Last pushed 6 months ago
Metadata Files
Readme
Changelog
Contributing
License
Citation
README.rst
===========
pybaselines
===========
.. image:: https://github.com/derb12/pybaselines/raw/main/docs/images/logo.png
:alt: Logo
:align: center
.. image:: https://img.shields.io/pypi/v/pybaselines.svg
:target: https://pypi.python.org/pypi/pybaselines
:alt: Current Pypi Version
.. image:: https://img.shields.io/conda/vn/conda-forge/pybaselines.svg
:target: https://anaconda.org/conda-forge/pybaselines
:alt: Current conda Version
.. image:: https://github.com/derb12/pybaselines/actions/workflows/python-test.yml/badge.svg
:target: https://github.com/derb12/pybaselines/actions
:alt: GitHub Actions test status
.. image:: https://readthedocs.org/projects/pybaselines/badge/?version=latest
:target: https://pybaselines.readthedocs.io
:alt: Documentation Status
.. image:: https://img.shields.io/pypi/pyversions/pybaselines.svg
:target: https://pypi.python.org/pypi/pybaselines
:alt: Supported Python versions
.. image:: https://zenodo.org/badge/350510397.svg
:target: https://zenodo.org/badge/latestdoi/350510397
:alt: Zenodo DOI
pybaselines is a library of algorithms for the baseline correction of experimental data.
* For Python 3.9 or later
* Open Source: BSD 3-Clause License
* Source Code: https://github.com/derb12/pybaselines
* Documentation: https://pybaselines.readthedocs.io.
.. contents:: **Contents**
:depth: 1
Introduction
------------
pybaselines is a Python library that provides many different algorithms for
performing baseline correction on data from experimental techniques such as
Raman, FTIR, NMR, XRD, XRF, PIXE, MALDI-TOF, LIBS, etc. The aim of the project is
to provide a semi-unified API to allow quickly testing and comparing multiple baseline
correction algorithms to find the best one for a set of data.
pybaselines has 50+ baseline correction algorithms. These include popular algorithms,
such as AsLS, airPLS, ModPoly, and SNIP, as well as many lesser known algorithms. Most
algorithms are adapted directly from literature, although there are a few that are unique
to pybaselines, such as penalized spline versions of Whittaker-smoothing-based algorithms.
The full list of implemented algorithms can be found in the
`documentation `_.
Installation
------------
Stable Release
~~~~~~~~~~~~~~
pybaselines can be installed from `pypi `_
using `pip `_, by running the following command in the terminal:
.. code-block:: console
pip install pybaselines
pybaselines can alternatively be installed from the
`conda-forge `_ channel using conda by running:
.. code-block:: console
conda install -c conda-forge pybaselines
Development Version
~~~~~~~~~~~~~~~~~~~
The sources for pybaselines can be downloaded from the `GitHub repo`_.
To install the current version of pybaselines from GitHub, run:
.. code-block:: console
pip install git+https://github.com/derb12/pybaselines.git
.. _GitHub repo: https://github.com/derb12/pybaselines
Dependencies
~~~~~~~~~~~~
pybaselines requires `Python `_ version 3.9 or later
and the following libraries:
* `NumPy `_
* `SciPy `_
All of the required libraries should be automatically installed when
installing pybaselines using any of the installation methods above.
The `optional dependencies `_
for pybaselines are listed in the documentation . To also install the optional
dependencies when installing pybaselines with pip, run:
.. code-block:: console
pip install pybaselines[full]
If installing with conda, the optional dependencies have to be specified manually.
Quick Start
-----------
To use the various functions in pybaselines, simply input the measured
data and any required parameters. All baseline correction functions in pybaselines
will output two items: a numpy array of the calculated baseline and a
dictionary of potentially useful parameters. The main interface for all baseline correction
algorithms in pybaselines is through the ``Baseline`` object for one dimensional
data and ``Baseline2D`` for two dimensional data.
For more details on each baseline algorithm, refer to the `algorithms section`_ of
pybaselines's documentation. For examples of their usage, refer to the `examples section`_.
.. _algorithms section: https://pybaselines.readthedocs.io/en/latest/algorithms/index.html
.. _examples section: https://pybaselines.readthedocs.io/en/latest/examples/index.html
A simple example is shown below.
.. code-block:: python
import matplotlib.pyplot as plt
import numpy as np
from pybaselines import Baseline, utils
x = np.linspace(1, 1000, 1000)
# a measured signal containing several Gaussian peaks
signal = (
utils.gaussian(x, 4, 120, 5)
+ utils.gaussian(x, 5, 220, 12)
+ utils.gaussian(x, 5, 350, 10)
+ utils.gaussian(x, 7, 400, 8)
+ utils.gaussian(x, 4, 550, 6)
+ utils.gaussian(x, 5, 680, 14)
+ utils.gaussian(x, 4, 750, 12)
+ utils.gaussian(x, 5, 880, 8)
)
# exponentially decaying baseline
true_baseline = 2 + 10 * np.exp(-x / 400)
noise = np.random.default_rng(1).normal(0, 0.2, x.size)
y = signal + true_baseline + noise
baseline_fitter = Baseline(x_data=x)
bkg_1, params_1 = baseline_fitter.modpoly(y, poly_order=3)
bkg_2, params_2 = baseline_fitter.asls(y, lam=1e7, p=0.02)
bkg_3, params_3 = baseline_fitter.mor(y, half_window=30)
bkg_4, params_4 = baseline_fitter.snip(
y, max_half_window=40, decreasing=True, smooth_half_window=3
)
plt.plot(x, y, label='raw data', lw=1.5)
plt.plot(x, true_baseline, lw=3, label='true baseline')
plt.plot(x, bkg_1, '--', label='modpoly')
plt.plot(x, bkg_2, '--', label='asls')
plt.plot(x, bkg_3, '--', label='mor')
plt.plot(x, bkg_4, '--', label='snip')
plt.legend()
plt.show()
The above code will produce the image shown below.
.. image:: https://github.com/derb12/pybaselines/raw/main/docs/images/quickstart.jpg
:align: center
:alt: various baselines
Contributing
------------
Contributions are welcomed and greatly appreciated. For information on
submitting bug reports, pull requests, or general feedback, please refer
to the `contributing guide`_.
.. _contributing guide: https://github.com/derb12/pybaselines/tree/main/docs/contributing.rst
Changelog
---------
Refer to the changelog_ for information on pybaselines's changes.
.. _changelog: https://github.com/derb12/pybaselines/tree/main/CHANGELOG.rst
License
-------
pybaselines is open source and freely available under the BSD-3-Clause license.
For more information, refer to the license_.
.. _license: https://github.com/derb12/pybaselines/tree/main/LICENSE.txt
Citing
------
If you use pybaselines for published research, please consider citing
by following the `guidelines in the documentation
`_.
Author
------
* Donald Erb
Owner
- Name: Donnie Erb
- Login: derb12
- Kind: user
- Repositories: 2
- Profile: https://github.com/derb12
Citation (CITATION.cff)
abstract: pybaselines is a Python library that provides many different algorithms for
performing baseline correction on data from experimental techniques such as Raman,
FTIR, NMR, XRD, etc.
authors:
- family-names: Erb
given-names: Donald
cff-version: 1.2.0
identifiers:
- type: doi
value: 10.5281/zenodo.5608581
description: "Persistent DOI for all versions of pybaselines"
- type: url
value: https://github.com/derb12/pybaselines
description: "URL for the pybaselines source code repository"
- type: url
value: https://pypi.org/project/pybaselines
description: "URL for the PyPI upload of pybaselines"
keywords:
- "baseline correction"
- "materials characterization"
- spectroscopy
- Python
license: BSD-3-Clause
message: "If citing this software, consider using this metadata."
repository-artifact: https://pypi.org/project/pybaselines
repository-code: https://github.com/derb12/pybaselines
title: "pybaselines: A Python library of algorithms for the baseline correction of experimental data"
type: software
version: 1.2.1
GitHub Events
Total
- Create event: 17
- Release event: 2
- Issues event: 10
- Watch event: 32
- Delete event: 11
- Issue comment event: 34
- Push event: 118
- Pull request event: 21
- Fork event: 3
Last Year
- Create event: 17
- Release event: 2
- Issues event: 10
- Watch event: 32
- Delete event: 11
- Issue comment event: 34
- Push event: 118
- Pull request event: 21
- Fork event: 3
Committers
Last synced: about 2 years ago
Top Committers
| Name | Commits | |
|---|---|---|
| derb12 | 5****2 | 363 |
| Abdelhakim Qbaich | a****h@u****a | 2 |
Committer Domains (Top 20 + Academic)
uvic.ca: 1
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 11
- Total pull requests: 44
- Average time to close issues: about 2 months
- Average time to close pull requests: about 8 hours
- Total issue authors: 9
- Total pull request authors: 3
- Average comments per issue: 3.55
- Average comments per pull request: 0.23
- Merged pull requests: 42
- Bot issues: 0
- Bot pull requests: 3
Past Year
- Issues: 7
- Pull requests: 18
- Average time to close issues: about 1 month
- Average time to close pull requests: about 7 hours
- Issue authors: 6
- Pull request authors: 2
- Average comments per issue: 4.0
- Average comments per pull request: 0.22
- Merged pull requests: 18
- Bot issues: 0
- Bot pull requests: 3
Top Authors
Issue Authors
- derb12 (2)
- Firestar-Reimu (2)
- ericpre (1)
- a-georgiadis (1)
- ianhi (1)
- abdelq (1)
- kelleyjbrady (1)
- guillaume-osmo (1)
- rguliev (1)
Pull Request Authors
- derb12 (40)
- dependabot[bot] (3)
- abdelq (1)
Top Labels
Issue Labels
Pull Request Labels
dependencies (3)
github_actions (3)
Packages
- Total packages: 2
-
Total downloads:
- pypi 23,068 last-month
-
Total dependent packages: 11
(may contain duplicates) -
Total dependent repositories: 3
(may contain duplicates) - Total versions: 17
- Total maintainers: 1
pypi.org: pybaselines
A library of algorithms for the baseline correction of experimental data.
- Homepage: https://github.com/derb12/pybaselines
- Documentation: https://pybaselines.readthedocs.io
- License: bsd-3-clause
-
Latest release: 1.2.1
published 7 months ago
Rankings
Dependent packages count: 1.1%
Downloads: 3.3%
Average: 7.0%
Stargazers count: 8.1%
Forks count: 10.9%
Dependent repos count: 11.5%
Maintainers (1)
Last synced:
6 months ago
conda-forge.org: pybaselines
pybaselines is a Python library that provides many different algorithms for performing baseline correction on data from experimental techniques such as Raman, FTIR, NMR, XRD, etc.
- Homepage: https://github.com/derb12/pybaselines
- License: BSD-3-Clause
-
Latest release: 1.0.0
published over 3 years ago
Rankings
Dependent repos count: 24.4%
Stargazers count: 39.3%
Average: 40.7%
Forks count: 47.5%
Dependent packages count: 51.6%
Last synced:
6 months ago
Dependencies
requirements/requirements-development.txt
pypi
- bump2version ==1.0.1 development
- flake8 ==4.0.1 development
- flake8-comprehensions ==3.7.0 development
- flake8-docstrings ==1.6.0 development
- pytest ==6.2.5 development
- twine ==3.6.0 development
- wheel ==0.37.0 development
requirements/requirements-documentation.txt
pypi
- docutils ==0.17.1
- matplotlib ==3.3.3
- numba ==0.54.1
- pentapy ==1.1.2
- sphinx ==4.3.1
- sphinx-autoapi ==1.8.4
- sphinx-gallery ==0.10.1
- sphinx-rtd-theme ==1.0.0
requirements/requirements.txt
pypi
- numpy ==1.20.3
- scipy ==1.7.3
.github/workflows/python-test.yml
actions
- actions/checkout v3 composite
- actions/setup-python v4 composite
pyproject.toml
pypi
setup.py
pypi