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.

Download files

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

Source Distribution

nirs4all_formats-0.2.9.tar.gz (770.0 kB view details)

Uploaded Source

Built Distributions

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

nirs4all_formats-0.2.9-cp310-abi3-win_amd64.whl (4.2 MB view details)

Uploaded CPython 3.10+Windows x86-64

nirs4all_formats-0.2.9-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ x86-64

File details

Details for the file nirs4all_formats-0.2.9.tar.gz.

File metadata

  • Download URL: nirs4all_formats-0.2.9.tar.gz
  • Upload date:
  • Size: 770.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for nirs4all_formats-0.2.9.tar.gz
Algorithm Hash digest
SHA256 09a1b4f211f916c8d08c8104206447f22889973c8d57ad45677702d5d7f5bdcd
MD5 d54635cc3b5ee1ae0a1df8c9afba3628
BLAKE2b-256 911765b930ef0904a3e49b17586da6c30284baa525d7b56b76385bd15546f475

See more details on using hashes here.

Provenance

The following attestation bundles were made for nirs4all_formats-0.2.9.tar.gz:

Publisher: release.yml on GBeurier/nirs4all-formats

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

File details

Details for the file nirs4all_formats-0.2.9-cp310-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for nirs4all_formats-0.2.9-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 fa654776182c65102813654e1425c06ad520fce5d00ba31052d660839dce7852
MD5 57b84f43cc7b7b5501faf3783d9b7056
BLAKE2b-256 ac6624a44aafd45d2598b8638e87a5b1230272b5580d9b3c62badfe891367ac2

See more details on using hashes here.

Provenance

The following attestation bundles were made for nirs4all_formats-0.2.9-cp310-abi3-win_amd64.whl:

Publisher: release.yml on GBeurier/nirs4all-formats

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

File details

Details for the file nirs4all_formats-0.2.9-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for nirs4all_formats-0.2.9-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 e47467a8d7a7b53d4267a6d9be717f616c1a51bbe2ea1e93841a0ab14ecb288e
MD5 35756e1b0dd05ad3a64c32967460a518
BLAKE2b-256 e47ef13ea6fcf41f7849f761c06d2410b1953b0ffd9eed64c461cfcdf2e72527

See more details on using hashes here.

Provenance

The following attestation bundles were made for nirs4all_formats-0.2.9-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl:

Publisher: release.yml on GBeurier/nirs4all-formats

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

Release history Release notifications | RSS feed

This release

0.2.9 This release

3 files

0.2.8

3 files

0.2.7

3 files

0.2.6

3 files

0.2.5

3 files

0.2.4

3 files

0.2.2

3 files

0.2.1

3 files

0.2.0

3 files

0.1.0

3 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