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.

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.2.10

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.2.10
File Size Uploaded
nirs4all_formats-0.2.10.tar.gz 769.6 kB Details

Built distributions (wheels)

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

Total release size: 10.0 MB

Release files / nirs4all_formats-0.2.10.tar.gz

Download URL nirs4all_formats-0.2.10.tar.gz
Size 769.6 kB
Tags Source
SHA-256 checksum
How to use checksums
cdef46f4dce0ed1f804e3bd61cdd1599de071fff4397afce7d9f983dc2040036
BLAKE2b-256 checksum
How to use checksums
6e8bcec99c7e19663804eac9084db1cdbf84454e7e393fdf1b48bf4fac945521
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 17, 2026.

Transparency log

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

Download URL nirs4all_formats-0.2.10-cp310-abi3-win_amd64.whl
Size 4.4 MB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
4131c3d238226e85024c122e401c429884cac63efa44be945abcfe122b033683
BLAKE2b-256 checksum
How to use checksums
cdce5efde4111f1abafad1591e274e909a24cb9cb042978f09b6eb134389b308
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 17, 2026.

Transparency log

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

Download URL nirs4all_formats-0.2.10-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 4.9 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
4973f7a69610063368d3703b4c13abc737b955dac875e77ff0af0d35bb7b37f7
BLAKE2b-256 checksum
How to use checksums
3c7c84cdea40500fc58d55deb74f7ff64a145090995a4f2d53c26478ce42e9bc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 17, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.10 This release

3 release files

0.2.9

3 release files

0.2.8

3 release files

0.2.7

3 release files

0.2.6

3 release files

0.2.5

3 release files

0.2.4

3 release files

0.2.2

3 release files

0.2.1

3 release files

0.2.0

3 release files

0.1.0

3 release files

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