11 #include "VecFilter.h"
12 #include "IException.h"
16 const int MARKER = -999999;
19 VecFilter::VecFilter() {}
22 VecFilter::~VecFilter() {};
35 vector<double> VecFilter::LowPass(vector<double> invec,
int boxsize) {
36 vector<double> outvec;
42 if((boxsize % 2) == 0) {
43 string m =
"Boxcar size must be odd and greater than 1 in [VecFilter::LowPass]";
44 throw IException(IException::Programmer, m, _FILEINFO_);
48 int halfwidth = boxsize / 2;
49 int vecsize = (int)invec.size() - 1;
50 for(
int i = 0; i <= vecsize; i++) {
51 int i1 = i - halfwidth;
53 int i2 = i + halfwidth;
54 if(i2 > vecsize) i2 = vecsize;
57 for(
int j = i1; j <= i2; j++) {
64 outvec.push_back(sum / npts);
67 outvec.push_back(0.0);
83 vector<double> VecFilter::HighPass(vector<double> invec1, vector<double> invec2) {
84 vector<double> outvec;
87 if(invec1.size() != invec2.size()) {
88 string m =
"Both vectors must be the same size in [VecFilter::HighPass]";
89 throw IException(IException::Programmer, m, _FILEINFO_);
92 int vecsize = (int)invec1.size() - 1;
93 for(
int i = 0; i <= vecsize; i++) {
94 if(invec1[i] != 0.0 && invec2[i] != 0.0) {
95 outvec.push_back(invec1[i] - invec2[i]);
98 outvec.push_back(0.0);
121 vector<double> VecFilter::HighPass(vector<double> pdInVector1, vector<double> pdInVector2,
122 vector<int> piValidPntsVector,
int piMaxPoints,
const QString & psMode)
124 vector<double> dOutVector;
127 if(pdInVector1.size() != pdInVector2.size()) {
128 string m =
"Both vectors must be the same size in [VecFilter::HighPass]";
129 throw IException(IException::Programmer, m, _FILEINFO_);
132 int iSize = (int)pdInVector1.size();
133 for(
int i = 0; i < iSize; i++) {
134 if(pdInVector1[i] != 0.0 && pdInVector2[i] != 0.0 && piValidPntsVector[i]==piMaxPoints) {
135 if(psMode ==
"SUBTRACT") {
136 dOutVector.push_back(pdInVector1[i] - pdInVector2[i]);
139 dOutVector.push_back(pdInVector1[i] / pdInVector2[i]);
143 dOutVector.push_back(MARKER);