Description Usage Arguments Value Author(s) Examples
View source: R/ConvolutionFunction.R
Function to compute the convolution on a specific spectral range given the wavelengths and weights
1 | fWeightAvgConvol(Wl = Wl, Ref = Ref, W = W)
|
Wl |
numeric array: wavelenghts spectrometer to be deconvolved |
Ref |
numeric array: Reflectance |
W |
numeric array: contains the weights of the user-defined convolution function (same length of Ref) |
data frame with the results of the convolution
Tommaso Julitta, Mirco Migliavacca, Thomas Wutzler
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | data("reflOO")
# define the center wavelength
CWl<-530
# define the Full Widht at Half Maximum
FWHM<-50
# define the Weight for the convolution
zzz <- dnorm(reflOO$Wl, mean = CWl, sd = FWHM/(2*sqrt(2*log(2))))
x.norm = (zzz - min(zzz,na.rm=TRUE))/(max(zzz,na.rm=TRUE) - min(zzz,na.rm=TRUE))
# Exctract the convolved spectrum
res<-fWeightAvgConvol(Wl=reflOO$Wl, Ref=reflOO$Ref, W=x.norm)
#plot results
plot(reflOO$Wl, reflOO$Ref, ylim=c(0,2), xlim=c(400,800), type="l",xlab = "Wl [nm]", ylab= "Reflectance [-]")
lines(reflOO$Wl, x.norm, col="blue")
points(CWl, res$RefConvol, col="red")
legend("topleft",col=c("black","red","blue"),pch=c(NA,1,NA),lty=c(1,NA,1),cex=1.2,legend=c("Reflectance","Convolved value","Convolution function"),box.col="white")
box()
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.