implement convex hull algorithm
The simple, but slow, solution would be to use the Scipy implementation:
https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.ConvexHull.html
A mutch more performant solution would be to implement it using Numba. Problem is: some users had problems installing Numba on there systems.
Maybe we implement both optiuons, and let the user choose which one to use.
Comments (17)
-
reporter -
reporter Hi @Agustin Lobo , I would allow to calculate the hull and the continuum-removed outputs at the same time. Both of them could be skipped. Also, the user can decide to use band number or nanomters as X values.
Any further suggestions from your side?
-
I understand out_contrem = input - out_convhull, correct?
Could I test it?
-
reporter Not yet implemented
Isn’t it out_contrem = input / out_convhull ? Like in ENVI: https://www.l3harrisgeospatial.com/docs/continuumremoval.html
-
See Hecker, Christoph, Frank J.A. van Ruitenbeek, Harald M.A. van der Werff, Wim H. Bakker, Robert D. Hewson, and Freek D. van der Meer. 2019. “Spectral Absorption Feature Analysis for Finding Ore: A Tutorial on Using the Method in Geological Remote Sensing.” IEEE Geoscience and Remote Sensing Magazine 7 (2): 51–71. https://doi.org/10.1109/MGRS.2019.2899193.
“In the past, several methods to approximate the continuum
have been applied: straight line, second-order polynomial,
cubic spline, and convex hull [21], [41]–[43]Currently, most
continuum removal methods in image processing seem
to be using the convex hull method (see, for instance, the
ENVI software package). Once the continuum is calculated,
it can be removed by dividing it into the original spectrum,
assuming that the continuum has a multiplicative effect on
the spectrum. This process results in a continuum-removed
spectrum, or hull quotient, because it is the ratio between
the spectrum and the hull [40]. In this way, the absorption
features are always between zero and one and can read-
ily be subjected to further analysis. Alternatively, the hull
could also be subtracted from the spectra, which would be
relevant when using apparent absorbance spectra [21].”and its Fig. 2:
-
reporter Interesting, so we could have three outputs: i) the hull, ii) the hull quotient and iii) the hull difference.
Just to be sure: is this the correct formular for the hull difference?
out_contrem = input - out_convhullCould you check the IDL code that produced the screenshot above?
-
so we could have three outputs: i) the hull, ii) the hull quotient and iii) the hull difference
Yes, but please make selecting the outputs optional (ratio and/or difference) so that the user can save disk space and writing time.
Could you check the IDL code that produced the screenshot above?
Not easily, but will try.
-
Note that HypPy also has the option and there you have the python code:
-
reporter Yes, but please make selecting the outputs optional (ratio and/or difference) so that the user can save disk space and writing time.
Yes, all 3 outputs can be skipped by the user:
-
reporter Note that HypPy also has the option and there you have the python code:
I’ll check it out
-
Regarding IDL DISPEC, the authors provide the binary *.sav file only:
Perhaps you could contact them to offer porting the IDL source to python.
-
reporter I’ll do that, in case I didn’t find it in HypPy source.
-
reporter BTW, I think we should have this option …
… available here:
-
reporter - marked as enhancement
-
reporter ConvexHull and ContinuumRemoved-HullQuotient done:
-
reporter @Agustin Lobo in the HypPy source I found the formular for Hull_Difference as:
-
reporter - changed status to resolved
resolves
#926→ <<cset 9f39d83dc649>>
- Log in to comment
Stéphane Guillaso already provided the Numba code: