19 #include "CorrectBValuesCLP.h" 29 main (
int argc,
char const* argv[])
35 typedef std::vector<double> STDVectorType;
36 STDVectorType bVector;
37 std::cout <<
"Read b values from " << _InputFile << std::endl << std::flush;
40 std::vector<STDVectorType> bVectors;
41 std::vector<std::vector<int> > bIndices;
42 STDVectorType bMax, bMin;
43 for (
int i = 0; i < bVector.size(); i += 1 )
45 double b = bVector[i];
47 for ( j = 0; j < bVectors.size(); j += 1 )
49 if (b>=bMin[j]-_BThreshold && b<=bMax[j]+_BThreshold)
51 bVectors[j].push_back(b);
52 bIndices[j].push_back(i);
60 if (j==bVectors.size())
62 STDVectorType bVecTemp;
63 bVecTemp.push_back(b);
64 bVectors.push_back(bVecTemp);
65 std::vector<int> bIndexTemp;
66 bIndexTemp.push_back(i);
67 bIndices.push_back(bIndexTemp);
73 for (
int j = 0; j < bVectors.size(); j += 1 )
75 utlAssert(bMax[j]-bMin[j]<100.0,
"the range of b values is larger than 100, which can not be in the same shell");
76 std::cout <<
"shell " << j <<
": bMin=" << bMin[j] <<
" ,bMax=" << bMax[j] <<
", " << bVectors[j].size() <<
" b values." << std::endl << std::flush;
78 for (
int k = 0; k < bVectors[j].size(); k += 1 )
79 bMean += bVectors[j][k];
80 bMean /= bVectors[j].size();
81 if (bMean<_BThreshold)
83 for (
int k = 0; k < bVectors[j].size(); k += 1 )
85 bVector[bIndices[j][k] ] = bMean;
89 std::cout <<
"Save corrected b values to " << _OutputFile << std::endl << std::flush;
void SaveVector(const VectorType &vv, const int NSize, const std::string &vectorStr, const bool is_save_number=false)
int main(int argc, char const *argv[])
b values whose distance is smallter the threshold will be considered in the same shell, and they will be replaced as their mean b value.
void ReadVector(const std::string &vectorStr, std::vector< T > &vec, const char *cc=" ")
#define utlAssert(cond, expout)