Spectral library build, preparation, and retrieval-based mapping toolkit.
Project description
Spectral Library
spectral-library is a Python package and CLI for:
- preparing row-aligned runtime artifacts from a SIAC spectral-library export,
- mapping source-sensor reflectance to target sensors,
- reconstructing VNIR, SWIR, or full hyperspectral outputs with retrieval-based spectral mapping.
The public names are:
- distribution:
spectral-library - import package:
spectral_library - CLI:
spectral-library - license:
MITfor repository software and repository-authored docs
Start Here
- published docs site: https://marcyin.github.io/spectral_library/
- overview:
docs/index.md - getting started:
docs/mapping_quickstart.md - mathematical foundations:
docs/theory.md - official sensor examples:
docs/official_sensor_examples.md - public CLI reference:
docs/cli_reference.md - public Python API reference:
docs/python_api_reference.md - prepared-runtime contract:
docs/prepared_runtime_contract.md - internal maintainer docs:
docs/internal_overview.md
Install
Install from this repository in a Python 3.9+ environment:
python3 -m pip install .
Supported Python versions in CI are 3.9, 3.10, 3.11, and 3.12.
The same documentation set is published to GitHub Pages from this repository.
For the retained internal normalization and QA commands, install the optional internal-build dependencies:
python3 -m pip install ".[internal-build]"
This extra is also required if you want to regenerate the bundled official
sensor example assets with scripts/build_official_mapping_examples.py.
For the static documentation site and GitHub Pages build path, install:
python3 -m pip install ".[docs]"
The published docs site is built with MkDocs from mkdocs.yml.
For the optional SciPy cKDTree shortlist backend, install:
python3 -m pip install ".[knn]"
Additional optional ANN backends are available with:
python3 -m pip install ".[knn-faiss]"
python3 -m pip install ".[knn-pynndescent]"
python3 -m pip install ".[knn-scann]"
Minimal Example
Prepare a mapping runtime:
spectral-library prepare-mapping-library \
--siac-root build/siac_library \
--srf-root path/to/srfs \
--source-sensor SENSOR_A \
--knn-index-backend faiss \
--output-root build/mapping_runtime
Validate it:
spectral-library validate-prepared-library \
--prepared-root build/mapping_runtime
Map one reflectance sample:
spectral-library map-reflectance \
--prepared-root build/mapping_runtime \
--source-sensor SENSOR_A \
--target-sensor SENSOR_B \
--input path/to/query.csv \
--output-mode target_sensor \
--output path/to/mapped.csv
Map many samples from one CSV:
spectral-library map-reflectance-batch \
--prepared-root build/mapping_runtime \
--source-sensor SENSOR_A \
--target-sensor SENSOR_B \
--input path/to/query_batch.csv \
--output-mode target_sensor \
--output path/to/mapped_batch.csv
The detailed quickstart, supported CSV layouts, Python API examples, SRF JSON
schema, and prepared-runtime contract are documented in
docs/mapping_quickstart.md.
For larger prepared runtimes, the repository also ships
scripts/run_full_library_benchmarks.py
plus the scheduled/manual GitHub Actions workflow
full-library-benchmarks.yml.
Use --max-test-rows to keep held-out benchmark runs bounded on large
prepared libraries.
For reproducible cross-sensor examples built from official MODIS, Sentinel-2A,
Landsat 8, and Landsat 9 response functions, see
docs/official_sensor_examples.md and the
bundled example assets in
examples/official_mapping. Those
official examples expect the previously composed full SIAC library recorded in
the example manifest, rather than a vendored mini runtime.
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 Distribution
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 spectral_library-0.2.0.tar.gz.
File metadata
- Download URL: spectral_library-0.2.0.tar.gz
- Upload date:
- Size: 129.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
00683f8d36b3aa85d07e3cd5fe871525f567749ccc75c8e2f99b5ca16f27472d
|
|
| MD5 |
3208cd9db1d7aaf8b08ac98eb5cb634b
|
|
| BLAKE2b-256 |
092b5b49baeb84ee40f94956112e3bccb60340f76caa17ee641e2e8145c33849
|
Provenance
The following attestation bundles were made for spectral_library-0.2.0.tar.gz:
Publisher:
release-package.yml on MarcYin/spectral_library
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
spectral_library-0.2.0.tar.gz -
Subject digest:
00683f8d36b3aa85d07e3cd5fe871525f567749ccc75c8e2f99b5ca16f27472d - Sigstore transparency entry: 1112504450
- Sigstore integration time:
-
Permalink:
MarcYin/spectral_library@0a99335cfa801efb03b0ac5f0c1faa79693c3dad -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/MarcYin
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-package.yml@0a99335cfa801efb03b0ac5f0c1faa79693c3dad -
Trigger Event:
push
-
Statement type:
File details
Details for the file spectral_library-0.2.0-py3-none-any.whl.
File metadata
- Download URL: spectral_library-0.2.0-py3-none-any.whl
- Upload date:
- Size: 91.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
adc0c0944781bf7f51d6d61c9eaef62f7afd1a3e9a315516a795db9aca69a0c4
|
|
| MD5 |
73c76c84e44fa6186617c1f31de892be
|
|
| BLAKE2b-256 |
50fb5eba8026aee278a36de4458cbb43fc805dac73bc3f4982a333157e28e323
|
Provenance
The following attestation bundles were made for spectral_library-0.2.0-py3-none-any.whl:
Publisher:
release-package.yml on MarcYin/spectral_library
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
spectral_library-0.2.0-py3-none-any.whl -
Subject digest:
adc0c0944781bf7f51d6d61c9eaef62f7afd1a3e9a315516a795db9aca69a0c4 - Sigstore transparency entry: 1112504452
- Sigstore integration time:
-
Permalink:
MarcYin/spectral_library@0a99335cfa801efb03b0ac5f0c1faa79693c3dad -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/MarcYin
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-package.yml@0a99335cfa801efb03b0ac5f0c1faa79693c3dad -
Trigger Event:
push
-
Statement type: