Skip to main content

hyperspec

Crates.io PyPI License

Fast hyperspectral processing for remote sensing and machine learning. Rust core with Python bindings.

Built by Hyperstate — foundation models for Earth intelligence.

Why hyperspec?

Hyperspectral imagery produces hundreds of bands per pixel, orders of magnitude more than RGB or multispectral. Most existing tools are slow, have heavy system dependencies, and were not designed for modern ML training pipelines.

hyperspec provides:

  • Fast Rust implementations of standard hyperspectral algorithms
  • A SpectralCube abstraction that keeps data, wavelengths, and metadata together
  • Zarr V3 storage with chunking optimized for ML dataloaders
  • Python bindings with efficient NumPy interop

Install

Python:

pip install hyperspec-py
# or
uv add hyperspec-py

Rust:

cargo add hyperspec

or

[dependencies]
hyperspec = "0.8"

Quickstart

from hyperspec import (
    read_envi, write_zarr, read_zarr_window,
    band_stats, covariance,
    mnf_denoise, savitzky_golay, derivative, continuum_removal, normalize_zscore,
    sam, ndvi, pca,
)

# --- I/O ---

cube = read_envi("scene.hdr")

# --- Exploration ---

stats = band_stats(cube)        # .mean, .std, .min, .max, .valid_count
cov = covariance(cube)          # (bands, bands) covariance matrix

# --- Preprocessing ---

clean = mnf_denoise(cube, n_components=20)  # denoise first
smooth = savitzky_golay(clean, window=7, polyorder=2)
d1 = derivative(smooth, order=1)
cr = continuum_removal(clean)
normed = normalize_zscore(clean)

# --- Analysis ---

reference = normed.spectrum(50, 50)
angles = sam(normed, reference)             # spectral similarity
veg = ndvi(normed, nir_band=90, red_band=55)  # vegetation index
pca_result = pca(normed, n_components=10)   # dimensionality reduction

# --- Storage ---

write_zarr(normed, "chips.zarr", chunk_shape=(normed.bands, 256, 256))
tile = read_zarr_window("chips.zarr", bands=(0, normed.bands), rows=(0, 256), cols=(0, 256))

SpectralCube

Category Methods
Dimensions bands, height, width, shape
Data access data(), wavelengths(), fwhm(), nodata
Pixel access spectrum(row, col)
Band access band(index), band_at(nm), band_nearest(nm)
Wavelength lookup wavelength(index), wavelength_index(nm), nearest_band_index(nm)
Statistics mean_spectrum()
Subsetting sel_bands([i, j]), sel_wavelengths(min, max)

I/O

Read

Format Function
ENVI read_envi(path)
Zarr V3 read_zarr(path)
Zarr V3 read_zarr_with_options(path, ...)
Zarr V3 read_zarr_window(path, bands, rows, cols)
Zarr V3 zarr_cube_shape(path)

Write

Format Function
ENVI write_envi(cube, path)
Zarr V3 write_zarr(cube, path)

Algorithms

Exploration

Operation Function
Per-band stats band_stats(cube) → BandStats
Covariance matrix covariance(cube)
Correlation matrix correlation(cube)

Preprocessing

Operation Function
MNF denoise mnf_denoise(cube, n_components)
MNF mnf(cube, n_components)
Savitzky-Golay smoothing savitzky_golay(cube, window, polyorder)
Derivative spectra derivative(cube, order)
Continuum removal continuum_removal(cube)
Min-max normalization normalize_minmax(cube)
Z-score normalization normalize_zscore(cube)
Resample resample(cube, target_wl, method)

Analysis

Operation Function
Spectral Angle Mapper sam(cube, reference)
Normalized difference normalized_difference(cube, a, b)
Band ratio band_ratio(cube, a, b)
NDVI ndvi(cube, nir_band, red_band)
PCA pca(cube, n_components)

Architecture

crates/hyperspec/           # Pure Rust library → crates.io
└── src/
    ├── cube.rs             # SpectralCube type
    ├── error.rs            # HyperspecError
    ├── io/
    │   ├── envi.rs         # ENVI read/write (BSQ, BIL, BIP)
    │   └── zarr.rs         # Zarr V3 read/write/window
    ├── linalg.rs           # Matrix ops (faer): eigen, covariance, tiled GEMM
    └── algorithms/
        ├── sam.rs
        ├── continuum.rs
        ├── indices.rs
        ├── pca.rs
        ├── mnf.rs
        ├── resample.rs
        ├── stats.rs
        ├── normalize.rs
        ├── derivative.rs
        └── smooth.rs

pyo3-hyperspec/             # PyO3 bindings → PyPI: hyperspec-py
├── src/lib.rs
└── python/hyperspec/
    └── __init__.py
  • Rust 2024 edition, using ndarray, rayon, faer, zarrs, thiserror
  • Minimal system dependencies — no LAPACK or GDAL
  • Python 3.12+, NumPy bindings via PyO3

Roadmap

  • Cloud-native Zarr stores (Azure, GCS, S3)
  • More algorithms and utilities

Development

uv venv && source .venv/bin/activate
uv pip install maturin pytest
cargo test
maturin develop
pytest

License

Apache-2.0

Metadata

Release files for hyperspec-py 0.8.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 hyperspec-py 0.8.0
File Size Uploaded Provenance
hyperspec_py-0.8.0.tar.gz 81.4 kB With provenance Details

Built distributions (wheels)

Table of built distributions (wheels) for hyperspec-py 0.8.0
File
hyperspec_py-0.8.0-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details
hyperspec_py-0.8.0-cp313-cp313-manylinux_2_39_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.39+ x86-64 Details
hyperspec_py-0.8.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.13 CPython 3.13 Linux glibc 2.17+ ARM64 Details
hyperspec_py-0.8.0-cp313-cp313-macosx_11_0_arm64.whl CPython 3.13 CPython 3.13 macOS 11.0+ ARM64 Details
hyperspec_py-0.8.0-cp313-cp313-macosx_10_12_x86_64.whl CPython 3.13 CPython 3.13 macOS 10.12+ x86-64 Details

Total release size: 15.1 MB

Release files / hyperspec_py-0.8.0.tar.gz

Download URL hyperspec_py-0.8.0.tar.gz
Size 81.4 kB
Tags Source
SHA-256 checksum
How to use checksums
707e34fb3e24a3df895e03e35c9e8db781f940e99c27787b8cc867698f0ca843
BLAKE2b-256 checksum
How to use checksums
c695903aa80c8385b32413d497c2305b591802c48c60c1db116e8d8ca7d6cbcd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Mar 15, 2026.

Transparency log

Release files / hyperspec_py-0.8.0-cp313-cp313-win_amd64.whl

Download URL hyperspec_py-0.8.0-cp313-cp313-win_amd64.whl
Size 2.9 MB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
8f310d33970449cf1abf1ab1471d448c9e517147d5e7ffbe912ca393343444ff
BLAKE2b-256 checksum
How to use checksums
0fa94965342c7297d990d389b988631ef5c48ebd4c8f4982ae7e6917698be7e6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Mar 15, 2026.

Transparency log

Release files / hyperspec_py-0.8.0-cp313-cp313-manylinux_2_39_x86_64.whl

Download URL hyperspec_py-0.8.0-cp313-cp313-manylinux_2_39_x86_64.whl
Size 3.6 MB
Tags CPython 3.13 Linux glibc 2.39+ x86-64
SHA-256 checksum
How to use checksums
b9e3f72556ddb7d77e9888d67cb6728733bec50dcb0fb07a77745d065fd608d7
BLAKE2b-256 checksum
How to use checksums
aa0e6190b3042b5b3c4141a4500e076003591391a1e58ce22c8c2403152d0197
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Mar 15, 2026.

Transparency log

Release files / hyperspec_py-0.8.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL hyperspec_py-0.8.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 2.5 MB
Tags CPython 3.13 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
c8c50aae3d9ca8eb15f1154d2b4acafd90b38a278981c3723428cd88983694b8
BLAKE2b-256 checksum
How to use checksums
522eaefe7f35e5ee349b0ad03343275d3d28fdcda8a4d87d6eaa27c3da99590c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Mar 15, 2026.

Transparency log

Release files / hyperspec_py-0.8.0-cp313-cp313-macosx_11_0_arm64.whl

Download URL hyperspec_py-0.8.0-cp313-cp313-macosx_11_0_arm64.whl
Size 2.8 MB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
ce434658429fddb31e76a0384e16bc934b8986a5b09c23a3d89113935ff86a37
BLAKE2b-256 checksum
How to use checksums
57a4773b4b5157de0055411048ebcc416fa68508ec9f6cbceae09f4f40ac083b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Mar 15, 2026.

Transparency log

Release files / hyperspec_py-0.8.0-cp313-cp313-macosx_10_12_x86_64.whl

Download URL hyperspec_py-0.8.0-cp313-cp313-macosx_10_12_x86_64.whl
Size 3.2 MB
Tags CPython 3.13 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
762a964ccb4fce0dc3add207d7fb0a40821edcbf043323f717715690bb31b29a
BLAKE2b-256 checksum
How to use checksums
be6f2fcee5d5c966dcbe8c91a44224ad50303ef227357674a51c280c2ca4be3a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Mar 15, 2026.

Transparency log

Security for hyperspec-py 0.8.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 6 files in this release have been uploaded with provenance metadata.

Select from 6 files

Attestation for hyperspec_py-0.8.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 Mar 15, 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