GaussFit: GaussFit

Description Usage Arguments Value Author(s) Examples

Description

fit a gaussian function to points and extract the corresponidng center, in terms of wl and pixel position, and Full Width at Half Maximum

Usage

1
GaussFit(NPixels, wl, DN, plot = FALSE)

Arguments

NPixels

numeric vector: number of pixel vector to be fitted

wl

numeric vector: wavelength vector

DN

numeric vector: DN vector to be fitted

plot

a logical value indicating whether the output is plotted or not

Value

numeric data.frame containing pixel number of the peak, the corresponing wavelength and the full width at half maximum.

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
47
48
49
50
51
52
53
54
55
56
57
58
  





data("indoor_wl_cal_data")


#extract dc subracted spectra


lamp_spectrum_dc_sub<-DCSubtraction(signal=indoor_wl_cal_data$lamp_spectrum,DarkSignal = indoor_wl_cal_data$dc_spectrum,type=1)


#Select spectral region to analyse


region_to_analyze<-SelectSpectralRegion(wl = indoor_wl_cal_data$DN_wl,spectrum = lamp_spectrum_dc_sub,WlSelection = indoor_wl_cal_data$emission_lines$peak,buffer=1)


#define data.frame containing the expected results


n_peaks_fit<-length(names(region_to_analyze))


wl_peaks<-as.numeric(names(region_to_analyze))


#loop on spectral region to analyze


for(n in 1:n_peaks_fit)


{ print(n)


  n_pixels<-data.frame(region_to_analyze[n])[,1]


  wl<-data.frame(region_to_analyze[n])[,2]


  DN<-data.frame(region_to_analyze[n])[,3]  


  wl_param<-GaussFit(n_pixels,wl,DN,plot=TRUE)


  if(n==1){wl_cal<-wl_param}else{


    wl_cal<-rbind(wl_cal,wl_param)}


}

tommasojulitta/FieldSpectroscopyCC documentation built on May 31, 2019, 6:19 p.m.