Skip to main content

Utility package for working with spectral data cubes.

Project description

🛰️ reflspeckit

⚙️ A modern toolkit for working with any and all flavors of spectral data with a focus on applications for reflectance/emittance imaging spectroscopy


PyPI - Python Version PyPI - License PyPI - Version


🧠 What is reflspeckit?

reflspeckit is a lightweight, modular Python package designed to make analysis of spectral data cubes simple, flexible, and fun. Whether you're exploring planetary hyperspectral data, performing band analysis, or building your own spectral pipelines — this toolkit’s got you covered.


⚙️ Package Structure

reflspeckit provides two primary classes for the analysis of spectral data plus a third class specialized for large datasets:

  • 📄Spec1D - handles 1-dimensional, single spectrum data
  • 📒Spec3D - handles 3-dimensional spectral image cubes
  • 🗄️StreamingSpec3D - handles large image cubes using a streaming approach

Each class has equivalent methods, which are listed below:


🧰 Available Methods

Method Description
🚩outlier_removal Removes anomalous data in the spectral domain
🔊noise_reduction Provides filtering methods to smooth data in the spectral domain
🚫continuum_removal Estimates and removes a spectral contrinuum from the data
🖼️make_m3_rgb (3D only) Creates a standard mafic mineral RGB color-composite image
📈fit_absorption Performs a least squares polynomial fit over a spectral region

💡 Spectral Utilities

Various spectral utilities are available through the reflspeckit.utils subpackge.

Module Description
get_nonzero If you have an empty 3D image array with the first two dimensions being pixels and the third dimension of size N, and each pixel is filled in to a certain depth, M <= N, this function returns a 2D image array that picks out all the pixel values at position M.
rgb_composite Turns any three 2D arrays into a normalized rgb color composite image. The values of each band will be stretched from 0-255, with values above the 95th percentile being cut off to preserve the color stretch integrity.
wvl_search Given an estimated wavelength values and a list of real wavelength vales, this module will return the real wavelength values that is closest to the estimate and the index at which this wavelength value is located within the actual wavelength array.

More utilities coming soon! As a work through my Ph.D., I will add all the various utility functions I write for spectral data processing here!


🚀 Quick Start

pip install reflspeckit
import reflspeckit as rsk
import matplotlib.pyplot as plt

# Loading in a single spectrum
my_spectrum = rsk.Spec1d(spectrum_array, wavelength_array, unit="nm")
my_spectrum.remove_outliers()
myspectrum.noise_reduction(method="box_filter", filter_width=5)
myspectrum.continuum_removal(method="double_line")
print(myspectrum.filtered)  # Contains filtered spectrum

absorption_feature = myspectrum.fit_absorption(800, 1200, unit="nm")
print(absorption_feature.calculate_ibd())  # Returns integrated band depth.

# Loading in a spectral image cube
my_cube = rsk.Spec1d(cube_array, wavelength_array)
my_cube.remove_outliers()
my_cube.noise_reduction(method="box_filter", filter_width=5)
my_cube.continuum_removal(method="double_line")
print(myspectrum.cube)  # Sequentially replaces myspectrum.cube to save memory.

rgb = my_cube.make_m3_rgb()
plt.imshow(rgb)  # Shows RGB color-composite image.

🔗 Links

Project details


Download files

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

Source Distribution

reflspeckit-0.2.3.tar.gz (14.7 kB view details)

Uploaded Source

Built Distribution

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

reflspeckit-0.2.3-py3-none-any.whl (24.9 kB view details)

Uploaded Python 3

File details

Details for the file reflspeckit-0.2.3.tar.gz.

File metadata

  • Download URL: reflspeckit-0.2.3.tar.gz
  • Upload date:
  • Size: 14.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for reflspeckit-0.2.3.tar.gz
Algorithm Hash digest
SHA256 fac11e2186beff1a4e8f449b21ca578685f2a31fd38aa3e71ff7f7c6dd950ab5
MD5 37bef7b1e52ab8ab72098b24365336df
BLAKE2b-256 c4aad207fba336e56979626d28bfe81f7d40f503f44dd8c98e74f553c4c54131

See more details on using hashes here.

File details

Details for the file reflspeckit-0.2.3-py3-none-any.whl.

File metadata

  • Download URL: reflspeckit-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 24.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for reflspeckit-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 9c673e5058d4326f4a7e1f5968359df2f4ba3cb9d6fc79258d7d44c34d73e5c1
MD5 4c132864ae80a7db4188a8e68a6cff68
BLAKE2b-256 ecc6bcb818b4d026bbe3e1e24e186e937d2f10115be120ca81220cab3f941400

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page