PioNIR
PioNIR is a Python library designed for the processing and analysis of near-infrared (NIR) spectra. It offers a suite of chemometric tools for preprocessing, modeling, and evaluation, facilitating the development of spectroscopy workflows. The library tightly integrates with the scientific Python ecosystem, with NumPy, SciPy, and scikit-learn.
Installation
The latest release is available on PyPI and can be installed via pip.
pip install pionir
For development purposes, use uv to manage the installation.
uv sync --dev
The project uses ruff for linting and formatting, ty for type checking, and pytest for testing.
uvx ruff check src
uvx ty check src
uv run pytest
Features
Data Representation
PioNIR provides specialized Spectrum and SpectrumCollection classes to handle NIR spectra. These classes serve as the foundation for handling individual measurements and larger datasets within the library.
from pionir import Spectrum, SpectrumCollection, Metadata
# x, y: NumPy ndarrays
s = Spectrum(x=..., y=..., metadata=...) # Single spectrum
c = SpectrumCollection([s]) # Collection of spectra
Unified Interface with Single Dispatch
PioNIR uses a single dispatch approach, allowing the same function interface to handle both individual Spectrum objects and SpectrumCollection instances as well as plain NumPy ndarray.
from pionir import Spectrum, SpectrumCollection
from pionir.scatter import snv
s = Spectrum(...)
c = SpectrumCollection(...)
# The same function handles both single spectra and collections
s_snv = snv(s)
c_snv = snv(c)
scikit-learn Integration
The library is designed for compatibility with scikit-learn, providing transformers that can be directly incorporated into pipelines.
from sklearn.decomposition import PCA
from sklearn.linear_model import LinearRegression
from sklearn.pipeline import Pipeline
from pionir import SpectrumCollection
from pionir.sklearn.transformer import SNVTransformer
c = SpectrumCollection([...])
pcr_pipeline = Pipeline([
("snv", SNVTransformer()),
("pca", PCA(n_components=5)),
("regression", LinearRegression())
])
pcr_pipeline.fit(c.y, ...)
pcr_pipeline.predict(...)
Metadata
Release files for pionir 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| pionir-0.1.0.tar.gz | 13.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pionir-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 36.4 kB
Release files / pionir-0.1.0.tar.gz
| Download URL | pionir-0.1.0.tar.gz |
|---|---|
| Size | 13.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
001627f8cb3b06a695ac5f7884649524861a9bc081a580e2c4d4184ae9931510
|
|
BLAKE2b-256 checksum How to use checksums |
29c5dca7f80a4eb0113266bc70693ca45693f79e52d53b5762b8b03b2972955a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / pionir-0.1.0-py3-none-any.whl
| Download URL | pionir-0.1.0-py3-none-any.whl |
|---|---|
| Size | 22.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
809777fc62c77d94082607e775f787b1ab34321c9d1b7d9187c8ae57d2c8b180
|
|
BLAKE2b-256 checksum How to use checksums |
50ae59ba8c49c4f391a17de659ebf6f0bdf507db114bcebe2f050f7488ff5916
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for pionir 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.