Changeset 1643
- Timestamp:
- 10/03/09 16:03:32 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/STLineFinder.cpp
r1642 r1643 317 317 // buffer size 318 318 const size_t nSamples = itsBufferFull ? itsVariances.size(): itsSampleNumber; 319 AlwaysAssert( (nSamples > 0) && (nSamples < itsVariances.size()), AipsError);319 AlwaysAssert( (nSamples > 0) && (nSamples <= itsVariances.size()), AipsError); 320 320 return nSamples; 321 321 } … … 423 423 // buffer size 424 424 const size_t nSamples = numberOfSamples(); 425 AlwaysAssert(nSamples < itsSortedIndices.size(), AipsError);425 AlwaysAssert(nSamples <= itsSortedIndices.size(), AipsError); 426 426 for (size_t i=0; i<nSamples; ++i) { 427 427 itsSortedIndices[i]=i; … … 711 711 // an assumption made: lines occupy a small part of the spectrum 712 712 713 std::vector<float> variances(edge.second-edge.first); 714 DebugAssert(variances.size(),AipsError); 715 716 for (;running_box->haveMore();running_box->next()) 717 variances[running_box->getChannel()-edge.first]= 718 running_box->getLinVariance(); 719 720 // in the future we probably should do a proper Chi^2 estimation 721 // now a simple 80% of smaller values will be used. 722 // it may degrade the performance of the algorithm for weak lines 723 // due to a bias of the Chi^2 distribution. 724 stable_sort(variances.begin(),variances.end()); 725 726 Float offline_variance=0; 727 uInt offline_cnt=uInt(0.8*variances.size()); 728 if (!offline_cnt) offline_cnt=variances.size(); // no much else left, 729 // although it is very inaccurate 730 for (uInt n=0;n<offline_cnt;++n) 731 offline_variance+=variances[n]; 732 offline_variance/=Float(offline_cnt); 713 DebugAssert(edge.second-edge.first,AipsError); 714 LFNoiseEstimator ne(edge.second-edge.first); 715 716 for (;running_box->haveMore();running_box->next()) { 717 ne.add(running_box->getLinVariance()); 718 } 719 720 const Float offline_variance = ne.meanLowest80Percent(); 733 721 734 722 // actual search algorithm … … 909 897 const casa::uInt &whichRow) throw(casa::AipsError) 910 898 { 911 //const int minboxnchan=4;912 899 if (scan.null()) 913 900 throw AipsError("STLineFinder::findLines - a scan should be set first,"
Note:
See TracChangeset
for help on using the changeset viewer.