Fast hyperspectral data processing for remote sensing and ML pipelines
Project description
hyperspec
Fast hyperspectral data processing for remote sensing and ML pipelines. 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
SpectralCubeabstraction that keeps data, wavelengths, and metadata together - Zarr V3 storage with chunking optimized for ML dataloaders
- Python bindings with zero-copy NumPy interop
Install
Python:
pip install hyperspec-py
# or
uv add hyperspec-py
Rust:
cargo add hyperspec
or
[dependencies]
hyperspec = "0.7"
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=90, red=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, red) |
| 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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hyperspec_py-0.7.3.tar.gz.
File metadata
- Download URL: hyperspec_py-0.7.3.tar.gz
- Upload date:
- Size: 80.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4e19ca4492e34787310adbd4a8d87f4ea01e07fa181adafc6803802b900dc76f
|
|
| MD5 |
68aad061c4f43a949a795c7aa9a96a73
|
|
| BLAKE2b-256 |
4cd0a60721460f52c73cf9a3e347a4e2f9ce29ba8a676cfc2d8d7bb393833ac7
|
Provenance
The following attestation bundles were made for hyperspec_py-0.7.3.tar.gz:
Publisher:
publish.yml on hyperstateco/hyperspec
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hyperspec_py-0.7.3.tar.gz -
Subject digest:
4e19ca4492e34787310adbd4a8d87f4ea01e07fa181adafc6803802b900dc76f - Sigstore transparency entry: 1072916727
- Sigstore integration time:
-
Permalink:
hyperstateco/hyperspec@c3eaec0c7b4c7d3575a3d4055c866ebf2b3e9e7d -
Branch / Tag:
refs/tags/v0.7.3 - Owner: https://github.com/hyperstateco
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c3eaec0c7b4c7d3575a3d4055c866ebf2b3e9e7d -
Trigger Event:
release
-
Statement type:
File details
Details for the file hyperspec_py-0.7.3-cp313-cp313-win_amd64.whl.
File metadata
- Download URL: hyperspec_py-0.7.3-cp313-cp313-win_amd64.whl
- Upload date:
- Size: 2.9 MB
- Tags: CPython 3.13, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
894cc3267d1128fee142e490f375af4fb28761bef694ef1d79cf76bc33310abf
|
|
| MD5 |
a349e0ed7f370a0299706df1690b2874
|
|
| BLAKE2b-256 |
9c47a5fbacc00bd53aae5c7babbb08ba49659a382a885effd8f52ecb9bae06c6
|
Provenance
The following attestation bundles were made for hyperspec_py-0.7.3-cp313-cp313-win_amd64.whl:
Publisher:
publish.yml on hyperstateco/hyperspec
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hyperspec_py-0.7.3-cp313-cp313-win_amd64.whl -
Subject digest:
894cc3267d1128fee142e490f375af4fb28761bef694ef1d79cf76bc33310abf - Sigstore transparency entry: 1072916901
- Sigstore integration time:
-
Permalink:
hyperstateco/hyperspec@c3eaec0c7b4c7d3575a3d4055c866ebf2b3e9e7d -
Branch / Tag:
refs/tags/v0.7.3 - Owner: https://github.com/hyperstateco
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c3eaec0c7b4c7d3575a3d4055c866ebf2b3e9e7d -
Trigger Event:
release
-
Statement type:
File details
Details for the file hyperspec_py-0.7.3-cp313-cp313-manylinux_2_39_x86_64.whl.
File metadata
- Download URL: hyperspec_py-0.7.3-cp313-cp313-manylinux_2_39_x86_64.whl
- Upload date:
- Size: 3.6 MB
- Tags: CPython 3.13, manylinux: glibc 2.39+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d52af4aa976c2b9fbb91905b2bf770226ed02be62777eee4c8b1562f6da539ed
|
|
| MD5 |
2fe7d4e864b4b8453e83972a96255ee4
|
|
| BLAKE2b-256 |
db13cfc2503ec5cf975e730e9159d9c50f02c43d25b1d6c4a367f6069c85f592
|
Provenance
The following attestation bundles were made for hyperspec_py-0.7.3-cp313-cp313-manylinux_2_39_x86_64.whl:
Publisher:
publish.yml on hyperstateco/hyperspec
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hyperspec_py-0.7.3-cp313-cp313-manylinux_2_39_x86_64.whl -
Subject digest:
d52af4aa976c2b9fbb91905b2bf770226ed02be62777eee4c8b1562f6da539ed - Sigstore transparency entry: 1072916834
- Sigstore integration time:
-
Permalink:
hyperstateco/hyperspec@c3eaec0c7b4c7d3575a3d4055c866ebf2b3e9e7d -
Branch / Tag:
refs/tags/v0.7.3 - Owner: https://github.com/hyperstateco
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c3eaec0c7b4c7d3575a3d4055c866ebf2b3e9e7d -
Trigger Event:
release
-
Statement type:
File details
Details for the file hyperspec_py-0.7.3-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: hyperspec_py-0.7.3-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 2.5 MB
- Tags: CPython 3.13, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a69f98f60ea01bfdba1ac26dd12fc5b5b61f92480c0c62b619795c49822c9c5a
|
|
| MD5 |
59e09859c24be17a837b3efd68b7149b
|
|
| BLAKE2b-256 |
032cb99ab4992508e18030bd1d0828ffb50bb22fb08330c4ac6af3589af88ba5
|
Provenance
The following attestation bundles were made for hyperspec_py-0.7.3-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:
Publisher:
publish.yml on hyperstateco/hyperspec
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hyperspec_py-0.7.3-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl -
Subject digest:
a69f98f60ea01bfdba1ac26dd12fc5b5b61f92480c0c62b619795c49822c9c5a - Sigstore transparency entry: 1072916775
- Sigstore integration time:
-
Permalink:
hyperstateco/hyperspec@c3eaec0c7b4c7d3575a3d4055c866ebf2b3e9e7d -
Branch / Tag:
refs/tags/v0.7.3 - Owner: https://github.com/hyperstateco
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c3eaec0c7b4c7d3575a3d4055c866ebf2b3e9e7d -
Trigger Event:
release
-
Statement type:
File details
Details for the file hyperspec_py-0.7.3-cp313-cp313-macosx_11_0_arm64.whl.
File metadata
- Download URL: hyperspec_py-0.7.3-cp313-cp313-macosx_11_0_arm64.whl
- Upload date:
- Size: 2.8 MB
- Tags: CPython 3.13, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
920ebfe223b78c916fa0486079c23c7e426f88eab5558c5370fa0736f10ba2e1
|
|
| MD5 |
7d66c38864190bbf5a00c9ae2c1865c1
|
|
| BLAKE2b-256 |
6f71baa03a538a9ded685a75ef876bdf4876c8af41324f3b4582a22411e70ba2
|
Provenance
The following attestation bundles were made for hyperspec_py-0.7.3-cp313-cp313-macosx_11_0_arm64.whl:
Publisher:
publish.yml on hyperstateco/hyperspec
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hyperspec_py-0.7.3-cp313-cp313-macosx_11_0_arm64.whl -
Subject digest:
920ebfe223b78c916fa0486079c23c7e426f88eab5558c5370fa0736f10ba2e1 - Sigstore transparency entry: 1072917019
- Sigstore integration time:
-
Permalink:
hyperstateco/hyperspec@c3eaec0c7b4c7d3575a3d4055c866ebf2b3e9e7d -
Branch / Tag:
refs/tags/v0.7.3 - Owner: https://github.com/hyperstateco
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c3eaec0c7b4c7d3575a3d4055c866ebf2b3e9e7d -
Trigger Event:
release
-
Statement type:
File details
Details for the file hyperspec_py-0.7.3-cp313-cp313-macosx_10_12_x86_64.whl.
File metadata
- Download URL: hyperspec_py-0.7.3-cp313-cp313-macosx_10_12_x86_64.whl
- Upload date:
- Size: 3.2 MB
- Tags: CPython 3.13, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
036c672b2bbd614f8fb462316327b42580529ea1c119d5ebeec0c8445a926248
|
|
| MD5 |
25391c55595538dcd8f12d4c972d506f
|
|
| BLAKE2b-256 |
d5966439b58d1db6855a143c6a63714e6393d11e622bf3e738603b5c07bc89bc
|
Provenance
The following attestation bundles were made for hyperspec_py-0.7.3-cp313-cp313-macosx_10_12_x86_64.whl:
Publisher:
publish.yml on hyperstateco/hyperspec
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hyperspec_py-0.7.3-cp313-cp313-macosx_10_12_x86_64.whl -
Subject digest:
036c672b2bbd614f8fb462316327b42580529ea1c119d5ebeec0c8445a926248 - Sigstore transparency entry: 1072916968
- Sigstore integration time:
-
Permalink:
hyperstateco/hyperspec@c3eaec0c7b4c7d3575a3d4055c866ebf2b3e9e7d -
Branch / Tag:
refs/tags/v0.7.3 - Owner: https://github.com/hyperstateco
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c3eaec0c7b4c7d3575a3d4055c866ebf2b3e9e7d -
Trigger Event:
release
-
Statement type: