Skip to main content

nirs4all-formats (Python)

Python bindings for nirs4all-formats, the Rust-first low-level reader for NIRS and spectroscopy file formats. It reads ~58 format families, auto-detecting each file by content, and projects the canonical records into numpy / pandas / polars / sklearn / torch / xarray or a nirs4all SpectroDataset.

Parsers live entirely in the Rust core — this package is a thin, lossless surface over it.

Install

pip install nirs4all-formats                                  # Python 3.10+
pip install nirs4all-formats                                  # includes NumPy
pip install "nirs4all-formats[pandas,sklearn,torch]"          # other projection extras

to_polars() needs polars, to_xarray() needs xarray, and to_spectrodataset() needs nirs4all.

Quick start

import nirs4all_formats as nio

# Probe: which reader will handle this file, and why?
nio.probe_path("spectrum.jdx")

# Lossless object model — every signal, axis, coord, metadata and provenance
rs = nio.open_recordset("spectrum.sed")
rs.signal_names()

# Modelling-ready projections (explicit; may be lossy)
X, axis = rs.to_numpy(signal="reflectance")   # (X[n_samples, n_features], axis)
df      = rs.to_pandas()                        # wide: metadata + x_<axis> columns
bunch   = rs.to_sklearn(signal="reflectance", target="protein")

API at a glance

Raw access (records exactly as the Rust core emits them, as dicts): open_records, open_bytes, open_with_sidecars, probe_path, walk_path.

Exports (see Exports): export_targets, write_records, convert_path (native extension only).

Object model: open_recordset(path) -> SpectralRecordSet with dataclasses SpectralRecord, SpectralArray, SpectralAxis, SourceFile, Provenance.

Projections on SpectralRecordSet: to_numpy, to_pandas, to_pandas_long, to_polars, to_sklearn, to_torch, to_spectrodataset; SpectralArray.to_xarray() for N-dimensional signals (cubes, maps, series).

Image-cube readers accept pixel selection: rows=/cols= (rectangular ROI), pixels=[(r, c), …] (sparse), or single_record=True to keep the spatial grid.

A native PyO3 extension (nirs4all_formats._native) is used when present; otherwise the bridge falls back to the nirs4all-formats CLI (NIRS4ALL_FORMATS_CLI can point to a prebuilt binary).

Documentation

Full reference: https://github.com/GBeurier/nirs4all-formats/blob/main/docs/bindings/python.md. The usage guide, supported-format catalogue and data model live in the project docs.

License

CeCILL-2.1 OR AGPL-3.0-or-later. See the repository LICENSING.md.

Metadata

Release files for nirs4all-formats 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nirs4all-formats 0.3.0
File Size Uploaded Provenance Actions
nirs4all_formats-0.3.0.tar.gz 1.2 MB With provenance Details for nirs4all_formats-0.3.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for nirs4all-formats 0.3.0
File Interpreter ABI Platform Actions
nirs4all_formats-0.3.0-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details for nirs4all_formats-0.3.0-cp310-abi3-win_amd64.whl
nirs4all_formats-0.3.0-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.10 abi3 Linux glibc 2.17+ x86-64 Details for nirs4all_formats-0.3.0-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
nirs4all_formats-0.3.0-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details for nirs4all_formats-0.3.0-cp310-abi3-macosx_11_0_arm64.whl

Total release size: 17.7 MB

Release files / nirs4all_formats-0.3.0.tar.gz

Download URL nirs4all_formats-0.3.0.tar.gz
Size 1.2 MB
Tags Source
SHA-256 checksum
How to use checksums
0c13e728612d015da59b88eaeb3eb9389b14f5b10543590f6be0318ee8e46674
BLAKE2b-256 checksum
How to use checksums
a7742f4c8fb1ffbb6c751f8e817c54af6b26f7bfc1a2a882b7b34d0303d94f5b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

Release files / nirs4all_formats-0.3.0-cp310-abi3-win_amd64.whl

Download URL nirs4all_formats-0.3.0-cp310-abi3-win_amd64.whl
Size 5.4 MB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
fc7ae4961132d30c464e41fab814c1c1d70ad8552c454e5dde4339a616410e16
BLAKE2b-256 checksum
How to use checksums
88bac0ae0780cdc208bd159083966de375ec8406d88538189c53e9b1a1d9dcea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

Release files / nirs4all_formats-0.3.0-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL nirs4all_formats-0.3.0-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 6.0 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
763751392d58ea9bb2c60b28cc82e5ace955ac1a400872642a726f4cf84a3871
BLAKE2b-256 checksum
How to use checksums
a4d3ee4cec2079978e70053f1f4c1a5c9e83d8d17bab4dc85c4049e52da31497
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

Release files / nirs4all_formats-0.3.0-cp310-abi3-macosx_11_0_arm64.whl

Download URL nirs4all_formats-0.3.0-cp310-abi3-macosx_11_0_arm64.whl
Size 5.2 MB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
9a0bffe462a69609e60920b8ec8d0d32d2eef63aafffb7c3ae2c41fb989e004a
BLAKE2b-256 checksum
How to use checksums
c21b1594179254527b56dbd2989bfe4e7374a8c075b1050cff7ff0d35eef5344
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

Security for nirs4all-formats 0.3.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.

Full provenance

All 4 files in this release have been uploaded with provenance metadata.

Select from 4 files

Attestation for nirs4all_formats-0.3.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page