Cres Module¶

class
spectral_libraries.core.cres.
Cres
[source]¶ Bases:
object
Constrained Reference Endmember Selection. Unmix a given signal with all models in a library. Then create an index to see which models are a close match to estimated fractions.
Citations:
Roberts, D.A., Smith, M.O., Adams, J.B., 1993, Green vegetation, nonphotosynthetic vegetation and soils in AVIRIS data, Remote Sensing of Environment, 44, p. 255270.
Roberts, D.A., Batista, G., Pereira, J., Waller, E., and Nelson, B., 1999, Change Identification using Multitemporal Spectral Mixture Analysis: Applications in Eastern Amazonia, Remote Sensing Change Detection: Environmental Monitoring Methods and Applications, Edited by Elvidge, C. and Lunetta R., Chapter 9, p. 137161.

execute
(signal: numpy.array, library: numpy.array, classes: list, spectrum_names: list, rmse_constraint: float = 0.025, shade: numpy.array = array([], dtype=float64))[source]¶ Unmix a given signal with a library and create fractions and RMSE values for each endmember in that library.
Parameters:  signal – The signal to unmix, without bad bands and scaled to reflectance values.
 library – The library used for unmixing, without bad bands and scaled to reflectance values.
 classes – The class of each spectrum in the library (e.g. GV, SOIL, …) [listofstr]
 spectrum_names – The name of each spectrum in the library [listofstr]
 rmse_constraint – Only keep models that fulfill this constraint.
 shade – Shadespectrum in case of nonphotometric shade.

get_fractions
() → list[source]¶ Get the calculated fractions (and RMSE) as a list of dictionaries, specifically designed for a QTableModel. In the list, each dictionary represents one endmember combination from the library (=one model). Assuming we have n classes in the library, each model’s dictionary has n keyvalue pairs with the spectra names, n keyvalue pairs with the fractions, one keyvalue pair with the shade fraction and one keyvalue pair with the RMSE.
The dictionary keys match the table header names.
Example for gvsoil mixture:
{gv_name: tree1, soil_name: clay4, gv_fraction: 0.25, soil_fraction: 0.55, shade_fraction: 0.20, rmse: 0.01}
Returns: A list of dictionaries, one per model, containing the spectra names, fractions and RMSE.

get_header
() → list[source]¶ Get the header for the QTableModel. It has header names for the spectra names, fractions and RMSE. The header names match the keys in the table dictionaries.
Example for gvsoil mixture:
['gv_name', 'soil_name', 'gv_fraction', 'soil_fraction', 'shade_fraction', 'RMSE']
Returns: The header for the GUI QTableModel.

index
(target_fractions: list, weight_per_target: list, weight_rmse: int) → dict[source]¶ Calculate the CRES indices based on input from the user.
Example for GVSOILNPV mixture:
GV index = rmse weight * rmse + GV calculated  estimated fraction * GV weight + SOIL calculated  estimated fraction + NPV calculated  estimated fraction + Shade calculated  estimated fraction
Parameters:  target_fractions – The estimated fractions of the spectrum that is being unmixed (listoffloats).
 weight_per_target – The weights per class for calculating the indices (listofints between 1 and 10).
 weight_rmse – The weight attached to the RMSE for calculating the indices (int between 1 and 10).
Returns: Indices for each endmember and each class. The unique classes from the library metadata are the keys.
