Skip to main content

Hyperspectral data analysis and machine learning

Project description

hypers

Build Status Documentation Status Python Version 3.5 Python Version 3.6 PyPI version

Provides an object model for hyperspectral data.

  • Simple tools for exploratory analysis of hyperspectral data
  • Interactive hyperspectral viewer built into the object
  • Allows for unsupervised machine learning directly on the object (using scikit-learn)
  • More features coming soon...

Contents

  1. About
  2. Installation
  3. Features
  4. Examples
  5. Documentation
  6. License

About

This package provides an object model for hyperspectral data (e.g. similar to pandas for tabulated data). Many of the commonly used tools are built into the object, including a lightweight interactive gui for visualizing the data. Importantly, the object also interfaces with scikit-learn to allow the cluser and decomposition classes (e.g. PCA, ICA, K-means) to be used directly with the object.

  • Dataset object (hypers.Dataset)

    This class forms the core of hypers. It provides useful information about the hyperspectral data and makes machine learning on the data simple.

  • Interactive hyperspectral viewer

    A lightweight pyqt gui that provides an interative interface to view the hyperspectral data.

Please note that this package is currently in pre-release. The first general release will be v0.1.0

Hyperspectral data

Whilst this package is designed to work with any type of hyperspectral data, of the form of either of the following:

,

some of the features are particularly useful for vibrational-scattering related hyperspectral data (e.g. Raman micro-spectroscopy), e.g. the spectral component of the hyperspectral viewer (see figure above).

Installation

To install using pip:

pip install hypers

The following packages are required:

  • numpy
  • matplotlib
  • scipy
  • scikit-learn
  • PyQt5
  • pyqtgraph

Features

Features implemented in hypers include:

Examples

Hyperspectral dimensionality reduction and clustering

Below is a quick example of using some of the features of the package on a randomized hyperspectral array. For an example using the IndianPines dataset, see the Jupyter notebook in the examples/ directory.

import numpy as np
import hypers as hp
from sklearn.decomposition import PCA
from sklearn.cluster import KMeans

# Generating a random 4-d dataset and creating a Dataset instance
# The test dataset here has spatial dimensions (x=200, y=200, z=10) and spectral dimension (s=1024)
test_data = np.random.rand(200, 200, 10, 1024)
X = hp.Dataset(test_data)
X.scale()

# Using Principal Components Analysis to reduce to first 5 components
# The variables ims, spcs are arrays of the first 5 principal components for the images, spectra respectively
ims, spcs = X.decompose(
    mdl=PCA(n_components=5),
    plot=False,
    return_arrs=True
)

# Clustering using K-means (with and without applying PCA first)
# The cluster method will return the labeled image array and the spectrum for each cluster
lbls_nodecompose, spcs_nodecompose = X.cluster(
    mdl=KMeans(n_clusters=3),
    decomposed=False,
    plot=False,
    return_arrs=True
)

# Clustering on only the first 5 principal components
lbls_decomposed, spcs_decomposed = X.cluster(
    mdl=KMeans(n_clusters=3),
    decomposed=True,
    pca_comps=5,
    plot=False,
    return_arrs=True
)

Documentation

The docs are hosted here.

License

hypers is licensed under the OSI approved BSD 3-Clause License.

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

hypers-0.0.11.tar.gz (13.5 kB view details)

Uploaded Source

Built Distribution

hypers-0.0.11-py3-none-any.whl (19.0 kB view details)

Uploaded Python 3

File details

Details for the file hypers-0.0.11.tar.gz.

File metadata

  • Download URL: hypers-0.0.11.tar.gz
  • Upload date:
  • Size: 13.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/39.1.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.4

File hashes

Hashes for hypers-0.0.11.tar.gz
Algorithm Hash digest
SHA256 0374a1fb32031939a08d2bf283ff303aa07b375c1a1dfb4abebc4da76bb14f31
MD5 d53b59cd8b4d3ebb7ab1e07f0e0b9994
BLAKE2b-256 c4c5047f6a04bfe1d9efbdb00631709da1f666c07d3d0c0cdcd3e8be530de980

See more details on using hashes here.

File details

Details for the file hypers-0.0.11-py3-none-any.whl.

File metadata

  • Download URL: hypers-0.0.11-py3-none-any.whl
  • Upload date:
  • Size: 19.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/39.1.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.4

File hashes

Hashes for hypers-0.0.11-py3-none-any.whl
Algorithm Hash digest
SHA256 d871a1f2eb65e8c605b006a41391afebfe03033609216313af50d31324e9627c
MD5 e0e66d86478a10bf221b72decef34033
BLAKE2b-256 6775521735fd8bcd0696bb46899d6917def3ae415e94e9d92b4bc91bbd85ae0f

See more details on using hashes here.

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