--- id: pybaselines version: "1.2.1" license: BSD-3-Clause license_treatment: permissive maintenance: active --- # pybaselines — A library of algorithms for the baseline correction of experimental data. License: permissive · Maintenance: active · Downloads: 128.7K/mo ## What it is and what it does pybaselines is a Python library for baseline correction—the removal of background signal from experimental measurements in spectroscopy and analytical chemistry. It implements over 50 algorithms including well-known methods like AsLS, airPLS, ModPoly, and SNIP, as well as specialized variants unique to the library. The library targets practitioners working with data from techniques such as Raman, FTIR, NMR, XRD, and similar analytical methods. The main interface is the Baseline class for 1D data and Baseline2D for 2D data. Each algorithm returns both the calculated baseline and a dictionary of parameters, allowing users to quickly test multiple approaches on the same dataset to find the best fit. The library depends only on numpy and scipy, making it lightweight and easy to integrate into existing scientific Python workflows. Use it for: - Remove background noise from Raman spectroscopy measurements to isolate peak signals for chemical identification. - Correct baseline drift in FTIR spectra before performing quantitative analysis or peak fitting. - Compare multiple baseline correction algorithms on the same dataset to determine which produces the best result for your material. - Preprocess XRD or XRF data to improve signal-to-noise ratio before downstream analysis. - Integrate baseline correction into automated spectroscopy data pipelines for batch processing. - Develop custom baseline correction workflows by combining different algorithms and parameters. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Provides 50+ baseline correction algorithms for experimental data from spectroscopy and analytical techniques, with a unified API for testing and comparing methods. Yes. pybaselines is a mature, actively maintained library with no known vulnerabilities, low installation friction, and a permissive license. Install it if you work with spectroscopy or analytical data requiring baseline correction—the breadth of algorithms and unified API make it the natural choice for this task. ## Install pip install pybaselines uv add pybaselines poetry add pybaselines ## Installing pybaselines Before you install: Low friction installation with only numpy and scipy as runtime dependencies. Actively maintained with recent commits and stable production status. License in practice: BSD-3-Clause permissive license allows use in commercial and proprietary projects with minimal restrictions. Quickstart: pip install pybaselines import numpy as np from pybaselines import Baseline x = np.linspace(1, 1000, 1000) y = np.random.normal(0, 1, 1000) # your measured data baseline_fitter = Baseline(x_data=x) bkg, params = baseline_fitter.asls(y, lam=1e7, p=0.02) Requires Python 3.9 or later. Verify before relying: - Whether the 50+ algorithms cover all common spectroscopy techniques mentioned (Raman, FTIR, NMR, XRD, XRF, PIXE, MALDI-TOF, LIBS). - Performance characteristics and computational cost for large datasets or real-time processing. - Availability and scope of optional dependencies referenced in the documentation. ## Package facts - License: BSD-3-Clause (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 128.7K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags baseline correction algorithms, spectroscopy data processing, raman spectrum baseline subtraction, experimental data baseline removal, asls airpls modpoly snip, ftir xrd baseline fitting, signal preprocessing spectroscopy, spectroscopy, signal-processing, chemistry [View on SkillFed](https://skillfed.io/packages/pybaselines) · [View on PyPI](https://pypi.org/project/pybaselines/)