Vespucci  1.0.0
testsession.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 *******************************************************************************/
20 #include "testsession.h"
21 
23 {
24 
25 }
26 
52 void TestSession::GenerateMockData(mat &spectra, vec &abscissa, vec &x, vec &y,
53  mat &peak_data, mat &baselines)
54 {
55  double raman_a0 = 1;
56  double raman_a1 = 1;
57  double raman_a2 = 1;
58  double fluor_a0 = 1;
59  double fluor_a1 = 1;
60  double fluor_a2 = 1;
61  abscissa = linspace(100, 4000, 4096);
62  spectra = zeros(4096, 100);
63  vec coords = linspace(0, 9, 10);
64  y = coords;
65  while (y.n_rows < 100)
66  y = join_vert(y, coords);
67 
68  x = zeros(10);
69  uword x_row = 0;
70  while (x.n_rows < 100)
71  x = join_vert(x, (x_row++) * ones(10));
72  mat unique_baselines(4096, 5);
73  unique_baselines.col(0) = zeros(4096);
74  unique_baselines.col(1) = GenerateRamanBaseline(raman_a0, raman_a1, raman_a2, abscissa);
75  unique_baselines.col(2) = GenerateRamanBaseline(fluor_a0, fluor_a1, fluor_a2, abscissa);
76  unique_baselines.col(3) = 0.5 * (unique_baselines.col(1), unique_baselines.col(2));
77  unique_baselines.col(4) = linspace(0, 25000, 4096);
78  vec peak_centers = (3600 * randu<vec>(4096)) + (200 * ones(4096));
79  vec peak_intensities = (49000 * randu<vec>(4096)) + (1000 * ones(4096));
80  vec peak_fwhm = (95 * randu<vec>(4096)) + (5 * ones(4096));
81  for (uword i = 0; i < 50; ++i){
82  for (uword j = 0; j < 5; ++j){
83  vec peak_center = peak_centers.col(j);
84  vec peak_intensity = peak_intensities.col(j);
85  vec peak_width = peak_fwhm.col(j);
86  for (uword k = 0; k < 5; ++j){
87  vec baseline = baselines.col(k);
88  baselines.col(i) = baseline;
89  }
90  }
91  }
92 
93 }
94 
95 arma::vec TestSession::GenerateLinearBaseline(double min, double max, uword size)
96 {
97  return linspace(min, max, size);
98 }
99 
100 arma::vec TestSession::GenerateRamanBaseline(double a0, double a1, double a2, const vec &abscissa)
101 {
102  return a0 + a1*abscissa + a2*arma::pow(abscissa, 2);
103 }
104 
105 arma::vec TestSession::GenerateGaussian(vec abscissa, vec centers, vec fwhm, vec intensities)
106 {
107  return arma::vec();
108 }
vec GenerateLinearBaseline(double min, double max, uword size)
Definition: testsession.cpp:95
vec GenerateRamanBaseline(double a0, double a1, double a2, const vec &abscissa)
VESPUCCI_EXPORT arma::uword max(arma::uword a, arma::uword b)
Vespucci::Math::max.
Definition: accessory.cpp:237
vec GenerateGaussian(vec abscissa, vec centers, vec fwhm, vec intensities)
VESPUCCI_EXPORT arma::uword min(arma::uword a, arma::uword b)
Vespucci::Math::min.
Definition: accessory.cpp:249
void GenerateMockData(mat &spectra, vec &abscissa, vec &x, vec &y, mat &peak_data, mat &baselines)
TestSession::GenerateMockData.
Definition: testsession.cpp:52