Changeset 401
- Timestamp:
- 02/09/05 22:28:48 (20 years ago)
- Location:
- trunk/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/SDMemTable.cc
r395 r401 742 742 // Set reference frame conversion (requires row) 743 743 744 MDirection dir ect= getDirection(whichRow);744 MDirection dir = getDirection(whichRow); 745 745 MEpoch epoch = getEpoch(whichRow); 746 746 MPosition pos = getAntennaPosition(); 747 if (!spec.setReferenceConversion(mtype,epoch,pos,direct)) { 747 // 748 if (!spec.setReferenceConversion(mtype,epoch,pos,dir)) { 748 749 throw(AipsError("Couldn't convert frequency frame.")); 749 750 } … … 1326 1327 } 1327 1328 1328 casa::Bool SDMemTable::setRestFreqs (const casa::Vector<Double>& restFreqs, const String& sUnit, 1329 const casa::String& source, 1330 casa::Int whichIF) 1329 Bool SDMemTable::setRestFreqs (const Vector<Double>& restFreqsIn, 1330 const String& sUnit, 1331 const vector<string>& lines, 1332 const String& source, 1333 Int whichIF) 1331 1334 { 1332 1335 const Int nIFs = nIF(); … … 1335 1338 } 1336 1339 1340 // FInd vector of restfrequencies 1341 // Double takes precedence over String 1342 1343 Unit unit; 1344 Vector<Double> restFreqs; 1345 if (restFreqsIn.nelements()>0) { 1346 restFreqs.resize(restFreqsIn.nelements()); 1347 restFreqs = restFreqsIn; 1348 unit = Unit(sUnit); 1349 } else if (lines.size()>0) { 1350 const uInt nLines = lines.size(); 1351 unit = Unit("Hz"); 1352 restFreqs.resize(nLines); 1353 MFrequency lineFreq; 1354 for (uInt i=0; i<nLines; i++) { 1355 String tS(lines[i]); 1356 tS.upcase(); 1357 if (MeasTable::Line(lineFreq, tS)) { 1358 restFreqs[i] = lineFreq.getValue().getValue(); // Hz 1359 } else { 1360 String s = String(lines[i]) + String(" is an unrecognized spectral line"); 1361 throw(AipsError(s)); 1362 } 1363 } 1364 } else { 1365 throw(AipsError("You have not specified any rest frequencies or lines")); 1366 } 1367 1337 1368 // If multiple restfreqs, must be length nIF. In this 1338 1369 // case we will just replace the rest frequencies … … 1340 1371 1341 1372 const uInt nRestFreqs = restFreqs.nelements(); 1342 Unit unit(sUnit);1343 1373 Int idx = -1; 1344 1374 SDFrequencyTable sdft = getSDFreqTable(); … … 1408 1438 } 1409 1439 1440 void SDMemTable::spectralLines () const 1441 { 1442 Vector<String> lines = MeasTable::Lines(); 1443 MFrequency lineFreq; 1444 Double freq; 1445 // 1446 cerr.flags(std::ios_base::left); 1447 cerr << "Line Frequency (Hz)" << endl; 1448 cerr << "-----------------------" << endl; 1449 for (uInt i=0; i<lines.nelements(); i++) { 1450 MeasTable::Line(lineFreq, lines[i]); 1451 freq = lineFreq.getValue().getValue(); // Hz 1452 // 1453 cerr << setw(11) << lines[i] << setprecision(10) << freq << endl; 1454 } 1455 } 1410 1456 1411 1457 void SDMemTable::renumber() -
trunk/src/SDMemTable.h
r392 r401 120 120 virtual casa::Bool setRestFreqs (const casa::Vector<casa::Double>& restFreqs, 121 121 const casa::String& unit, 122 const std::vector<std::string>& lines, 122 123 const casa::String& source, 123 124 casa::Int whichIF=-1); 125 126 // List lines 127 void spectralLines() const; 124 128 125 129 // Get/Set flux unit -
trunk/src/SDMemTableWrapper.h
r392 r401 145 145 } 146 146 147 bool setRestFreqs (const std::vector<double>& restfreqs, const std::string& unit, 148 const std::string& source, int whichIF) { 147 bool setRestFreqs(const std::vector<double>& restfreqs, 148 const std::string& unit, 149 const std::vector<std::string>& lines, 150 const std::string& source, int whichIF) { 149 151 casa::Vector<casa::Double> restFreqs2(restfreqs); 150 152 return table_->setRestFreqs(restFreqs2, casa::String(unit), 151 casa::String(source),153 lines, casa::String(source), 152 154 casa::Int(whichIF)); 153 155 } 156 157 void spectralLines() const {table_->spectralLines();} 154 158 155 159 std::vector<double> getRestFreqs() { -
trunk/src/python_SDMemTable.cc
r392 r401 51 51 .def("getbeam", &SDMemTableWrapper::getBeam) 52 52 .def("getpol", &SDMemTableWrapper::getPol) 53 .def("_lines", &SDMemTableWrapper::spectralLines) 53 54 .def("nif", &SDMemTableWrapper::nIF) 54 55 .def("nbeam", &SDMemTableWrapper::nBeam)
Note:
See TracChangeset
for help on using the changeset viewer.