WlCal: WlCal

Description Usage Arguments Value Author(s) Examples

Description

fit a 3 order polynomial to pix value and wl for wavelength calibration

Usage

1
WlCal(pix_center, wl_peaks)

Arguments

pix_center

numeric vector: center pixel corresponding to emission line peak

wl_peaks

numeric vector: wavelength vector of emission lines lamp

Value

an object of class "lm" containing the coefficients needed for the wavelength calibration.

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
59
60
61
62
63
64
65
66
67
  





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


}





#extarct coefficients for wl calibration


wl_coeff<-WlCal(pix_center = wl_cal$CenterPixel,wl_peaks = wl_peaks)

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