fWeightAvgConvol: fWeightAvgConvol

Description Usage Arguments Value Author(s) Examples

View source: R/ConvolutionFunction.R

Description

Function to compute the convolution on a specific spectral range given the wavelengths and weights

Usage

1
fWeightAvgConvol(Wl = Wl, Ref = Ref, W = W)

Arguments

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)

Value

data frame with the results of the convolution

Author(s)

Tommaso Julitta, Mirco Migliavacca, Thomas Wutzler

Examples

 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()

tommasojulitta/FieldSpectroscopyDP documentation built on March 12, 2020, 1:42 p.m.