pygmi.rsense.hyperspec#
Hyperspectral Interpretation Routines.
Classes#
Graph Map widget. |
|
Analyse spectra GUI. |
|
GUI to process hyperspectral features. |
Functions#
|
Calculate feature dataset. |
|
Calculate an index using numexpr. |
|
Feature process. |
|
Find minimum of function using an analytic cubic calculation for speed. |
|
Hull Calculation. |
|
Calculate Continuum/hull. |
|
Read an ENVI sli file. |
Module Contents#
- class pygmi.rsense.hyperspec.GraphMap(parent=None)#
Bases:
matplotlib.backends.backend_qtagg.FigureCanvasQTAgg
Graph Map widget.
- Parameters:
parent (parent, optional) – Reference to the parent routine. The default is None.
- init_graph()#
Initialise the graph.
- Return type:
None.
- compute_initial_figure()#
Compute initial figure.
- class pygmi.rsense.hyperspec.AnalSpec(parent=None)#
Bases:
pygmi.misc.BasicModule
Analyse spectra GUI.
- Parameters:
parent (parent, optional) – Reference to the parent routine. The default is None.
- setupui()#
Set up UI.
- Return type:
None.
- button_press_callback(event)#
Button press callback.
- Parameters:
event (matplotlib.backend_bases.MouseEvent) – Mouse Event.
- Return type:
None.
- disp_splib(row)#
Change library spectra for display.
- Parameters:
row (int) – row of table, unused.
- Return type:
None.
- feature_change()#
Change depth marker combo.
- Return type:
None.
- hull()#
Change whether hull is removed or not.
- Return type:
None.
- load_splib()#
Load ENVI spectral library data.
- Return type:
None.
- on_combo()#
On combo.
- Return type:
None.
- rotate_view()#
Rotates view.
- Return type:
None.
- settings(nodialog=False)#
Entry point into item.
- Parameters:
nodialog (bool, optional) – Run settings without a dialog. The default is False.
- Returns:
True if successful, False otherwise.
- Return type:
bool
- saveproj()#
Save project data from class.
- Return type:
None.
- showtext()#
Show spectrum description in browser.
- Return type:
None.
- class pygmi.rsense.hyperspec.ProcFeatures(parent=None)#
Bases:
pygmi.misc.BasicModule
GUI to process hyperspectral features.
- Parameters:
parent (parent, optional) – Reference to the parent routine. The default is None.
- setupui()#
Set up UI.
- Return type:
None.
- product_change()#
Change product combo.
- Return type:
None.
- settings(nodialog=False)#
Entry point into item.
- Parameters:
nodialog (bool, optional) – Run settings without a dialog. The default is False.
- Returns:
True if successful, False otherwise.
- Return type:
bool
- saveproj()#
Save project data from class.
- Return type:
None.
- acceptall()#
Accept option.
Updates self.outdata, which is used as input to other modules.
- Return type:
None.
- pygmi.rsense.hyperspec.calcfeatures(dat, mineral, feature, ratio, product, *, cryst=None, rfilt=True, piter=iter)#
Calculate feature dataset.
- Parameters:
dat (list of pygmi.raster.datatypes.Data) – Input PyGMI data.
mineral (str) – Mineral description.
feature (dictionary) – Dictionary containing the hyperspectral features.
ratio (dictionary) – Dictionary containing string definitions of ratios.
product (dictionary) – Final hyperspectral products. Each dictionary value, is a list of features or ratios with thresholds to be combined.
cryst (dictionary, optional) – Crystallinity of the product, if available
rfilt (bool) – Flag to decide whether to filter final ratio products less than 1.0
piter (function, optional) – Progress bar iterable. The default is iter.
- Returns:
datfin – Output datasets.
- Return type:
list of pygmi.raster.datatypes.Data.
- pygmi.rsense.hyperspec.indexcalc(formula, dat)#
Calculate an index using numexpr.
- Parameters:
formula (str) – string expression containing index formula.
dat (dict) – Dictionary of variables to be used in calculation.
- Returns:
out – This can be a masked array.
- Return type:
numpy array
- pygmi.rsense.hyperspec.fproc(fdat, ptmp, dtmp, i1a, i2a, xdat, mtmp)#
Feature process.
This function finds the minimum value of a feature.
- Parameters:
fdat (numpy array) – Feature data
ptmp (numpy array) – Feature wavelengths.
dtmp (numpy array) – Feature depths.
i1a (int) – Start index of feature definition.
i2a (int) – End Index of feature definition.
xdat (numpy array) – Wavelengths of feature definition.
- Returns:
ptmp (numpy array) – Feature wavelengths.
dtmp (numpy array) – Feature depths.
- pygmi.rsense.hyperspec.cubic_calc(xdat, crem, imin)#
Find minimum of function using an analytic cubic calculation for speed.
- Parameters:
xdat (numpy array) – wavelengths - x data.
crem (numpy array) – continuum removed data - y data.
imin (int) – Index for estimated minimum.
- Returns:
x (float) – wavelength at minimum.
y (float) – y value at minimum.
- pygmi.rsense.hyperspec.phulljit(sample1)#
Hull Calculation.
This is only here to be called from the jit routines
- Parameters:
sample1 (numpy array) – Sample to create a hull for.
- Returns:
out – Output hull.
- Return type:
numpy array
- pygmi.rsense.hyperspec.phull(y)#
Calculate Continuum/hull.
Based on: https://stackoverflow.com/questions/73382974/how-to-apply-continuum-removal-in-spectral-graph
- Parameters:
y (numpy array) – Sample to create a hull for.
- Returns:
out – Output hull.
- Return type:
numpy array
- pygmi.rsense.hyperspec.readsli(ifile)#
Read an ENVI sli file.
- Parameters:
ifile (str) – Input sli spectra file.
- Returns:
spectra – Dictionary of spectra with wavelengths and reflectances.
- Return type:
dictionary