Skip to content

Commit

Permalink
The peak finder was modified to pass new tests.
Browse files Browse the repository at this point in the history
[@colosse1 unit-tests]$ bash test_peakFinder.sh > log
[@colosse1 unit-tests]$ grep PASS log|wc -l
58
[@colosse1 unit-tests]$ grep FAIL log|wc -l
0
[@colosse1 unit-tests]$ grep error log|wc -l
0

main.sh runs all tests.

Signed-off-by: Sébastien Boisvert <sebastien.boisvert.3@ulaval.ca>
  • Loading branch information
Sébastien Boisvert committed Jul 10, 2012
1 parent a519e0c commit 538550f
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion code/plugin_Library/LibraryPeakFinder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
using namespace std;

#define CONFIG_SOFT_SIGNAL_THRESHOLD 32
#define CONFIG_PEAK_MINIMUM_SIGNAL 2

/** find multiple peaks in the distribution of inserts for a library */
void LibraryPeakFinder::findPeaks(vector<int>*x,vector<int>*y,vector<int>*peakAverages,vector<int>*peakStandardDeviation){
Expand All @@ -51,6 +52,8 @@ void LibraryPeakFinder::findPeaks(vector<int>*x,vector<int>*y,vector<int>*peakAv
peakAverages->push_back(x->at(i));
peakStandardDeviation->push_back(i);

cout<<"[LibraryPeakFinder] too few points"<<endl;

return;
}

Expand All @@ -61,18 +64,29 @@ void LibraryPeakFinder::findPeaks(vector<int>*x,vector<int>*y,vector<int>*peakAv
vector<int> backgroundData;

for(int i=0;i<(int)y->size();i++){
if(y->at(i) < CONFIG_SOFT_SIGNAL_THRESHOLD){

int verticalValue=y->at(i);

if(verticalValue < CONFIG_PEAK_MINIMUM_SIGNAL){
continue;
}

if(verticalValue < CONFIG_SOFT_SIGNAL_THRESHOLD){
backgroundData.push_back(y->at(i));
}
}

int signalAverage=(int)getAverage(&backgroundData);

#define VERBOSE

#ifdef VERBOSE
int signalMode=getMode(&backgroundData);
cout<<"Mode= "<<signalMode<<" signalAverage= "<<signalAverage<<endl;
#endif

#undef VERBOSE

int signalThreshold=signalAverage;

int minimumAccumulatedNoiseSignals=8;
Expand Down

0 comments on commit 538550f

Please sign in to comment.