Changeset 3029 for trunk/src/STLineFinder.cpp
- Timestamp:
- 03/03/15 18:26:31 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/STLineFinder.cpp
r2961 r3029 89 89 const casa::Vector<casa::Bool> &in_mask, 90 90 const std::pair<int,int> &in_edge, 91 int in_max_box_nchan) throw(AipsError);91 int in_max_box_nchan); 92 92 93 93 // access to the statistics 94 const casa::Float& getLinMean() const throw(AipsError);95 const casa::Float& getLinVariance() const throw(AipsError);96 casa::Float aboveMean() const throw(AipsError);97 int getChannel() const throw();94 const casa::Float& getLinMean() const; 95 const casa::Float& getLinVariance() const; 96 casa::Float aboveMean() const; 97 int getChannel() const; 98 98 99 99 // actual number of channels in the box (max_box_nchan, if no channels 100 100 // are masked) 101 int getNumberOfBoxPoints() const throw();101 int getNumberOfBoxPoints() const; 102 102 103 103 // next channel 104 void next() throw(AipsError);104 void next(); 105 105 106 106 // checking whether there are still elements 107 casa::Bool haveMore() const throw();107 casa::Bool haveMore() const; 108 108 109 109 // go to start 110 void rewind() throw(AipsError);110 void rewind(); 111 111 112 112 protected: … … 116 116 // Channels, for which the mask is false or index is beyond the 117 117 // allowed range, are ignored 118 void advanceRunningBox(int ch) throw(casa::AipsError);118 void advanceRunningBox(int ch); 119 119 120 120 // calculate derivative statistics. This function is const, because 121 121 // it updates the cache only 122 void updateDerivativeStatistics() const throw(AipsError);122 void updateDerivativeStatistics() const; 123 123 }; 124 124 … … 166 166 casa::Float in_threshold = 5, 167 167 bool use_median = false, 168 int noise_sample_size = -1) throw();169 virtual ~LFAboveThreshold() throw();168 int noise_sample_size = -1); 169 virtual ~LFAboveThreshold(); 170 170 171 171 // replace the detection criterion 172 void setCriterion(int in_min_nchan, casa::Float in_threshold) throw();172 void setCriterion(int in_min_nchan, casa::Float in_threshold); 173 173 174 174 // return the array with signs of the value-current mean … … 176 176 // This array is updated each time the findLines method is called and 177 177 // is used to search the line wings 178 const casa::Vector<Int>& getSigns() const throw();178 const casa::Vector<Int>& getSigns() const; 179 179 180 180 // find spectral lines and add them into list … … 186 186 const casa::Vector<casa::Bool> &mask, 187 187 const std::pair<int,int> &edge, 188 int max_box_nchan) throw(casa::AipsError);188 int max_box_nchan); 189 189 190 190 protected: … … 193 193 // add a new line to the list, if necessary using processCurLine() 194 194 // detect=true indicates that the current channel satisfies the criterion 195 void processChannel(Bool detect, const casa::Vector<casa::Bool> &mask) 196 throw(casa::AipsError); 195 void processChannel(Bool detect, const casa::Vector<casa::Bool> &mask); 197 196 198 197 // process the interval of channels stored in curline 199 198 // if it satisfies the criterion, add this interval as a new line 200 void processCurLine(const casa::Vector<casa::Bool> &mask) 201 throw(casa::AipsError); 199 void processCurLine(const casa::Vector<casa::Bool> &mask); 202 200 203 201 // get the sign of runningBox->aboveMean(). The RunningBox pointer 204 202 // should be defined 205 casa::Int getAboveMeanSign() const throw();203 casa::Int getAboveMeanSign() const; 206 204 }; 207 205 … … 463 461 const casa::Vector<casa::Bool> &in_mask, 464 462 const std::pair<int,int> &in_edge, 465 int in_max_box_nchan) throw(AipsError):463 int in_max_box_nchan) : 466 464 spectrum(in_spectrum), mask(in_mask), edge(in_edge), 467 465 max_box_nchan(in_max_box_nchan) … … 470 468 } 471 469 472 void RunningBox::rewind() throw(AipsError){470 void RunningBox::rewind() { 473 471 // fill statistics for initial box 474 472 box_chan_cntr=0; // no channels are currently in the box … … 491 489 492 490 // access to the statistics 493 const casa::Float& RunningBox::getLinMean() const throw(AipsError)491 const casa::Float& RunningBox::getLinMean() const 494 492 { 495 493 DebugAssert(cur_channel<edge.second, AipsError); … … 498 496 } 499 497 500 const casa::Float& RunningBox::getLinVariance() const throw(AipsError)498 const casa::Float& RunningBox::getLinVariance() const 501 499 { 502 500 DebugAssert(cur_channel<edge.second, AipsError); … … 505 503 } 506 504 507 casa::Float RunningBox::aboveMean() const throw(AipsError)505 casa::Float RunningBox::aboveMean() const 508 506 { 509 507 DebugAssert(cur_channel<edge.second, AipsError); … … 512 510 } 513 511 514 int RunningBox::getChannel() const throw()512 int RunningBox::getChannel() const 515 513 { 516 514 return cur_channel; … … 519 517 // actual number of channels in the box (max_box_nchan, if no channels 520 518 // are masked) 521 int RunningBox::getNumberOfBoxPoints() const throw()519 int RunningBox::getNumberOfBoxPoints() const 522 520 { 523 521 return box_chan_cntr; … … 529 527 // Channels, for which the mask is false or index is beyond the 530 528 // allowed range, are ignored 531 void RunningBox::advanceRunningBox(int ch) throw(AipsError)529 void RunningBox::advanceRunningBox(int ch) 532 530 { 533 531 if (ch>=edge.first && ch<edge.second) … … 555 553 556 554 // next channel 557 void RunningBox::next() throw(AipsError)555 void RunningBox::next() 558 556 { 559 557 AlwaysAssert(cur_channel<edge.second,AipsError); … … 564 562 565 563 // checking whether there are still elements 566 casa::Bool RunningBox::haveMore() const throw()564 casa::Bool RunningBox::haveMore() const 567 565 { 568 566 return cur_channel<edge.second; … … 571 569 // calculate derivative statistics. This function is const, because 572 570 // it updates the cache only 573 void RunningBox::updateDerivativeStatistics() const throw(AipsError)571 void RunningBox::updateDerivativeStatistics() const 574 572 { 575 573 AlwaysAssert(box_chan_cntr, AipsError); … … 616 614 casa::Float in_threshold, 617 615 bool use_median, 618 int noise_sample_size) throw():616 int noise_sample_size) : 619 617 min_nchan(in_min_nchan), threshold(in_threshold), 620 618 lines(in_lines), running_box(NULL), itsUseMedian(use_median), 621 619 itsNoiseSampleSize(noise_sample_size) {} 622 620 623 LFAboveThreshold::~LFAboveThreshold() throw()621 LFAboveThreshold::~LFAboveThreshold() 624 622 { 625 623 if (running_box!=NULL) delete running_box; … … 628 626 // replace the detection criterion 629 627 void LFAboveThreshold::setCriterion(int in_min_nchan, casa::Float in_threshold) 630 throw()631 628 { 632 629 min_nchan=in_min_nchan; … … 636 633 // get the sign of runningBox->aboveMean(). The RunningBox pointer 637 634 // should be defined 638 casa::Int LFAboveThreshold::getAboveMeanSign() const throw()635 casa::Int LFAboveThreshold::getAboveMeanSign() const 639 636 { 640 637 const Float buf=running_box->aboveMean(); … … 648 645 // add a new line to the list, if necessary 649 646 void LFAboveThreshold::processChannel(Bool detect, 650 const casa::Vector<casa::Bool> &mask) throw(casa::AipsError)647 const casa::Vector<casa::Bool> &mask) 651 648 { 652 649 try { … … 680 677 // if it satisfies the criterion, add this interval as a new line 681 678 void LFAboveThreshold::processCurLine(const casa::Vector<casa::Bool> &mask) 682 throw(casa::AipsError)683 679 { 684 680 try { … … 714 710 // This array is updated each time the findLines method is called and 715 711 // is used to search the line wings 716 const casa::Vector<Int>& LFAboveThreshold::getSigns() const throw()712 const casa::Vector<Int>& LFAboveThreshold::getSigns() const 717 713 { 718 714 return signs; … … 724 720 const std::pair<int,int> &edge, 725 721 int max_box_nchan) 726 throw(casa::AipsError)727 722 { 728 723 const int minboxnchan=4; … … 811 806 // common channel, and false otherwise 812 807 // line2 - range of the second line: start channel and stop+1 813 bool LFLineListOperations::IntersectsWith::operator()(const std::pair<int,int> &line2) 814 const throw() 808 bool LFLineListOperations::IntersectsWith::operator()(const std::pair<int,int> &line2) const 815 809 { 816 810 if (line2.second<line1.first) return false; // line2 is at lower channels … … 835 829 // provided there is no gap between the lines 836 830 void LFLineListOperations::BuildUnion::operator()(const std::pair<int,int> &new_line) 837 throw()838 831 { 839 832 if (new_line.first<temp_line.first) temp_line.first=new_line.first; … … 842 835 843 836 // return the result (temp_line) 844 const std::pair<int,int>& LFLineListOperations::BuildUnion::result() const throw()837 const std::pair<int,int>& LFLineListOperations::BuildUnion::result() const 845 838 { 846 839 return temp_line; … … 864 857 // in the ordered list (so, it is at greater channel numbers) 865 858 bool LFLineListOperations::LaterThan::operator()(const std::pair<int,int> &line2) 866 const throw()859 const 867 860 { 868 861 if (line2.second<line1.first) return false; // line2 is at lower channels … … 884 877 // 885 878 886 STLineFinder::STLineFinder() throw(): edge(0,0), err("spurious")879 STLineFinder::STLineFinder() : edge(0,0), err("spurious") 887 880 { 888 881 useScantable = true; … … 918 911 const casa::Float &in_box_size, 919 912 const casa::Float &in_noise_box, 920 const casa::Bool &in_median) throw()913 const casa::Bool &in_median) 921 914 { 922 915 threshold=in_threshold; … … 928 921 } 929 922 930 STLineFinder::~STLineFinder() throw(AipsError){}923 STLineFinder::~STLineFinder() {} 931 924 932 925 // set scan to work with (in_scan parameter) 933 void STLineFinder::setScan(const ScantableWrapper &in_scan) throw(AipsError)926 void STLineFinder::setScan(const ScantableWrapper &in_scan) 934 927 { 935 928 scan=in_scan.getCP(); … … 957 950 int STLineFinder::findLines(const std::vector<bool> &in_mask, 958 951 const std::vector<int> &in_edge, 959 const casa::uInt &whichRow) throw(casa::AipsError)952 const casa::uInt &whichRow) 960 953 { 961 954 if (useScantable && scan.null()) … … 1105 1098 // reducing the spectral resolution if the baseline shape is bad 1106 1099 void STLineFinder::subtractBaseline(const casa::Vector<casa::Bool> &temp_mask, 1107 const casa::Int &order) throw(casa::AipsError)1100 const casa::Int &order) 1108 1101 { 1109 1102 AlwaysAssert(spectrum.nelements(),AipsError); … … 1131 1124 void STLineFinder::averageAdjacentChannels(casa::Vector<casa::Bool> &mask2update, 1132 1125 const casa::Int &boxsize) 1133 throw(casa::AipsError)1134 1126 { 1135 1127 DebugAssert(mask2update.nelements()==spectrum.nelements(), AipsError); … … 1163 1155 // in setScan) are still excluded regardless on the invert option 1164 1156 std::vector<bool> STLineFinder::getMask(bool invert) 1165 const throw(casa::AipsError)1157 const 1166 1158 { 1167 1159 try { … … 1205 1197 // get range for all lines found. The same units as used in the scan 1206 1198 // will be returned (e.g. velocity instead of channels). 1207 std::vector<double> STLineFinder::getLineRanges() 1208 const throw(casa::AipsError) 1199 std::vector<double> STLineFinder::getLineRanges() const 1209 1200 { 1210 1201 std::vector<double> vel; … … 1230 1221 // The same as getLineRanges, but channels are always used to specify 1231 1222 // the range 1232 std::vector<int> STLineFinder::getLineRangesInChannels() 1233 const throw(casa::AipsError) 1223 std::vector<int> STLineFinder::getLineRangesInChannels() const 1234 1224 { 1235 1225 try { … … 1280 1270 std::list<std::pair<int, int> > &lines2update, 1281 1271 int max_box_nchan) 1282 throw (casa::AipsError)1283 1272 { 1284 1273 try { … … 1339 1328 void LFLineListOperations::addNewSearchResult(const std::list<pair<int, int> > &newlines, 1340 1329 std::list<std::pair<int, int> > &lines_list) 1341 throw(AipsError)1342 1330 { 1343 1331 try { … … 1386 1374 const casa::Vector<casa::Int> &signs, 1387 1375 const casa::Vector<casa::Bool> &mask, 1388 const std::pair<int,int> &edge) throw(casa::AipsError)1376 const std::pair<int,int> &edge) 1389 1377 { 1390 1378 try {
Note: See TracChangeset
for help on using the changeset viewer.