- Timestamp:
- 02/06/05 19:46:16 (20 years ago)
- Location:
- trunk/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/SDLineFinder.cc
r369 r370 673 673 674 674 // search for spectral lines. Number of lines found is returned 675 int SDLineFinder::findLines( ) throw(casa::AipsError)675 int SDLineFinder::findLines(const casa::uInt &whichRow) throw(casa::AipsError) 676 676 { 677 677 const int minboxnchan=4; … … 685 685 throw AipsError("SDLineFinder::findLines - box_size is too small"); 686 686 687 scan->getSpectrum(spectrum );687 scan->getSpectrum(spectrum, whichRow); 688 688 689 689 lines.resize(0); // search from the scratch 690 last_row_used=whichRow; 690 691 Vector<Bool> temp_mask(mask); 691 692 … … 828 829 } 829 830 830 // get range for all lines found. If defunits is true (default), the 831 // same units as used in the scan will be returned (e.g. velocity 832 // instead of channels). If defunits is false, channels will be returned 833 std::vector<int> SDLineFinder::getLineRanges(bool defunits) 831 // get range for all lines found. The same units as used in the scan 832 // will be returned (e.g. velocity instead of channels). 833 std::vector<double> SDLineFinder::getLineRanges() 834 834 const throw(casa::AipsError) 835 { 836 // convert to required abscissa units 837 std::vector<double> vel=scan->getAbcissa(last_row_used); 838 std::vector<int> ranges=getLineRangesInChannels(); 839 std::vector<double> res(ranges.size()); 840 841 std::vector<int>::const_iterator cri=ranges.begin(); 842 std::vector<double>::iterator outi=res.begin(); 843 for (;cri!=ranges.end() && outi!=res.end();++cri,++outi) 844 if (uInt(*cri)>=vel.size()) 845 throw AipsError("SDLineFinder::getLineRanges - getAbcissa provided less channels than reqired"); 846 else *outi=vel[*cri]; 847 return res; 848 } 849 850 // The same as getLineRanges, but channels are always used to specify 851 // the range 852 std::vector<int> SDLineFinder::getLineRangesInChannels() 853 const throw(casa::AipsError) 835 854 { 836 855 try { 837 856 if (scan.null()) 838 throw AipsError("SDLineFinder::getLineRanges - a scan should be set first,"857 throw AipsError("SDLineFinder::getLineRangesInChannels - a scan should be set first," 839 858 " use set_scan followed by find_lines"); 840 859 DebugAssert(mask.nelements()==scan->nChan(), AipsError); 841 860 842 861 if (!lines.size()) 843 throw AipsError("SDLineFinder::getLineRanges - one have to search for "862 throw AipsError("SDLineFinder::getLineRangesInChannels - one have to search for " 844 863 "lines first, use find_lines"); 845 864 846 // temporary847 if (defunits)848 throw AipsError("SDLineFinder::getLineRanges - sorry, defunits=true have not "849 "yet been implemented");850 //851 865 std::vector<int> res(2*lines.size()); 852 866 // iterator through lines & result … … 857 871 if (++ri!=res.end()) 858 872 *ri=cli->second-1; 859 } 873 } 860 874 return res; 861 875 } … … 867 881 } 868 882 } 883 884 869 885 870 886 // an auxiliary function to remove all lines from the list, except the -
trunk/src/SDLineFinder.h
r369 r370 169 169 const boost::python::tuple &in_edge) throw(casa::AipsError); 170 170 171 // search for spectral lines. Number of lines found is returned 172 int findLines() throw(casa::AipsError); 171 // search for spectral lines for a row specified by whichRow and 172 // Beam/IF/Pol specified by current cursor set for the scantable 173 // Number of lines found is returned 174 int findLines(const casa::uInt &whichRow = 0) throw(casa::AipsError); 173 175 174 176 // get the mask to mask out all lines that have been found (default) … … 179 181 std::vector<bool> getMask(bool invert=false) const throw(casa::AipsError); 180 182 181 // get range for all lines found. If defunits is true (default), the 182 // same units as used in the scan will be returned (e.g. velocity 183 // instead of channels). If defunits is false, channels will be returned 184 std::vector<int> getLineRanges(bool defunits=true) 185 const throw(casa::AipsError); 183 // get range for all lines found. The same units as used in the scan 184 // will be returned (e.g. velocity instead of channels). 185 std::vector<double> getLineRanges() const throw(casa::AipsError); 186 // The same as getLineRanges, but channels are always used to specify 187 // the range 188 std::vector<int> getLineRangesInChannels() const throw(casa::AipsError); 186 189 protected: 187 190 // auxiliary function to average adjacent channels and update the mask … … 236 239 // adjacent channels to search 237 240 // for broad lines. see setOptions 241 casa::uInt last_row_used; // the Row number specified 242 // during the last findLines call 238 243 std::list<std::pair<int, int> > lines; // container of start and stop+1 239 244 // channels of the spectral lines -
trunk/src/python_SDLineFinder.cc
r369 r370 45 45 .def("getmask",&SDLineFinder::getMask) 46 46 .def("getlineranges",&SDLineFinder::getLineRanges) 47 .def("getlinerangesinchannels",&SDLineFinder::getLineRangesInChannels) 47 48 ; 48 49 };
Note:
See TracChangeset
for help on using the changeset viewer.