Skip to main content

chemotools: A Python Package that Integrates Chemometrics and scikit-learn

Project description

chemotools

chemotools

PyPI Python Versions License Coverage Downloads DOI CodeFactor


chemotools is a Python library that brings chemometric preprocessing tools into the scikit-learn ecosystem.

It provides modular transformers for spectral data, designed to plug seamlessly into your ML workflows.

Features

  • Preprocessing for spectral data (baseline correction, smoothing, scaling, derivatization, scatter correction).
  • Physical unit conversions (absorbance, transmittance, reflectance, Kubelka-Munk, pseudoabsorbance).
  • Adaptation methods for calibration transfer between instruments (DS, PDS, x-axis interpolation).
  • Fully compatible with scikit-learn pipelines and transformers.
  • Simple, modular API for flexible workflows.
  • Open-source, actively maintained, and published on PyPI and Conda.

Installation

Install from PyPI:

pip install chemotools

Install from Conda:

conda install -c conda-forge chemotools

Usage

Example: preprocessing pipeline with scikit-learn:

from sklearn.preprocessing import StandardScaler
from sklearn.pipeline import make_pipeline

from chemotools.baseline import AirPls
from chemotools.scatter import MultiplicativeScatterCorrection

preprocessing = make_pipeline(
    AirPls(),
    MultiplicativeScatterCorrection(),
    StandardScaler(with_std=False),
)

spectra_transformed = preprocessing.fit_transform(spectra)

➡️ See the documentation for full details.

Development

This project uses uv for dependency management and Task to simplify common development workflows. You can get started quickly by using the predefined Taskfile, which provides handy shortcuts such as:

task install     # install all dependencies
task check       # run formatting, linting, typing, and tests
task test        # quick test run in the current environment
task test:matrix # run the nox compatibility matrix locally
task coverage    # run tests with coverage reporting
task build       # build the package for distribution

For compatibility testing across supported Python versions, use nox:

uv run nox --list               # show available sessions
uv run nox -s tests-3.12       # run tests on a specific Python version
uv run nox -s tests-min-sklearn-3.10
uv run nox -s tests-min-sklearn-3.12

Contributing

Contributions are welcome! Check out the contributing guide and the project board.

License

Released under the MIT License.

Compliance and Software Supply Chain Management

This project embraces software supply chain transparency by generating an SBOM (Software Bill of Materials) for all dependencies. SBOMs help organizations, including those in regulated industries, track open-source components, ensure compliance, and manage security risks.

The SBOM file is made public as an asset attached to every release. It is generated using CycloneDX SBOM generator for Python, and can be vsualized in tools like CycloneDX Sunshine.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

chemotools-0.4.2.tar.gz (48.0 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

chemotools-0.4.2-py3-none-any.whl (7.7 MB view details)

Uploaded Python 3

File details

Details for the file chemotools-0.4.2.tar.gz.

File metadata

  • Download URL: chemotools-0.4.2.tar.gz
  • Upload date:
  • Size: 48.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for chemotools-0.4.2.tar.gz
Algorithm Hash digest
SHA256 d3aa15cbd6db4220511793c3dc231bf8e4f9c6fdde1d94f6e7cc2796d3d941d2
MD5 28257e0890913b4a7e2d7ab6cf078baf
BLAKE2b-256 b11c4ecbcddb97b916a03a896c4eba453be6adb43eda86f0f5b4f710364fe139

See more details on using hashes here.

Provenance

The following attestation bundles were made for chemotools-0.4.2.tar.gz:

Publisher: python-release.yml on paucablop/chemotools

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file chemotools-0.4.2-py3-none-any.whl.

File metadata

  • Download URL: chemotools-0.4.2-py3-none-any.whl
  • Upload date:
  • Size: 7.7 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for chemotools-0.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f7a5783fb41990e5fc829ad64dc97d7001cc1df0ea9d8d0a31e022f4717d8572
MD5 727f179f0ba8b73db2b6ed0a12bea7a8
BLAKE2b-256 2d33fbf4415aa208677e82ec537261298c306266c4d6c5fd257470dd6124c000

See more details on using hashes here.

Provenance

The following attestation bundles were made for chemotools-0.4.2-py3-none-any.whl:

Publisher: python-release.yml on paucablop/chemotools

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page