29 const int MARKER = -999999;
32 VecFilter::VecFilter() {}
35 VecFilter::~VecFilter() {};
48 vector<double> VecFilter::LowPass(vector<double> invec,
int boxsize) {
49 vector<double> outvec;
55 if((boxsize % 2) == 0) {
56 string m =
"Boxcar size must be odd and greater than 1 in [VecFilter::LowPass]";
61 int halfwidth = boxsize / 2;
62 int vecsize = (int)invec.size() - 1;
63 for(
int i = 0; i <= vecsize; i++) {
64 int i1 = i - halfwidth;
66 int i2 = i + halfwidth;
67 if(i2 > vecsize) i2 = vecsize;
70 for(
int j = i1; j <= i2; j++) {
77 outvec.push_back(sum / npts);
80 outvec.push_back(0.0);
96 vector<double> VecFilter::HighPass(vector<double> invec1, vector<double> invec2) {
97 vector<double> outvec;
100 if(invec1.size() != invec2.size()) {
101 string m =
"Both vectors must be the same size in [VecFilter::HighPass]";
105 int vecsize = (int)invec1.size() - 1;
106 for(
int i = 0; i <= vecsize; i++) {
107 if(invec1[i] != 0.0 && invec2[i] != 0.0) {
108 outvec.push_back(invec1[i] - invec2[i]);
111 outvec.push_back(0.0);
134 vector<double> VecFilter::HighPass(vector<double> pdInVector1, vector<double> pdInVector2,
135 vector<int> piValidPntsVector,
int piMaxPoints,
const QString & psMode)
137 vector<double> dOutVector;
140 if(pdInVector1.size() != pdInVector2.size()) {
141 string m =
"Both vectors must be the same size in [VecFilter::HighPass]";
142 throw IException(IException::Programmer, m,
_FILEINFO_);
145 int iSize = (int)pdInVector1.size();
146 for(
int i = 0; i < iSize; i++) {
147 if(pdInVector1[i] != 0.0 && pdInVector2[i] != 0.0 && piValidPntsVector[i]==piMaxPoints) {
148 if(psMode ==
"SUBTRACT") {
149 dOutVector.push_back(pdInVector1[i] - pdInVector2[i]);
152 dOutVector.push_back(pdInVector1[i] / pdInVector2[i]);
156 dOutVector.push_back(MARKER);
Namespace for the standard library.
#define _FILEINFO_
Macro for the filename and line number.
Namespace for ISIS/Bullet specific routines.