Abundance Maps¶
Following algorithms are available to generate and plot abundance maps. Each of these algorithms come in two flavors, as functions or as classes.
- Unconstrained Least Squares (UCLS)
- Non-negative Constrained Least Squares (NNLS)
- Fully Constrained Least Squares (FCLS)
See also
See the file test_eea.py
for an example.
Unconstrained Least Squares (UCLS)¶
Function¶
Class¶
-
class
pysptools.abundance_maps.
UCLS
[source]¶ Performs unconstrained least squares abundance estimation.
-
display
(mask=None, interpolation='none', colorMap='jet', columns=None, suffix=None)¶ Display the abundance maps to a IPython Notebook.
Parameters: - mask – numpy array [default None] A binary mask, when True the selected pixel is displayed.
- interpolation – string [default none] A matplotlib interpolation method.
- colorMap – string [default jet] A matplotlib color map.
- columns – int [default None] Display all the images in one figure organized by columns.
- suffix – string [default None] Suffix to add to the title.
-
map
(M, U, normalize=False, mask=None)¶ Performs unconstrained least squares abundance estimation on the HSI cube M using the spectral library U.
Parameters: M: numpy array
A HSI cube (m x n x p).- U: numpy array
- A spectral library of endmembers (q x p).
- normalize: boolean [default False]
- If True, M and U are normalized before doing the spectra mapping.
- mask: numpy array [default None]
- A binary mask, when True the selected pixel is unmixed.
- Returns: numpy array
- An abundance maps (m x n x q).
-
plot
(path, mask=None, interpolation='none', colorMap='jet', columns=None, suffix=None)¶ Plot the abundance maps.
Parameters: - path – string The path where to put the plot.
- mask – numpy array [default None] A binary mask, when True the selected pixel is displayed.
- interpolation – string [default none] A matplotlib interpolation method.
- colorMap – string [default jet] A matplotlib color map.
- columns – int [default None] Display all the images in one figure organized by columns.
- suffix – string [default None] Suffix to add to the file name.
-
Non-negative Constrained Least Squares (NNLS)¶
Function¶
-
pysptools.abundance_maps.amaps.
NNLS
(M, U)[source]¶ NNLS performs non-negative constrained least squares of each pixel in M using the endmember signatures of U. Non-negative constrained least squares with the abundance nonnegative constraint (ANC). Utilizes the method of Bro.
Parameters: - M – numpy array 2D data matrix (N x p).
- U – numpy array 2D matrix of endmembers (q x p).
- Returns: numpy array
- An abundance maps (N x q).
References
Bro R., de Jong S., Journal of Chemometrics, 1997, 11, 393-401.
Class¶
-
class
pysptools.abundance_maps.
NNLS
[source]¶ NNLS performs non-negative constrained least squares with the abundance nonnegative constraint (ANC). Utilizes the method of Bro.
-
display
(mask=None, interpolation='none', colorMap='jet', columns=None, suffix=None)¶ Display the abundance maps to a IPython Notebook.
Parameters: - mask – numpy array [default None] A binary mask, when True the selected pixel is displayed.
- interpolation – string [default none] A matplotlib interpolation method.
- colorMap – string [default jet] A matplotlib color map.
- columns – int [default None] Display all the images in one figure organized by columns.
- suffix – string [default None] Suffix to add to the title.
-
map
(M, U, normalize=False, mask=None)¶ NNLS performs non-negative constrained least squares of each pixel in M using the endmember signatures of U.
Parameters: M: numpy array
A HSI cube (m x n x p).- U: numpy array
- A spectral library of endmembers (q x p).
- normalize: boolean [default False]
- If True, M and U are normalized before doing the spectra mapping.
- mask: numpy array [default None]
- A binary mask, when True the selected pixel is unmixed.
- Returns: numpy array
- An abundance maps (m x n x q).
-
plot
(path, mask=None, interpolation='none', colorMap='jet', columns=None, suffix=None)¶ Plot the abundance maps.
Parameters: - path – string The path where to put the plot.
- mask – numpy array [default None] A binary mask, when True the selected pixel is displayed.
- interpolation – string [default none] A matplotlib interpolation method.
- colorMap – string [default jet] A matplotlib color map.
- columns – int [default None] Display all the images in one figure organized by columns.
- suffix – string [default None] Suffix to add to the file name.
-
Fully Constrained Least Squares (FCLS)¶
Function¶
-
pysptools.abundance_maps.amaps.
FCLS
(M, U)[source]¶ Performs fully constrained least squares of each pixel in M using the endmember signatures of U. Fully constrained least squares is least squares with the abundance sum-to-one constraint (ASC) and the abundance nonnegative constraint (ANC).
Parameters: - M – numpy array 2D data matrix (N x p).
- U – numpy array 2D matrix of endmembers (q x p).
- Returns: numpy array
- An abundance maps (N x q).
References
Daniel Heinz, Chein-I Chang, and Mark L.G. Fully Constrained Least-Squares Based Linear Unmixing. Althouse. IEEE. 1999.
Notes
- Three sources have been useful to build the algorithm:
- The function hyperFclsMatlab, part of the Matlab Hyperspectral Toolbox of Isaac Gerg.
- The Matlab (tm) help on lsqlin.
- And the Python implementation of lsqlin by Valera Vishnevskiy, click: http://maggotroot.blogspot.ca/2013/11/constrained-linear-least-squares-in.html , it’s great code.
Class¶
-
class
pysptools.abundance_maps.
FCLS
[source]¶ Performs fully constrained least squares. Fully constrained least squares is least squares with the abundance sum-to-one constraint (ASC) and the abundance nonnegative constraint (ANC).
-
display
(mask=None, interpolation='none', colorMap='jet', columns=None, suffix=None)¶ Display the abundance maps to a IPython Notebook.
Parameters: - mask – numpy array [default None] A binary mask, when True the selected pixel is displayed.
- interpolation – string [default none] A matplotlib interpolation method.
- colorMap – string [default jet] A matplotlib color map.
- columns – int [default None] Display all the images in one figure organized by columns.
- suffix – string [default None] Suffix to add to the title.
-
map
(M, U, normalize=False, mask=None)¶ Performs fully constrained least squares of each pixel in M using the endmember signatures of U.
Parameters: M: numpy array
A HSI cube (m x n x p).- U: numpy array
- A spectral library of endmembers (q x p).
- normalize: boolean [default False]
- If True, M and U are normalized before doing the spectra mapping.
- mask: numpy array [default None]
- A binary mask, when True the selected pixel is unmixed.
- Returns: numpy array
- An abundance maps (m x n x q).
-
plot
(path, mask=None, interpolation='none', colorMap='jet', columns=None, suffix=None)¶ Plot the abundance maps.
Parameters: - path – string The path where to put the plot.
- mask – numpy array [default None] A binary mask, when True the selected pixel is displayed.
- interpolation – string [default none] A matplotlib interpolation method.
- colorMap – string [default jet] A matplotlib color map.
- columns – int [default None] Display all the images in one figure organized by columns.
- suffix – string [default None] Suffix to add to the file name.
-