Open spectroscopy for everyone

From raw spectra to deployed models — a comprehensive Python framework and desktop application for Near-Infrared Spectroscopy, built by researchers, shared with the world.

Active Development version 0.8.8 python 3.11 · 3.12 · 3.13 license CeCILL-2.1 pypi nirs4all status Beta
The ecosystem

Two tools, one ecosystem

nirs4all provides both a powerful Python library for developers and researchers, and a full-featured desktop application for interactive exploration.

nirs4all · Python Library

A comprehensive Python framework for Near-Infrared Spectroscopy analysis. Build declarative ML pipelines with 30+ preprocessing transforms, 15+ advanced PLS models, and multi-backend support for scikit-learn, TensorFlow, PyTorch, and JAX. Export trained pipelines as portable .n4a bundles ready for deployment.

nirs4all Studio · Desktop App

A modern desktop application for interactive spectral data exploration and model building. Features a drag-and-drop pipeline builder, real-time spectral visualization, SHAP variable importance analysis, and a native desktop experience powered by Electron — with GPU acceleration support on Windows, Linux, and macOS.

nirs4all Studio

See it in action

Interactive desktop application for exploring data, building pipelines, and analyzing results — no code required.

Capabilities

Everything spectroscopy needs

Built specifically for NIRS workflows — not generic ML tools adapted for spectra.

30+ Spectral Preprocessing Transforms

Comprehensive NIRS-specific preprocessing including wavelength-aware operators that automatically receive wavelength information.

SNVMSCSavitzky-Golay OSCEPOWavelet BaselineCARSMCUVE

15+ Advanced PLS Models

State-of-the-art Partial Least Squares variants with automatic operator selection via AOM-PLS for optimal model performance.

PLSPLS-DA NLPLSPLS-DA AOM-PLSFCK-PLSOPLS DiPLSMBPLSPCR

Multi-Backend Machine Learning

Unified API across all major ML frameworks. Swap backends without changing your pipeline code.

scikit-learnTensorFlow PyTorchJAXAutoGluon

Declarative Pipeline Syntax

Express complex workflows — branching, merging, hyperparameter sweeps, cross-validation — with a concise, readable list syntax. Parallel execution via joblib.

_or__range_branch mergeOptuna

SHAP Explainability

Full scikit-learn compatibility enables SHAP integration for spectral band importance visualization, prediction diagnostics, and model transparency.

SHAPVariable Importance sklearn compatible

Portable Model Bundles

Export entire trained pipelines as .n4a bundles for seamless deployment and sharing. Includes predict, explain, and retrain capabilities.

.n4a exportpredict() explain()retrain()
Real-world impact

Where NIRS makes a difference

Near-infrared spectroscopy provides rapid, non-destructive analysis across industries — from field to laboratory.

Agriculture & Crops

Crop quality assessment, soil composition analysis, and phenotyping for plant breeding programs.

Grain Quality Soil Analysis Phenotyping

Food Quality & Safety

Rapid authentication, composition analysis, and quality grading of food products and raw materials.

Authenticity Composition Grading

Research & Pharma

Pharmaceutical process monitoring, chemical analysis, and materials characterization in research laboratories.

Process Control QC/QA Materials
Installation

Get started in seconds

Install from PyPI — no configuration required. Add optional extras for deep learning backends.

# Core library
pip install nirs4all

# With PyTorch backend
pip install nirs4all[torch]

# With TensorFlow backend
pip install nirs4all[tensorflow]

# All backends (sklearn + TF + PyTorch + JAX)
pip install nirs4all[all]

# GPU/CUDA acceleration
pip install nirs4all[all-gpu]
import nirs4all

# Run a pipeline on your spectral data
result = nirs4all.run(
    pipeline=[SNV(), PLSRegression(10)],
    dataset="data.csv"
)

# Inspect results
print(result.best_rmse)
print(result.top(5))

# Deploy the best model
result.export("best_model.n4a")

# Predict on new spectra
preds = nirs4all.predict("best_model.n4a", new_data)
import nirs4all

# Preprocessing variants × PLS sweep on n_components
pipeline_1 = [
    {"_or_": [SNV, MSC, Detrend]},
    {"model": {
        "type": PLSRegression,
        "param": {"n_components": {"_range_": [2, 20, 5]}
      }
    }
]

# Stacking: compare PLS vs RF in branches, then merge + meta-learner
pipeline_2 = [
    {"branch": [
        [SNV(), {"model": PLSRegression(10)}],
        [MSC(), {"model": RandomForestRegressor()}],
    ]},
    {"merge": "predictions"},
    {"model": Ridge()},  # meta-learner trained on stacked predictions
]

results = nirs4all.run(pipeline=[pipeline_1, pipeline_2], dataset="data.csv")
Makers

The team

Researchers and engineers from the PHENOMEN team at CIRAD / UMR AGAP Institut, building open-source tools for spectroscopy science.

Gregory Beurier

Gregory Beurier

Co-founder & Lead Developer
CIRAD · UMR AGAP Institut
AI Modelization Dev Optimization
Denis Cornet

Denis Cornet

Co-founder & Product Owner
CIRAD · UMR AGAP Institut
Ecophysiology Data Science Chemometrics
Lauriane Rouan

Lauriane Rouan

Co-founder & Contributor
CIRAD · UMR AGAP Institut
Biostatistics Data Science Optimization
Home

Institutions

nirs4all is developed at CIRAD within the UMR AGAP Institut — a research center dedicated to plant genetics, genomics, and agro-resources.

The French Agricultural Research Centre for International Development — a research organization working with developing countries to tackle international agricultural and development challenges.

Visit CIRAD →

Amélioration Génétique et Adaptation des Plantes méditerranéennes et tropicales — a joint research unit focused on plant genetic improvement, genomics, and adaptation for Mediterranean and tropical species.

Visit UMR AGAP →
Research

Publications

Research using nirs4all and related spectroscopic analysis.

2024
Prediction of yam amylose content using near-infrared spectroscopy and convolutional neural networks
Beurier G., Cornet D., Rouan L. et al.
Journal of the Science of Food and Agriculture, 2024
Cite this software
@software{beurier2025nirs4all,
  author  = {Gregory Beurier and Denis Cornet and Lauriane Rouan},
  title   = {NIRS4ALL: Open spectroscopy for everyone},
  url     = {https://github.com/GBeurier/nirs4all},
  version = {0.8.8},
  year    = {2026},
}