# bkg_corr: Background correction function In LCF: Linear Combination Fitting

## Description

This function allows you to base-line correct and edge-step normalize XANES spectra (background correction). Raw spectra are loaded, then base-line corrected and edge-step normalized. The spectrum is flattened after E0. The function returns the corrected, normalized and flattened spectrum

## Usage

 `1` ```bkg_corr(raw.spec, corr.norm) ```

## Arguments

 `raw.spec` Raw spectrum `corr.norm` Vector of the base-line correction and edge-step normalization values (vector of length 4)

## Examples

 ```1 2 3 4 5 6``` ```data(stdmix) corr.spec.samples <- initial_load(specdat[5:8], corr.norm = c(-36, -15, 37, 58)) corr.spec <- bkg_corr(raw.spec = corr.spec.samples[[1]], corr.norm = c(-36, -15, 37, 58)) print(corr.spec) ```

### Example output

```     energy cor.absorption
1   2045.50  -0.1246518847
2   2050.51  -0.1078849982
3   2055.51  -0.0960794268
4   2060.51  -0.0632800383
5   2065.51  -0.0783828213
6   2070.51  -0.0471527380
7   2075.51  -0.0170851032
8   2080.51  -0.0168203190
9   2085.51   0.0313675607
10  2090.51   0.0055330547
11  2095.51   0.0252223507
12  2100.51   0.0083386969
13  2105.51  -0.0096725318
14  2106.50  -0.0082185777
15  2107.50   0.0065291212
16  2108.50   0.0025683763
17  2109.51  -0.0128587734
18  2110.51  -0.0106469175
19  2111.50   0.0100827550
20  2112.50  -0.0123004712
21  2113.50  -0.0123181912
22  2114.50   0.0040918088
23  2115.50  -0.0006175527
24  2116.50  -0.0063173203
25  2117.50  -0.0084320971
26  2118.50   0.0041697221
27  2119.51  -0.0009906838
28  2120.50  -0.0008293723
29  2121.50   0.0052139133
30  2122.51  -0.0077116476
31  2123.50   0.0084379784
32  2124.50   0.0058582223
33  2125.50   0.0007582781
34  2126.50   0.0197303142
35  2127.50  -0.0036061196
36  2128.50  -0.0055139806
37  2129.50  -0.0118344956
38  2130.50   0.0114943970
39  2131.51  -0.0076549124
40  2132.50  -0.0069123767
41  2133.51  -0.0161030376
42  2134.50  -0.0024096184
43  2135.51   0.0032942179
44  2135.76   0.0013409432
45  2136.00  -0.0069709094
46  2136.26  -0.0001593380
47  2136.50   0.0098885185
48  2136.75  -0.0103454189
49  2137.01   0.0068514661
50  2137.25  -0.0104182135
51  2137.50  -0.0039855858
52  2137.76   0.0066281216
53  2138.00   0.0160891742
54  2138.25   0.0055802798
55  2138.50  -0.0163857056
56  2138.75   0.0149279665
57  2139.00   0.0278447311
58  2139.25   0.0013358976
59  2139.50  -0.0039001312
60  2139.75   0.0179256375
61  2140.00  -0.0066512069
62  2140.25   0.0111292416
63  2140.50   0.0100664024
64  2140.75  -0.0078937860
65  2141.00   0.0036419899
66  2141.25   0.0116741466
67  2141.50  -0.0086527866
68  2141.75   0.0140610926
69  2142.00   0.0089738572
70  2142.25   0.0150414761
71  2142.50   0.0188981183
72  2142.75   0.0107164454
73  2143.00   0.0141732053
74  2143.25   0.0092696368
75  2143.50   0.0219701860
76  2143.75   0.0034636469
77  2144.00   0.0153481573
78  2144.25   0.0333796946
79  2144.51   0.0047046009
80  2144.75   0.0112227063
81  2145.00   0.0173182240
82  2145.25   0.0181408760
83  2145.50   0.0220765646
84  2145.75   0.0291438891
85  2146.00   0.0355300189
86  2146.25   0.0155285712
87  2146.50   0.0169719707
88  2146.75   0.0117336170
89  2147.00   0.0251316352
90  2147.25   0.0203582608
91  2147.50   0.0324468972
92  2147.75   0.0400284889
93  2148.01   0.0417648108
94  2148.25   0.0602804060
95  2148.51   0.0759865672
96  2148.75   0.0998745337
97  2149.00   0.0635360370
98  2149.25   0.1158342266
99  2149.50   0.1363464287
100 2149.75   0.1387081623
101 2150.00   0.1636818411
102 2150.25   0.1908223236
103 2150.50   0.1928074240
104 2150.75   0.2392050258
105 2151.00   0.2448471886
106 2151.25   0.2668635989
107 2151.50   0.3024481062
108 2151.76   0.3477181186
109 2152.00   0.4215704399
110 2152.25   0.5243816600
111 2152.50   0.7577474536
112 2152.75   1.0140599776
113 2153.00   1.4812871294
114 2153.25   2.0340123570
115 2153.50   2.8187762237
116 2153.76   3.7000488625
117 2154.00   4.4465451696
118 2154.26   5.1927454066
119 2154.50   5.6448085488
120 2154.76   5.9304002534
121 2155.00   5.8422271517
122 2155.26   5.4857986352
123 2155.50   4.9371332460
124 2155.76   4.1691854608
125 2156.00   3.5902020237
126 2156.26   3.0021998475
127 2156.50   2.6140011527
128 2156.75   2.2999529455
129 2157.00   2.1405173429
130 2157.25   1.9609411602
131 2157.50   1.8106703004
132 2157.75   1.7319341868
133 2158.01   1.6691935950
134 2158.26   1.5631352955
135 2158.51   1.4675948286
136 2158.76   1.4341570952
137 2159.00   1.4135825966
138 2159.25   1.3543593410
139 2159.50   1.3236625677
140 2159.75   1.3117416601
141 2160.01   1.2793386452
142 2160.25   1.2743131487
143 2160.51   1.2673700774
144 2160.75   1.2621702137
145 2161.00   1.2893261697
146 2161.25   1.2964112925
147 2161.50   1.3043380280
148 2161.75   1.3245471927
149 2162.01   1.3835591156
150 2162.25   1.3769038665
151 2162.51   1.3709767751
152 2162.75   1.4055884423
153 2163.00   1.4546937480
154 2163.25   1.4654475578
155 2163.50   1.4774544870
156 2163.75   1.4854841223
157 2164.01   1.5819262775
158 2164.25   1.5513129681
159 2164.50   1.5660353766
160 2164.76   1.5806347980
161 2165.00   1.5327870294
162 2165.25   1.5514292137
163 2165.51   1.5567615969
164 2165.75   1.5697354506
165 2166.00   1.5692204862
166 2166.26   1.5075516717
167 2166.50   1.5709362604
168 2166.75   1.5927705278
169 2167.00   1.6041218361
170 2167.25   1.5683730624
171 2167.50   1.6218817223
172 2167.76   1.6483590410
173 2168.00   1.6509243322
174 2168.25   1.6480100744
175 2168.50   1.6715345417
176 2168.75   1.6966050654
177 2169.00   1.7342091071
178 2169.25   1.7186613607
179 2169.50   1.7806465940
180 2169.75   1.7718747590
181 2170.00   1.8232038283
182 2170.25   1.8350898629
183 2170.50   1.8705015270
184 2170.75   1.8565951576
185 2171.00   1.8346539453
186 2171.25   1.8687497179
187 2171.50   1.8326545346
188 2171.75   1.8521081078
189 2172.00   1.8394711321
190 2172.25   1.8373566387
191 2172.50   1.8195258437
192 2172.75   1.8402767094
193 2173.00   1.8261889981
194 2173.25   1.8047662377
195 2173.50   1.7972975073
196 2173.75   1.7446188358
197 2174.00   1.7467612283
198 2174.25   1.7309670428
199 2174.50   1.6976036131
200 2174.75   1.6484843584
201 2175.00   1.6501989700
202 2175.25   1.5891436957
203 2175.50   1.6216724880
204 2175.75   1.5617285143
205 2176.00   1.5616041326
206 2176.25   1.5147842007
207 2176.50   1.5022309213
208 2176.75   1.4941065700
209 2177.00   1.4329466754
210 2177.25   1.3847132064
211 2177.50   1.3990241082
212 2177.75   1.3587836340
213 2178.00   1.3411341810
214 2178.25   1.3279717785
215 2178.50   1.3033057873
216 2178.75   1.2901317604
217 2179.00   1.2600999076
218 2179.25   1.2400534861
219 2179.50   1.2218158342
220 2179.75   1.2427178181
221 2180.00   1.2267725143
222 2180.25   1.1809848367
223 2180.50   1.1681502447
224 2180.75   1.1581543515
225 2181.00   1.1632284388
226 2181.25   1.1441166257
227 2181.50   1.1455104015
228 2181.75   1.1292558865
229 2182.01   1.1244028973
230 2182.25   1.1217325212
231 2182.50   1.1034251224
232 2182.75   1.1369001476
233 2183.00   1.0783208883
234 2183.25   1.1044027420
235 2183.50   1.0915727998
236 2183.75   1.0325378608
237 2184.00   1.0937256546
238 2184.25   1.0521297656
239 2184.50   1.0530027645
240 2184.75   1.0578652862
241 2185.00   1.0409481756
242 2185.25   1.0497258232
243 2185.50   1.0588754544
244 2185.75   1.0691712596
245 2186.00   1.0282472658
246 2186.25   1.0275393349
247 2186.50   1.0123007998
248 2186.75   1.0351766209
249 2187.00   1.0382419974
250 2187.25   1.0471335650
251 2187.50   1.0485366404
252 2187.75   1.0187907499
253 2188.00   1.0593148618
254 2188.25   1.0122438412
255 2188.50   1.0186221954
256 2188.75   1.0120485502
257 2189.00   1.0237741669
258 2189.25   1.0344838037
259 2189.50   1.0120055402
260 2189.75   1.0151243894
261 2190.00   1.0137143397
262 2190.25   1.0289156769
263 2190.50   1.0439682207
264 2190.75   1.0062409599
265 2191.00   1.0258247274
266 2191.25   1.0040113844
267 2191.50   1.0165646642
268 2191.75   0.9935702737
269 2192.00   0.9792314736
270 2192.25   0.9974249528
271 2192.50   0.9799010442
272 2192.75   1.0018283076
273 2193.00   1.0480786401
274 2193.25   0.9684497662
275 2193.50   0.9920695543
276 2193.75   1.0142944044
277 2194.00   0.9945316203
278 2194.25   1.0021816930
279 2194.50   0.9789966610
280 2194.75   1.0035138592
281 2195.00   0.9831466020
282 2195.25   0.9741899377
283 2195.50   0.9921858007
284 2196.50   1.0017388020
285 2197.51   0.9904586365
286 2198.50   1.0183083423
287 2199.51   1.0244207290
288 2200.50   1.0271527159
289 2201.51   0.9929881273
290 2202.51   1.0216564292
291 2203.51   0.9710271547
292 2204.51   1.0007625842
293 2205.51   0.9957919559
294 2206.51   0.9984423389
295 2207.51   0.9968846589
296 2208.51   1.0072769479
297 2209.51   1.0035943123
298 2210.51   1.0078604985
299 2211.50   0.9853994399
300 2212.51   1.0103551143
301 2213.51   1.0153350438
302 2214.51   1.0115408132
303 2215.51   1.0356174441
304 2216.51   1.0310373984
305 2217.51   1.0234117380
306 2218.50   1.0623542699
307 2219.50   1.0765028480
308 2220.50   1.0465140063
309 2221.50   1.0934699456
310 2222.50   1.0802482589
311 2223.50   1.0928073516
312 2224.51   1.1121902486
313 2225.50   1.1096605293
314 2226.50   1.1158877194
315 2227.50   1.1149868692
316 2228.50   1.1272646494
317 2229.50   1.1245933439
318 2230.51   1.1541174403
319 2231.50   1.1351623258
320 2232.51   1.1554496076
321 2233.50   1.1728047297
322 2234.50   1.1712586742
323 2235.50   1.1723723005
324 2236.50   1.1759131190
325 2237.50   1.1813975511
326 2238.51   1.2022893060
327 2239.51   1.1911567715
328 2240.50   1.1741020276
329 2241.50   1.2071318357
330 2242.50   1.2021216841
331 2243.50   1.1933242758
332 2244.51   1.2049513175
333 2245.50   1.1881234835
334 2250.50   1.1984111553
335 2255.51   1.1620197839
336 2260.52   1.1311453923
337 2265.51   1.1625661425
338 2270.51   1.1186093247
339 2275.51   1.1116448217
340 2280.51   1.1117555372
341 2285.51   1.0668594611
342 2290.51   1.0068957297
343 2295.50   1.0293144799
344 2300.50   1.0189175458
345 2305.50   1.0155720235
346 2310.51   1.0006905962
347 2315.50   1.0115685593
348 2320.52   1.0097486341
349 2325.51   1.0708443657
350 2330.51   1.1171679362
351 2335.51   1.0639533798
352 2340.51   1.0759568254
353 2345.51   1.1078451123
354 2350.51   1.1154591529
355 2355.51   1.1466801945
356 2360.51   1.1195719031
357 2365.51   1.1242217004
358 2370.50   1.1409932766
359 2375.50   1.1073334263
360 2380.50   1.1199901678
361 2385.50   1.1209759280
362 2390.51   1.1003682801
363 2395.50   1.0989591642
364 2400.51   1.1007170225
365 2405.50   1.1009888069
366 2410.51   1.1178026962
367 2415.51   1.0886484957
368 2420.51   1.1111116515
369 2425.51   1.1326611228
370 2430.51   1.1489051800
371 2435.50   1.1153566922
372 2440.51   1.1147896538
373 2445.50   1.1192602016
374 2450.50   1.0890040000
375 2455.50   1.0985988526
376 2460.50   1.0711929744
377 2465.51   1.0958278162
378 2470.51   1.1159498010
379 2475.50   1.1138827393
380 2480.51   1.0819342454
381 2485.51   1.0936191801
382 2490.50   1.1002356076
383 2495.52   1.1317384267
```

LCF documentation built on May 2, 2019, 6:08 a.m.