Package peppy :: Package hsi :: Module utils
[frames] | no frames]

Module utils

HSI Utilities.

These are utility functions that are in common use by the hyperspectral classes. These functions shouldn't have external dependencies on any other classes in the hsi package.

Classes
  Histogram
  CubeCompare
Functions
 
normalizeUnits(txt)
Return standard units label for the given label.
 
getRangeIntersection(x1, x2, bbl1=None)
Computes the common range of sampling points.
 
resample(x1, y1, x2, y2, bbl1=None)
Resample using linear interpolation.
 
spectralAngle(lam1, spectra1, lam2, spectra2, bbl=None)
Determine spectral angle between two vectors.
 
euclideanDistance(lam1, spectra1, lam2, spectra2, bbl=None)
Determine Euclidean distance between two vectors.
Variables
  units_scale = {'m': 1.0, 'mm': 0.001, 'nm': 1e-09, 'um': 1e-06}
Function Details

normalizeUnits(txt)

 

Return standard units label for the given label.

Given a text string, return the standard (usually SI) abbreviation. Currently just supports lengths.

Returns None if label not known.

getRangeIntersection(x1, x2, bbl1=None)

 

Computes the common range of sampling points.

Given two lists of sampling points, determine the subset of the range of the first set such that the endpoints are guaranteed to be within the range of the second set of sampling points.

Parameters:
  • x1 - list of sampling points to subset
  • x2 - list of sampling points of other set
  • bbl1 - optional bad band list of x1 (0 = bad, 1 = good)
Returns:
tuple (index1, index2) specifying indexes that give the range within 1st sampling set. Note the indexes are in the python idiom where index2 is actually one beyond the last good value so you can do a slice like x1[index1:index2] and get the actual list.

resample(x1, y1, x2, y2, bbl1=None)

 

Resample using linear interpolation.

Given two sets of data, resample the second set to match the first set's x values and range.

@returns tuple (sampling, data1, data2)

spectralAngle(lam1, spectra1, lam2, spectra2, bbl=None)

 

Determine spectral angle between two vectors.

Computes the spectral angle between the common range of two vectors, resampling the second one to conform to the first's sampling points if necessary.

@returns angle in degrees

euclideanDistance(lam1, spectra1, lam2, spectra2, bbl=None)

 

Determine Euclidean distance between two vectors.

Compute Euclidean distance between the common range of two vectors, resampling the second one to conform to the first's sampling points.

@returns distance (units are ???)