Identify the peaks in the gypsum spectrum, using the function "peaks" from the package "IDPmisc".
You can obtain the gypsum spectra from the data(mineralRef) in the package "soilspec". Th spectrum is in reflectance and I converted it to absorbance using the log 1/R transformation.
wavelength <- seq(350, 2500, by = 1)matplot(wavelength, mineralRef$gypsum,
type = "l", col = "blue",
xlab = "wavelength",
ylab = "Absorbance",
main = "Gypsum" )
With this code we get the spectrum, and see (visually) the peaks, so we can decide the value for the arguments of the function.
Now let´s get the peaks:
ppeaks_gypsum <- peaks(wavelength,
mineralRef$gypsum ,
minPH = 0.03)
> ppeaks_gypsum
x y w
1 350 0.1364889 114
3 994 0.1623408 39
4 1204 0.2884482 67
5 1445 1.0510481 127
8 1489 0.8744469 11
7 1537 0.7541421 14
6 1748 0.7571059 54
9 1944 2.1366552 83
10 2215 1.3251868 43
11 2266 1.2514346 15
2 2488 2.1942896 191
In the X column we have the peak wavelength, in the "y" the absorbance values, and in the "w" the width at half maximum of the peaks.
Now we add the vertical lines to see the marked peaks:
abline(v = ppeaks_gypsum$x, col = "red")
Just change the minPH value or the or the other arguments in the peaks function to get more or less peaks.
We can exclude the vertical lines at the extreme wavelengths.
We can use this spectrum to compare it to our soil samples checking for any trace of gypsum on them.
No hay comentarios:
Publicar un comentario