Skip to main content

A collection of tools used for working with hyperspectral data

Project description

# csiro-spectral-tools

A very small collection of tools for working with spectral data. Documentation for the various modules can be found in the docs folder. I used to have a class for parsing TSG data but after Ben Chi (https://github.com/FractalGeoAnalytics/pytsg) wrote a much nicer and cleaner version I have adopted his instead. Nice work Ben.

I used to have spectral unmixing routines in here as well but have removed them as they were really a bit (read a LOT) adhoc. They may come back in the future.

There is some documentation that I created with Sphinx but alas I am not that adept at Sphinx. Regardless it can be found in the docs folder

## Pre Installation Requirements (only if you need to build the extension file for doing convex hulls)

  1. setuptools >= 18.0

  2. Cython

    In regard to cython you will probably need to ensure you have a compatible C compiler for your OS. Probably best to take a look at the [Cython documentation](https://cython.readthedocs.io/en/latest/index.html) to see what is required there. Who knows you may already have one installed.

## Installation (assumimg you are not building the Cython extension and are simply using the prebuilt .c and .pyx files)

$ python setup.py install

## What is this?

This package is a small collection of tools that I have developed or had a need for over the years. The primary focus is to work with spectral reflectance data. I have recently gone through it and cleaned it up and dropped a bunch of half finished stuff.

It does have a precompiled cython file in the csiro_spectral_tools/ext folder for performing upper convex hull corections. If you need to compile it yourself then you will need Cython installed and a C compiler. The compiled version is for python 3.10 and a 64 bit system.

I have tried various python only implementations of hull correction routines but haven’t found them to be fast enough. I probably need to look closer at qhull. With that said their is python only hulls routine in the package.

Additionally, if you want to run the feature extraction method then you need to run your routine in a main guard. If you don’t then it will not allow you to use the multiprocessor component. This initself is not a bad thing and for small datasets (<20000 spectra I guess) it probably isn’t needed anyway. If you are extracting features from spectral imagery however then not using the main guard and the main_guard=True keyword in csiro_spectral_tools.extraction.extraction.extract_spectral_features will run noticeably slower due to the large number of samples.

## Whats in the csiro_spectral_tools package?

It is comprised of a number of sub-packages.

  1. ext (package): A Cython implementation for convex hulls.

    The main file is the chulls.pyx file from which the chulls.c and chulls*.pyd is generated. A setup file to regenerate the c and pyd files is also in there. You can directly call the chulls.get_absorption method but its better to use the csiro_spectral_tools.hulls.convexhulls.uc_hulls method instead. This is a wrapper for the chulls one and as such has type hinting etc.

  2. extraction (package): A module for extracting spectral feature information from spectra

    from csiro_spectral_tools.extraction.extraction import extract_spectral_features

  3. io (package): An module with a bunch of convenience spectral data parsers. The parse_numpy one is probably a bit dumb but whatever.

    from csiro_spectral_tools.io import parse_tsg, parse_envi, parse_csv, parse_numpy

  4. python_hulls (package): A pure python implementation of convex hulls (phulls) and a warpper for the cython extension when you really need speed.

    from csiro_spectral_tools.hulls.phull import get_absorption

    or,

    from csiro_spectral_tools.hulls.convexhulls import get_absorption

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

csiro-spectral-tools-0.2.1.tar.gz (129.5 kB view hashes)

Uploaded Source

Built Distributions

csiro_spectral_tools-0.2.1-cp311-cp311-win_amd64.whl (193.4 kB view hashes)

Uploaded CPython 3.11 Windows x86-64

csiro_spectral_tools-0.2.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (535.9 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

csiro_spectral_tools-0.2.1-cp310-cp310-win_amd64.whl (194.0 kB view hashes)

Uploaded CPython 3.10 Windows x86-64

csiro_spectral_tools-0.2.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl (520.6 kB view hashes)

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

csiro_spectral_tools-0.2.1-cp39-cp39-win_amd64.whl (204.1 kB view hashes)

Uploaded CPython 3.9 Windows x86-64

csiro_spectral_tools-0.2.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl (524.4 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.28+ x86-64

csiro_spectral_tools-0.2.1-cp38-cp38-win_amd64.whl (204.1 kB view hashes)

Uploaded CPython 3.8 Windows x86-64

csiro_spectral_tools-0.2.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl (528.0 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.28+ x86-64

Supported by

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