- Timestamp:
- 03/06/06 10:47:14 (19 years ago)
- Location:
- trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/STFrequencies.cpp
r856 r866 161 161 Unit unitu(unitstr); 162 162 if ( unitu == Unit("Hz") ) { 163 Vector<String> wau(1); wau = unitu.getName(); 164 spc.setWorldAxisUnits(wau); 163 165 } else { 164 166 spc.setVelocity(unitstr, getDoppler()); … … 279 281 const TableRecord& rec = row.get(i); 280 282 oss << setw(8) 281 << "frame"<< setw(16) << setprecision(8)283 << rec.asString("FRAME") << setw(16) << setprecision(8) 282 284 << rec.asDouble("REFVAL") << setw(10) 283 285 << rec.asDouble("REFPIX") << setw(12) … … 315 317 out.push_back(r.asString("FRAME")); 316 318 out.push_back(r.asString("DOPPLER")); 319 return out; 317 320 } 318 321 … … 320 323 { 321 324 if ( theinfo.size() != 3 ) throw(AipsError("setInfo needs three parameters")); 322 String un,rfrm,dpl; 323 un = theinfo[0];rfrm = theinfo[1];dpl = theinfo[2]; 324 TableRecord& r = table_.rwKeywordSet(); 325 setFrame(rfrm); 326 MDoppler::Types dtype; 327 dpl.upcase(); 328 if (!MDoppler::getType(dtype, dpl)) { 329 throw(AipsError("Doppler type unknown")); 325 try { 326 setUnit(theinfo[0]); 327 setFrame(theinfo[1]); 328 setDoppler(theinfo[2]); 329 } catch (AipsError& e) { 330 throw(e); 331 } 332 } 333 334 void asap::STFrequencies::setUnit( const std::string & unit ) 335 { 336 if (unit == "" || unit == "pixel" || unit == "channel" ) { 337 table_.rwKeywordSet().define("UNIT", ""); 330 338 } else { 331 r.define("DOPPLER",dpl); 332 } 333 } 339 Unit u(unit); 340 if ( u == Unit("km/s") || u == Unit("Hz") ) 341 table_.rwKeywordSet().define("UNIT", unit); 342 else { 343 throw(AipsError("Illegal spectral unit.")); 344 } 345 } 346 } 347 334 348 void asap::STFrequencies::setFrame( const std::string & frame ) 335 349 { … … 338 352 Int a,b;const uInt* c; 339 353 const String* valid = MFrequency::allMyTypes(a, b, c); 340 String pfix = "Please specify a legal frame type. Types are\n"; 341 throw(AipsError(pfix+(*valid))); 354 Vector<String> ftypes(IPosition(1,a), valid); 355 ostringstream oss; 356 oss << String("Please specify a legal frequency type. Types are\n"); 357 oss << ftypes; 358 String msg(oss); 359 throw(AipsError(msg)); 342 360 } else { 343 361 table_.rwKeywordSet().define("FRAME", frame); … … 345 363 } 346 364 365 void asap::STFrequencies::setDoppler( const std::string & doppler ) 366 { 367 MDoppler::Types mdt; 368 if (!MDoppler::getType(mdt, doppler)) { 369 cout << "DEBUG" << endl; 370 Int a,b;const uInt* c; 371 const String* valid = MDoppler::allMyTypes(a, b, c); 372 Vector<String> ftypes(IPosition(1,a), valid); 373 ostringstream oss; 374 oss << String("Please specify a legal doppler type. Types are\n"); 375 oss << ftypes; 376 String msg(oss); 377 throw(AipsError(msg)); 378 } else { 379 table_.rwKeywordSet().define("DOPPLER", doppler); 380 } 381 } 382 347 383 348 384 } // namespace -
trunk/src/STFrequencies.h
r856 r866 115 115 */ 116 116 void setFrame(casa::MFrequency::Types frame); 117 117 void setUnit( const std::string & unit ); 118 void setDoppler( const std::string & doppler ); 118 119 /** 119 120 * rescale the whole table by a given factor
Note:
See TracChangeset
for help on using the changeset viewer.