Vespucci  1.0.0
quantification.cpp
Go to the documentation of this file.
1 /*******************************************************************************
2  Copyright (C) 2014-2016 Wright State University - All Rights Reserved
3  Daniel P. Foose - Maintainer/Lead Developer
4 
5  This file is part of Vespucci.
6 
7  Vespucci is free software: you can redistribute it and/or modify
8  it under the terms of the GNU General Public License as published by
9  the Free Software Foundation, either version 3 of the License, or
10  (at your option) any later version.
11 
12  Vespucci is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with Vespucci. If not, see <http://www.gnu.org/licenses/>.
19 *******************************************************************************/
42 arma::rowvec Vespucci::Math::Quantification::QuantifyPeak(const arma::vec &spectrum,
43  const arma::vec &abscissa,
44  double &min,
45  double &max,
46  arma::uword bound_window,
47  arma::mat &total_baseline,
48  arma::mat &inflection_baseline)
49 {
50  arma::rowvec results(8);
51 
52  arma::uword min_index = Vespucci::Math::ClosestIndex(min, abscissa);
53  arma::uword max_index = Vespucci::Math::ClosestIndex(max, abscissa);
54 
55  arma::vec abscissa_part = abscissa.rows(min_index, max_index);
56  arma::vec spectrum_part = spectrum.rows(min_index, max_index);
57 
58  min = abscissa(min_index);
59  max = abscissa(max_index);
60 
61  arma::uword min_start = min_index - bound_window;
62  arma::uword min_end = min_index + bound_window;
63  min_end = (min_end >= abscissa.n_rows ? abscissa.n_rows - 1 : min_end);
64 
65  arma::uword max_start = max_index - bound_window;
66  arma::uword max_end = max_index + bound_window;
67  max_end = (max_end >= abscissa.n_rows ? abscissa.n_rows - 1 : max_end);
68 
69  double total_area = arma::as_scalar(arma::trapz(abscissa_part, spectrum_part));
70 
71  arma::uword window_size = max_index - min_index + 1;
72  total_baseline = arma::linspace(spectrum(min_index), spectrum(max_index), window_size);
73  arma::vec total_abscissa = abscissa.rows(min_index, max_index);
74  arma::uvec positive_indices = arma::find(spectrum_part > total_baseline);
75  double positive_area = arma::as_scalar(arma::trapz(abscissa_part.rows(positive_indices), spectrum_part.rows(positive_indices)));
76  double baseline_area = arma::as_scalar(arma::trapz(abscissa_part.rows(positive_indices), total_baseline.rows(positive_indices)));
77  total_baseline = arma::join_horiz(total_abscissa, total_baseline);
78 
79  arma::vec min_window = spectrum.rows(min_start, min_end);
80  arma::vec max_window = spectrum.rows(max_start, max_end);
81  arma::uword inflection_min_index = Vespucci::Math::LocalMinimum(min_window, min) + min_start;
82  arma::uword inflection_max_index = Vespucci::Math::LocalMinimum(max_window, max) + max_start;
83 
84  abscissa_part = abscissa.rows(inflection_min_index, inflection_max_index);
85  spectrum_part = spectrum.rows(inflection_min_index, inflection_max_index);
86 
87  double area_between_inflection;
88  try{
89  area_between_inflection = arma::as_scalar(arma::trapz(abscissa_part, spectrum_part));
90  }catch(std::exception e){
91  std::cout << "Exception: invalid inflection points found" << std::endl;
92  area_between_inflection = std::nan("");
93  inflection_min_index = min_index;
94  inflection_max_index = max_index;
95  }
96 
97  window_size = inflection_max_index - inflection_min_index + 1;
98  inflection_baseline = arma::linspace(spectrum(inflection_min_index), spectrum(inflection_max_index), window_size);
99  double inf_baseline_area = arma::as_scalar(arma::trapz(abscissa_part, inflection_baseline));
100  inflection_baseline = join_horiz(abscissa.rows(inflection_min_index, inflection_max_index), inflection_baseline);
101 
102 
103 
104  //we need to make sure the peak center is within the originally specified range
105  arma::uword search_min_index = (inflection_min_index < min_index ? min_index : inflection_min_index);
106  arma::uword search_max_index = (inflection_max_index > max_index ? max_index : inflection_max_index);
107  arma::vec region = spectrum.rows(search_min_index, search_max_index);
108  arma::vec region_abscissa = abscissa.rows(search_min_index, search_max_index);
109 
110  double maximum = region.max();
111  arma::uword max_pos = region.index_max();
112  arma::vec search_baseline = arma::linspace(region(0), region(region.n_rows - 1), region.n_rows);
113  double peak_center = region_abscissa(max_pos);
114  double adj_maximum = maximum - search_baseline(max_pos);
115 
116  double half_maximum = adj_maximum / 2.0;
117  //find left inflection points
118 
119  arma::vec bandwidth_region = spectrum.rows(search_min_index, search_max_index);
120  arma::vec bandwidth_baseline = arma::linspace(bandwidth_region(0), bandwidth_region(bandwidth_region.n_rows - 1), bandwidth_region.n_rows);
121  bandwidth_region = bandwidth_region - bandwidth_baseline;
122  arma::vec bandwidth_abscissa = abscissa.rows(search_min_index, search_max_index);
123  bandwidth_region = bandwidth_region - half_maximum * arma::ones(bandwidth_region.n_rows);
124  arma::uword i = 0;
125  //search for first positive point, point before is inflection
126  while (i < bandwidth_region.n_rows && bandwidth_region(i) < 0){++i;}
127  arma::uword left = (i >= bandwidth_region.n_rows ? bandwidth_region.n_rows - 1 : i);
128 
129  //search for first negative point after first infleciton
130  while (i < bandwidth_region.n_rows && bandwidth_region(i) >= 0){++i;}
131  arma::uword right = (i >= bandwidth_region.n_rows ? bandwidth_region.n_rows - 1 : i);
132 
133  if (bandwidth_region.n_rows > left)
134  left = std::fabs(bandwidth_region(left)) < std::fabs(bandwidth_region(left + 1)) ? left : left + 1;
135  if (right > 0)
136  right = std::fabs(bandwidth_region(right)) < std::fabs(bandwidth_region(right - 1)) ? right : right - 1;
137 
138 
139  double fwhm = bandwidth_abscissa(right) - bandwidth_abscissa(left);
140 
141  results(0) = peak_center;
142  results(1) = maximum;
143  results(2) = adj_maximum;
144  results(3) = total_area;
145  results(4) = positive_area - baseline_area;
146  results(5) = area_between_inflection;
147  results(6) = area_between_inflection - inf_baseline_area;
148  results(7) = fwhm;
149 
150  return results;
151 }
152 
153 arma::mat Vespucci::Math::Quantification::QuantifyPeakMat(const arma::mat &spectra, const arma::vec &abscissa, double &min, double &max, arma::uword bound_window, arma::mat &total_baselines, arma::field<arma::mat> &inflection_baselines)
154 {
155  arma::mat results(spectra.n_cols, 8);
156  inflection_baselines.clear();
157  total_baselines.clear();
158  //total_baselines.set_size(spectra.n_cols, )
159  inflection_baselines.set_size(spectra.n_cols);
160  arma::field<arma::mat> total_baselines_tmp(spectra.n_cols);
161 
162 #ifdef _WIN32
163  #pragma omp parallel for default(none) \
164  shared(spectra, inflection_baselines, total_baselines_tmp, results, min, max, bound_window, abscissa)
165  for (intmax_t i = 0; i < (intmax_t) spectra.n_cols; ++i)
166 #else
167  #pragma omp parallel for default(none) \
168  shared(spectra, inflection_baselines, total_baselines_tmp, results, min, max, bound_window, abscissa)
169  for (size_t i = 0; i < spectra.n_cols; ++ i)
170 #endif
171  {
172  double temp_min = min;
173  double temp_max = max;
174  arma::mat total_baseline;
175  arma::mat inflection_baseline;
176  results.row(i) = Vespucci::Math::Quantification::QuantifyPeak(spectra.col(i), abscissa, temp_min, temp_max, bound_window, total_baseline, inflection_baseline);
177  inflection_baselines(i) = inflection_baseline;
178  total_baselines_tmp(i) = total_baseline;
179  }
180 
181  for (size_t i = 0; i < total_baselines_tmp.n_rows; ++i){
182  if (total_baselines.n_rows){
183  total_baselines = arma::join_horiz(total_baselines, total_baselines_tmp(i).col(1));
184  }
185  else{
186  total_baselines = total_baselines_tmp(i);
187  }
188  }
189  return results;
190 }
191 
198 arma::mat Vespucci::Math::Quantification::ConvertInflectionBaselines(const arma::field<arma::mat> &inflection_baselines)
199 {
200  arma::vec all_abscissa = inflection_baselines(0).col(0);
201 
202  for (arma::uword i = 0; i < inflection_baselines.n_elem; ++i){
203  arma::vec current_baseline = inflection_baselines(i).col(0);
204  all_abscissa = arma::join_vert(all_abscissa, current_baseline);
205  }
206  arma::vec abscissa = arma::unique(all_abscissa);
207  abscissa = arma::sort(abscissa);
208  arma::mat baseline_matrix(abscissa.n_rows, inflection_baselines.n_elem);
209 
210  for (arma::uword j = 0; j < inflection_baselines.n_elem; ++j){
211  arma::vec current_baseline = inflection_baselines(j).col(1);
212  arma::vec current_abscissa = inflection_baselines(j).col(0);
213  for (arma::uword i = 0; i < abscissa.n_rows; ++i){
214  arma::uvec indices = arma::find(current_abscissa == abscissa(i));
215  baseline_matrix(i, j) = (indices.n_rows > 0 ?
216  current_baseline(indices(0)) :
217  std::nan(""));
218  }
219  }
220  baseline_matrix = arma::join_horiz(abscissa, baseline_matrix);
221  return baseline_matrix;
222 }
223 
224 
225 
238 arma::rowvec Vespucci::Math::Quantification::FitGaussianPeak(const arma::vec &spectrum, const arma::vec &abscissa, double &min, double &max, arma::mat &baseline, arma::mat &fit, arma::rowvec &params, arma::mat residuals)
239 {
240  /*
241  arma::rowvec results(5);
242 
243  arma::uword min_index = Vespucci::Math::ClosestIndex(min, abscissa);
244  arma::uword max_index = Vespucci::Math::ClosestIndex(max, abscissa);
245 
246  arma::vec abscissa_part = abscissa.rows(min_index, max_index);
247  arma::vec spectrum_part = spectrum.rows(min_index, max_index);
248 
249  min = abscissa(min_index);
250  max = abscissa(max_index);
251 
252  baseline = arma::linspace(spectrum(min_index), spectrum(max_index), max_index - min_index + 1);
253  spectrum_part -= baseline;
254 
255  params = Vespucci::Math::NonLinLeastSq::FitGaussian(abscissa_part, spectrum_part).t();
256 
257  fit.clear();
258  fit.set_size(abscissa_part.n_rows, 2);
259  fit.col(0) = abscissa_part;
260  for (arma::uword i = 0; i < fit.n_rows; ++i)
261  fit(i, 1) = GaussianFn(abscissa_part(i), params.memptr());
262 
263  arma::vec residuals_vec;
264  double R_squared = Vespucci::Math::CalculateRSquared(spectrum_part, fit.col(1), residuals_vec);
265 
266  results(0) = params(0); //intensity
267  results(1) = arma::datum::sqrt2 * std::abs(params[2]) * std::sqrt(arma::datum::pi); //area
268  results(2) = 2 * std::sqrt(2 * std::log(2)) * params[2]; //fwhm
269  results(3) = params(1); //center
270  results(4) = R_squared; //R-squared
271  fit += baseline;
272  baseline = arma::join_horiz(abscissa_part, baseline);
273  residuals = arma::join_horiz(abscissa_part, residuals_vec);
274  return results;
275  */
276  return arma::rowvec();
277 }
278 
279 arma::mat Vespucci::Math::Quantification::FitGaussianPeakMat(const arma::mat &spectra, const arma::vec &abscissa, double &min, double &max, arma::mat &baselines, arma::mat &fits, arma::mat &params, arma::mat &residuals)
280 {
281 /*
282  arma::mat results(spectra.n_cols, 5);
283  params.clear();
284  fits.clear();
285  residuals.clear();
286  baselines.clear();
287  arma::field<arma::mat> baselines_tmp(spectra.n_cols);
288  arma::field<arma::mat> fits_tmp(spectra.n_cols);
289  arma::field<arma::mat> residuals_tmp(spectra.n_cols);
290  params.set_size(spectra.n_cols, 3);
291 
292 #ifdef _WIN32
293  #pragma omp parallel for default(none) \
294  shared(spectra, baselines_tmp, residuals_tmp, params, fits_tmp, results, min, max, bound_window, abscissa)
295  for (intmax_t i = 0; i < (intmax_t) spectra.n_cols; ++i)
296 #else
297  #pragma omp parallel for default(none) \
298  shared(spectra, baselines_tmp, residuals_tmp, params, fits_tmp, results, min, max, bound_window, abscissa)
299  for (size_t i = 0; i < spectra.n_cols; ++ i)
300 #endif
301  {
302  double temp_min = min;
303  double temp_max = max;
304  arma::vec baseline;
305  arma::rowvec params_tmp;
306  arma::vec current_residuals;
307  arma::vec fit;
308  results.row(i) = Vespucci::Math::Quantification::FitGaussianPeak(spectra.col(i),
309  abscissa,
310  temp_min,
311  temp_max,
312  baseline,
313  fit,
314  params_tmp,
315  current_residuals);
316  baselines_tmp(i) = baseline;
317  params.row(i) = params_tmp;
318  fits_tmp(i) = fit;
319  residuals_tmp(i) = current_residuals;
320  }
321 
322  for (size_t i = 0; i < baselines_tmp.n_rows; ++i){
323  if (baselines.n_rows)
324  baselines = arma::join_horiz(baselines, baselines_tmp(i).col(1));
325  else
326  baselines = baselines_tmp(i);
327  if (fits.n_rows)
328  fits = arma::join_horiz(fits, fits_tmp(i).col(1));
329  else
330  fits = fits_tmp(i);
331  if (residuals.n_rows)
332  residuals = arma::join_horiz(residuals, residuals_tmp(i).col(1));
333  else
334  residuals = residuals_tmp(i);
335 
336  }
337  return results;
338  */return arma::mat();
339 }
340 
353 arma::rowvec Vespucci::Math::Quantification::FitLorentzianPeak(const arma::vec &spectrum, const arma::vec &abscissa, double &min, double &max, arma::mat &baseline, arma::mat &fit, arma::rowvec &params, arma::mat residuals)
354 {
355  /*
356  arma::rowvec results(5);
357 
358  arma::uword min_index = Vespucci::Math::ClosestIndex(min, abscissa);
359  arma::uword max_index = Vespucci::Math::ClosestIndex(max, abscissa);
360 
361  arma::vec abscissa_part = abscissa.rows(min_index, max_index);
362  arma::vec spectrum_part = spectrum.rows(min_index, max_index);
363 
364  min = abscissa(min_index);
365  max = abscissa(max_index);
366 
367  baseline = arma::linspace(spectrum(min_index), spectrum(max_index), max_index - min_index + 1);
368  spectrum_part -= baseline;
369 
370  params = Vespucci::Math::NonLinLeastSq::FitLorentzian(abscissa_part, spectrum_part).t();
371 
372  fit.clear();
373  fit.set_size(abscissa_part.n_rows, 2);
374  fit.col(0) = abscissa_part;
375  for (arma::uword i = 0; i < fit.n_rows; ++i)
376  fit(i, 1) = LorentzianFn(abscissa_part(i), params.memptr());
377 
378  arma::vec residuals_vec;
379  double R_squared = Vespucci::Math::CalculateRSquared(spectrum_part, fit.col(1), residuals_vec);
380 
381  results(0) = params(0); //intensity
382  results(1) = arma::datum::sqrt2 * std::abs(params[2]) * std::sqrt(arma::datum::pi); //area
383  results(2) = 2.0 * params(1); //fwhm
384  results(3) = params(2); //center
385  results(4) = R_squared; //R-squared
386  fit += baseline;
387  baseline = arma::join_horiz(abscissa_part, baseline);
388  residuals = arma::join_horiz(abscissa_part, residuals_vec);
389  return results;
390  */
391  return arma::rowvec();
392 }
393 
406 arma::mat Vespucci::Math::Quantification::FitLorentzianPeakMat(const arma::mat &spectra, const arma::vec &abscissa, double &min, double &max, arma::mat &baselines, arma::mat &fits, arma::mat &params, arma::mat &residuals)
407 {
408  /*
409  arma::mat results(spectra.n_cols, 5);
410  params.clear();
411  fits.clear();
412  residuals.clear();
413  baselines.clear();
414  arma::field<arma::mat> baselines_tmp(spectra.n_cols);
415  arma::field<arma::mat> fits_tmp(spectra.n_cols);
416  arma::field<arma::mat> residuals_tmp(spectra.n_cols);
417  params.set_size(spectra.n_cols, 3);
418 
419 #ifdef _WIN32
420  #pragma omp parallel for default(none) \
421  shared(spectra, baselines_tmp, residuals_tmp, fits_tmp, params, results, min, max, bound_window, abscissa)
422  for (intmax_t i = 0; i < (intmax_t) spectra.n_cols; ++i)
423 #else
424  #pragma omp parallel for default(none) \
425  shared(spectra, baselines_tmp, residuals_tmp, fits_tmp, params, results, min, max, bound_window, abscissa)
426  for (size_t i = 0; i < spectra.n_cols; ++ i)
427 #endif
428  {
429  double temp_min = min;
430  double temp_max = max;
431  arma::vec baseline;
432  arma::rowvec params_tmp;
433  arma::vec current_residuals;
434  arma::vec fit;
435  results.row(i) = Vespucci::Math::Quantification::FitLorentzianPeak(spectra.col(i),
436  abscissa,
437  temp_min,
438  temp_max,
439  baseline,
440  fit,
441  params_tmp,
442  current_residuals);
443  baselines_tmp(i) = baseline;
444  params.row(i) = params_tmp;
445  fits_tmp(i) = fit;
446  residuals_tmp(i) = current_residuals;
447  }
448 
449  for (size_t i = 0; i < baselines_tmp.n_rows; ++i){
450  if (baselines.n_rows)
451  baselines = arma::join_horiz(baselines, baselines_tmp(i).col(1));
452  else
453  baselines = baselines_tmp(i);
454  if (fits.n_rows)
455  fits = arma::join_horiz(fits, fits_tmp(i).col(1));
456  else
457  fits = fits_tmp(i);
458  if (residuals.n_rows)
459  residuals = arma::join_horiz(residuals, residuals_tmp(i).col(1));
460  else
461  residuals = residuals_tmp(i);
462 
463  }
464  return results;
465  */
466  return arma::mat();
467 }
468 
481 arma::rowvec Vespucci::Math::Quantification::FitVoigtPeak(const arma::vec &spectrum, const arma::vec &abscissa, double &min, double &max, arma::mat &baseline, arma::mat &fit, arma::rowvec &params, arma::mat residuals)
482 {
483  /*
484  arma::rowvec results(7);
485 
486  arma::uword min_index = Vespucci::Math::ClosestIndex(min, abscissa);
487  arma::uword max_index = Vespucci::Math::ClosestIndex(max, abscissa);
488 
489  arma::vec abscissa_part = abscissa.rows(min_index, max_index);
490  arma::vec spectrum_part = spectrum.rows(min_index, max_index);
491 
492  min = abscissa(min_index);
493  max = abscissa(max_index);
494 
495  baseline = arma::linspace(spectrum(min_index), spectrum(max_index), max_index - min_index + 1);
496  spectrum_part -= baseline;
497 
498  params = Vespucci::Math::NonLinLeastSq::FitVoigt(abscissa_part, spectrum_part).t();
499 
500  fit.clear();
501  fit.set_size(abscissa_part.n_rows, 2);
502  fit.col(0) = abscissa_part;
503  for (arma::uword i = 0; i < fit.n_rows; ++i)
504  fit(i, 1) = VoigtFn(abscissa_part(i), params.memptr());
505 
506  arma::vec residuals_vec;
507  double R_squared = Vespucci::Math::CalculateRSquared(spectrum_part, fit.col(1), residuals_vec);
508 
509  results(0) = params(0); //intensity
510  results(1) = params(0); //area
511  results(2) = 2.0*params(2)*std::sqrt(std::log(2.0));//gaussian fwhm
512  results(3) = 2.0*params(3); //lorentzian fwhm
513  results(4) = 0.5346 * results(3) + std::sqrt(0.2166*std::pow(results(3), 2.0) + std::pow(results(2), 2.0));
514  results(5) = params(1); //center
515  results(6) = R_squared; //R-squared
516  fit += baseline;
517  baseline = arma::join_horiz(abscissa_part, baseline);
518  residuals = arma::join_horiz(abscissa_part, residuals);
519  return results;
520  */
521  return arma::rowvec();
522 }
523 
536 arma::mat Vespucci::Math::Quantification::FitVoigtPeakMat(const arma::mat &spectra, const arma::vec &abscissa, double &min, double &max, arma::mat &baselines, arma::mat &fits, arma::mat &params, arma::mat &residuals)
537 {
538  /*
539  arma::mat results(spectra.n_cols, 5);
540  params.clear();
541  fits.clear();
542  residuals.clear();
543  baselines.clear();
544  arma::field<arma::mat> baselines_tmp(spectra.n_cols);
545  arma::field<arma::mat> fits_tmp(spectra.n_cols);
546  arma::field<arma::mat> residuals_tmp(spectra.n_cols);
547  params.set_size(spectra.n_cols, 3);
548 
549 #ifdef _WIN32
550  #pragma omp parallel for default(none) \
551  shared(spectra, baselines_tmp, residuals_tmp, fits_tmp, params, results, min, max, bound_window, abscissa)
552  for (intmax_t i = 0; i < (intmax_t) spectra.n_cols; ++i)
553 #else
554  #pragma omp parallel for default(none) \
555  shared(spectra, baselines_tmp, residuals_tmp, fits_tmp, params, results, min, max, bound_window, abscissa)
556  for (size_t i = 0; i < spectra.n_cols; ++ i)
557 #endif
558  {
559  double temp_min = min;
560  double temp_max = max;
561  arma::vec baseline;
562  arma::rowvec params_tmp;
563  arma::vec current_residuals;
564  arma::vec fit;
565  results.row(i) = Vespucci::Math::Quantification::FitVoigtPeak(spectra.col(i),
566  abscissa,
567  temp_min,
568  temp_max,
569  baseline,
570  fit,
571  params_tmp,
572  current_residuals);
573  baselines_tmp(i) = baseline;
574  params.row(i) = params_tmp;
575  fits_tmp(i) = fit;
576  residuals_tmp(i) = current_residuals;
577  }
578 
579  for (size_t i = 0; i < baselines_tmp.n_rows; ++i){
580  if (baselines.n_rows)
581  baselines = arma::join_horiz(baselines, baselines_tmp(i).col(1));
582  else
583  baselines = baselines_tmp(i);
584  if (fits.n_rows)
585  fits = arma::join_horiz(fits, fits_tmp(i).col(1));
586  else
587  fits = fits_tmp(i);
588  if (residuals.n_rows)
589  residuals = arma::join_horiz(residuals, residuals_tmp(i).col(1));
590  else
591  residuals = residuals_tmp(i);
592 
593  }
594  return results;
595  */
596  return arma::mat();
597 }
VESPUCCI_EXPORT arma::uword max(arma::uword a, arma::uword b)
Vespucci::Math::max.
Definition: accessory.cpp:237
VESPUCCI_EXPORT arma::mat FitGaussianPeakMat(const arma::mat &spectra, const arma::vec &abscissa, double &min, double &max, arma::mat &baselines, arma::mat &fits, arma::mat &params, arma::mat &residuals)
VESPUCCI_EXPORT arma::rowvec FitLorentzianPeak(const arma::vec &spectrum, const arma::vec &abscissa, double &min, double &max, arma::mat &baseline, arma::mat &fit, arma::rowvec &params, arma::mat residuals)
Vespucci::Math::Quantification::FitLorentzianPeak.
VESPUCCI_EXPORT arma::uword LocalMinimum(const arma::mat &X, double &value)
Vespucci::Math::LocalMinimum.
Definition: accessory.cpp:77
VESPUCCI_EXPORT arma::rowvec FitGaussianPeak(const arma::vec &spectrum, const arma::vec &abscissa, double &min, double &max, arma::mat &baseline, arma::mat &fit, arma::rowvec &params, arma::mat residuals)
Vespucci::Math::Quantification::FitGaussianPeak Fit and analyze data with a Gaussian function...
VESPUCCI_EXPORT arma::rowvec QuantifyPeak(const arma::vec &spectrum, const arma::vec &abscissa, double &min, double &max, arma::uword bound_window, arma::mat &total_baseline, arma::mat &inflection_baseline)
Vespucci::Math::Quantification::QuantifyPeak Performs empirical analysis of peak shape and magnitude...
VESPUCCI_EXPORT arma::rowvec FitVoigtPeak(const arma::vec &spectrum, const arma::vec &abscissa, double &min, double &max, arma::mat &baseline, arma::mat &fit, arma::rowvec &params, arma::mat residuals)
Vespucci::Math::Quantification::FitVoigtPeak.
VESPUCCI_EXPORT arma::uword min(arma::uword a, arma::uword b)
Vespucci::Math::min.
Definition: accessory.cpp:249
VESPUCCI_EXPORT arma::mat ConvertInflectionBaselines(const arma::field< arma::mat > &inflection_baselines)
Vespucci::Math::Quantification::ConvertInflectionBaselines.
VESPUCCI_EXPORT arma::uword ClosestIndex(double value, const arma::vec &vector)
Vespucci::Math::ClosestIndex.
Definition: accessory.cpp:932
VESPUCCI_EXPORT arma::mat FitVoigtPeakMat(const arma::mat &spectra, const arma::vec &abscissa, double &min, double &max, arma::mat &baselines, arma::mat &fits, arma::mat &params, arma::mat &residuals)
Vespucci::Math::Quantification::FitVoigtPeakMat.
VESPUCCI_EXPORT arma::mat QuantifyPeakMat(const arma::mat &spectra, const arma::vec &abscissa, double &min, double &max, arma::uword bound_window, arma::mat &total_baselines, arma::field< arma::mat > &inflection_baselines)
VESPUCCI_EXPORT arma::mat FitLorentzianPeakMat(const arma::mat &spectra, const arma::vec &abscissa, double &min, double &max, arma::mat &baselines, arma::mat &fits, arma::mat &params, arma::mat &residuals)
Vespucci::Math::Quantification::FitLorentzianPeakMat.