Changeset 1360
- Timestamp:
- 04/27/07 11:00:43 (18 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/python/__init__.py
r1351 r1360 417 417 get_restfreqs - get the current list of rest frequencies 418 418 set_restfreqs - set a list of rest frequencies 419 shift_refpix - shift the reference pixel of the IFs 419 420 flag - flag selected channels in the data 420 421 lag_flag - flag specified frequency in the data -
trunk/python/scantable.py
r1356 r1360 852 852 self._add_history("set_restfreqs", varlist) 853 853 854 854 def shift_refpix(self, delta): 855 """ 856 Shift the reference pixel of the Spectra Coordinate by an 857 integer amount. 858 Parameters: 859 delta: the amount to shift by 860 Note: 861 Be careful using this with broadband data. 862 """ 863 Scantable.shift(self, delta) 855 864 856 865 def history(self, filename=None): -
trunk/src/STFrequencies.cpp
r941 r1360 41 41 } 42 42 43 asap::STFrequencies::STFrequencies( casa::Table tab ) :43 STFrequencies::STFrequencies( casa::Table tab ) : 44 44 STSubTable(tab, name_) 45 45 { … … 54 54 } 55 55 56 STFrequencies & asap::STFrequencies::operator=( const STFrequencies & other )56 STFrequencies & STFrequencies::operator=( const STFrequencies & other ) 57 57 { 58 58 if ( this != &other ) { … … 140 140 // get first row - there should only be one matching id 141 141 const TableRecord& rec = row.get(0); 142 143 142 return SpectralCoordinate( getFrame(true), rec.asDouble("REFVAL"), 144 143 rec.asDouble("INCREMENT"), … … 147 146 148 147 SpectralCoordinate 149 asap::STFrequencies::getSpectralCoordinate( const MDirection& md,150 151 152 148 STFrequencies::getSpectralCoordinate( const MDirection& md, 149 const MPosition& mp, 150 const MEpoch& me, 151 Double restfreq, uInt id ) const 153 152 { 154 153 SpectralCoordinate spc = getSpectralCoordinate(id); … … 242 241 } 243 242 244 std::string asap::STFrequencies::getFrameString( bool base ) const243 std::string STFrequencies::getFrameString( bool base ) const 245 244 { 246 245 if ( base ) return table_.keywordSet().asString("BASEFRAME"); … … 248 247 } 249 248 250 std::string asap::STFrequencies::getUnitString( ) const249 std::string STFrequencies::getUnitString( ) const 251 250 { 252 251 return table_.keywordSet().asString("UNIT"); 253 252 } 254 253 255 Unit asap::STFrequencies::getUnit( ) const254 Unit STFrequencies::getUnit( ) const 256 255 { 257 256 return Unit(table_.keywordSet().asString("UNIT")); 258 257 } 259 258 260 std::string asap::STFrequencies::getDopplerString( ) const259 std::string STFrequencies::getDopplerString( ) const 261 260 { 262 261 return table_.keywordSet().asString("DOPPLER"); 263 262 } 264 263 265 MDoppler::Types asap::STFrequencies::getDoppler( ) const264 MDoppler::Types STFrequencies::getDoppler( ) const 266 265 { 267 266 String dpl = table_.keywordSet().asString("DOPPLER"); … … 275 274 } 276 275 277 std::string asap::STFrequencies::print( int id )276 std::string STFrequencies::print( int id ) 278 277 { 279 278 Table t; … … 303 302 } 304 303 305 bool asap::STFrequencies::conformant( const STFrequencies& other ) const304 bool STFrequencies::conformant( const STFrequencies& other ) const 306 305 { 307 306 const Record& r = table_.keywordSet(); … … 314 313 } 315 314 316 std::vector< std::string > asap::STFrequencies::getInfo( ) const315 std::vector< std::string > STFrequencies::getInfo( ) const 317 316 { 318 317 const Record& r = table_.keywordSet(); … … 324 323 } 325 324 326 void asap::STFrequencies::setInfo( const std::vector< std::string >& theinfo )325 void STFrequencies::setInfo( const std::vector< std::string >& theinfo ) 327 326 { 328 327 if ( theinfo.size() != 3 ) throw(AipsError("setInfo needs three parameters")); … … 336 335 } 337 336 338 void asap::STFrequencies::setUnit( const std::string & unit )337 void STFrequencies::setUnit( const std::string & unit ) 339 338 { 340 339 if (unit == "" || unit == "pixel" || unit == "channel" ) { … … 350 349 } 351 350 352 void asap::STFrequencies::setFrame(MFrequency::Types frame, bool base )351 void STFrequencies::setFrame(MFrequency::Types frame, bool base ) 353 352 { 354 353 String f = MFrequency::showType(frame); … … 360 359 } 361 360 362 void asap::STFrequencies::setFrame( const std::string & frame, bool base )361 void STFrequencies::setFrame( const std::string & frame, bool base ) 363 362 { 364 363 MFrequency::Types mdr; … … 380 379 } 381 380 382 void asap::STFrequencies::setDoppler( const std::string & doppler )381 void STFrequencies::setDoppler( const std::string & doppler ) 383 382 { 384 383 MDoppler::Types mdt; … … 397 396 } 398 397 398 void STFrequencies::shiftRefPix(int npix, uInt id) 399 { 400 Table t = table_(table_.col("ID") == Int(id) ); 401 if ( t.nrow() == 0 ) throw(AipsError("Selected Illegal frequency id")); 402 ScalarColumn<Double> tcol(t, "REFPIX"); 403 tcol.put(0, tcol(0)+Double(npix)); 404 } 399 405 400 406 } // namespace -
trunk/src/STFrequencies.h
r1353 r1360 134 134 float getRefFreq(casa::uInt id, casa::uInt channel); 135 135 136 137 136 /** 138 * Rteun this table or s specific row as a string representation 137 * shift the reference pixel by an integer amount 138 * @param npix the shift in pixels 139 * @param id the coordinate id 140 */ 141 void shiftRefPix(int npix, casa::uInt id); 142 /** 143 * Return this table or s specific row as a string representation 139 144 * @param id the identifier. If id<0 all rows are returned 140 145 * @return a string -
trunk/src/Scantable.cpp
r1334 r1360 330 330 } 331 331 332 void asap::Scantable::setSourceType( int stype )332 void Scantable::setSourceType( int stype ) 333 333 { 334 334 if ( stype < 0 || stype > 1 ) … … 533 533 return int(n); 534 534 } else { 535 // take the first SCANNO,POLNO,BEAMNO,CYCLENO as nbeam shouldn't vary with these 535 // take the first SCANNO,POLNO,BEAMNO,CYCLENO as nbeam shouldn't 536 // vary with these 536 537 Table t = table_(table_.col("IFNO") == ifno); 537 538 if ( t.nrow() == 0 ) return 0; … … 702 703 } 703 704 704 void asap::Scantable::setSpectrum( const std::vector<float>& spec,705 void Scantable::setSpectrum( const std::vector<float>& spec, 705 706 int whichrow ) 706 707 { … … 867 868 } 868 869 869 std::vector< double > asap::Scantable::getAbcissa( int whichrow ) const870 std::vector< double > Scantable::getAbcissa( int whichrow ) const 870 871 { 871 872 if ( whichrow > int(table_.nrow()) ) throw(AipsError("Illegal ro number")); … … 902 903 return stlout; 903 904 } 904 void asap::Scantable::setDirectionRefString( const std::string & refstr )905 void Scantable::setDirectionRefString( const std::string & refstr ) 905 906 { 906 907 MDirection::Types mdt; … … 916 917 } 917 918 918 std::string asap::Scantable::getDirectionRefString( ) const919 std::string Scantable::getDirectionRefString( ) const 919 920 { 920 921 return table_.keywordSet().asString("DIRECTIONREF"); … … 959 960 } 960 961 961 void asap::Scantable::setRestFrequencies( double rf, const std::string& name,962 void Scantable::setRestFrequencies( double rf, const std::string& name, 962 963 const std::string& unit ) 963 964 { … … 970 971 } 971 972 972 void asap::Scantable::setRestFrequencies( const std::string& name )973 void Scantable::setRestFrequencies( const std::string& name ) 973 974 { 974 975 throw(AipsError("setRestFrequencies( const std::string& name ) NYI")); … … 976 977 } 977 978 978 std::vector< unsigned int > asap::Scantable::rownumbers( ) const979 std::vector< unsigned int > Scantable::rownumbers( ) const 979 980 { 980 981 std::vector<unsigned int> stlout; … … 985 986 986 987 987 Matrix<Float> asap::Scantable::getPolMatrix( uInt whichrow ) const988 Matrix<Float> Scantable::getPolMatrix( uInt whichrow ) const 988 989 { 989 990 ROTableRow row(table_); … … 998 999 } 999 1000 1000 std::vector< std::string > asap::Scantable::columnNames( ) const1001 std::vector< std::string > Scantable::columnNames( ) const 1001 1002 { 1002 1003 Vector<String> vec = table_.tableDesc().columnNames(); … … 1004 1005 } 1005 1006 1006 casa::MEpoch::Types asap::Scantable::getTimeReference( ) const1007 MEpoch::Types Scantable::getTimeReference( ) const 1007 1008 { 1008 1009 return MEpoch::castType(timeCol_.getMeasRef().getType()); 1009 1010 } 1010 1011 1011 void Scantable::addFit( const STFitEntry 1012 void Scantable::addFit( const STFitEntry& fit, int row ) 1012 1013 { 1013 1014 cout << mfitidCol_(uInt(row)) << endl; … … 1016 1017 } 1017 1018 1019 void Scantable::shift(int npix) 1020 { 1021 Vector<uInt> fids(mfreqidCol_.getColumn()); 1022 genSort( fids, Sort::Ascending, 1023 Sort::QuickSort|Sort::NoDuplicates ); 1024 for (uInt i=0; i<fids.nelements(); ++i) { 1025 frequencies().shiftRefPix(npix, i); 1026 } 1027 } 1018 1028 1019 1029 } -
trunk/src/Scantable.h
r1350 r1360 356 356 void setRestFrequencies(const std::string& name); 357 357 358 void shift(int npix); 359 358 360 void convertDirection(const std::string& newframe); 359 361 -
trunk/src/ScantableWrapper.h
r1350 r1360 150 150 { table_->setSourceType(stype); } 151 151 152 void shift(int npix) 153 { table_->shift(npix); } 154 152 155 void setRestFrequencies(double rf, const std::string& name, 153 156 const std::string& unit) -
trunk/src/python_Scantable.cpp
r1350 r1360 108 108 .def("_getrestfreqs", &ScantableWrapper::getRestFrequencies) 109 109 .def("_setrestfreqs", &ScantableWrapper::setRestFrequencies) 110 .def("shift_refpix", &ScantableWrapper::shift) 110 111 .def("_setcoordinfo", &ScantableWrapper::setCoordInfo) 111 112 .def("_getcoordinfo", &ScantableWrapper::getCoordInfo)
Note:
See TracChangeset
for help on using the changeset viewer.