Changeset 392
- Timestamp:
- 02/08/05 15:48:11 (20 years ago)
- Location:
- trunk/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/SDContainer.h
r388 r392 78 78 // 79 79 casa::Int length() const { return nFreq_;} // # of stored Frequencies 80 void setLength(casa:: Int length) {nFreq_ = length;}80 void setLength(casa::uInt length) {nFreq_ = length;} 81 81 82 82 // Get attributes … … 86 86 casa::Float equinox() const { return equinox_; } 87 87 casa::String refFrame() const { return refFrame_; } 88 // 88 89 void restFrequencies(casa::Vector<casa::Double>& rfs, 89 90 casa::String& rfunit ) const ; … … 92 93 void setEquinox(casa::Float eq) { equinox_ = eq; } 93 94 void setRefFrame(const casa::String& reff) { refFrame_ = reff; } 95 // 96 void deleteRestFrequencies () {restFreqs_.resize(0);} 94 97 casa::uInt addRestFrequency(casa::Double); 95 98 void setRestFrequencyUnit(const casa::String& theunit) {restFreqUnit_ = theunit;} -
trunk/src/SDMemTable.cc
r387 r392 795 795 } 796 796 797 void SDMemTable::setRestFreqs(std::vector<double> freqs,798 const std::string& theunit)799 {800 Vector<Double> tvec(freqs);801 Quantum<Vector<Double> > q(tvec, String(theunit));802 tvec.resize();803 tvec = q.getValue("Hz");804 Table t = table_.keywordSet().asTable("FREQUENCIES");805 t.rwKeywordSet().define("RESTFREQS",tvec);806 }807 797 808 798 std::vector<double> SDMemTable::getRestFreqs() const … … 1336 1326 } 1337 1327 1338 casa::Bool SDMemTable::se lectRestFreq (casa::Double restFreq, const String& unit,1339 1340 1328 casa::Bool SDMemTable::setRestFreqs (const casa::Vector<Double>& restFreqs, const String& sUnit, 1329 const casa::String& source, 1330 casa::Int whichIF) 1341 1331 { 1342 1332 const Int nIFs = nIF(); … … 1345 1335 } 1346 1336 1347 // Find rest frequency. Add it if necessary 1348 1337 // If multiple restfreqs, must be length nIF. In this 1338 // case we will just replace the rest frequencies 1339 // 1340 1341 const uInt nRestFreqs = restFreqs.nelements(); 1342 Unit unit(sUnit); 1343 Int idx = -1; 1349 1344 SDFrequencyTable sdft = getSDFreqTable(); 1350 Quantum<Double> rf(restFreq, Unit(unit)); 1351 uInt idx = sdft.addRestFrequency(rf.getValue("Hz")); 1345 1346 if (nRestFreqs>1) { 1347 1348 // Replace restFreqs, one per IF 1349 1350 if (nRestFreqs != nIFs) { 1351 throw (AipsError("Number of rest frequencies must be equal to the number of IFs")); 1352 } 1353 // 1354 sdft.deleteRestFrequencies(); 1355 for (uInt i=0; i<nRestFreqs; i++) { 1356 Quantum<Double> rf(restFreqs[i], unit); 1357 sdft.addRestFrequency(rf.getValue("Hz")); 1358 } 1359 } else { 1360 1361 // Add new rest freq 1362 1363 Quantum<Double> rf(restFreqs[0], unit); 1364 idx = sdft.addRestFrequency(rf.getValue("Hz")); 1365 } 1352 1366 1353 1367 // Replace … … 1362 1376 srcnCol_.get(i, srcName); 1363 1377 restfreqidCol_.get(i,restFreqIDs); 1364 // 1365 if (empty || source==srcName) { 1366 if (whichIF<0) { 1367 restFreqIDs = idx; 1368 } else { 1369 restFreqIDs(whichIF) = idx; 1378 // 1379 if (idx==-1) { 1380 1381 // Replace vector of restFreqs; one per IF. 1382 // No selection possible 1383 1384 for (uInt i=0; i<nIFs; i++) restFreqIDs[i] = i; 1385 } else { 1386 1387 // Set RestFreqID for selected data 1388 1389 if (empty || source==srcName) { 1390 if (whichIF<0) { 1391 restFreqIDs = idx; 1392 } else { 1393 restFreqIDs[whichIF] = idx; 1394 } 1370 1395 } 1371 1396 } -
trunk/src/SDMemTable.h
r386 r392 115 115 116 116 virtual void setSpectrum(std::vector<float> spectrum, int whichRow=0); 117 virtual void setRestFreqs(std::vector<double> freqs,118 const std::string& theunit);119 117 virtual void setCoordInfo(std::vector<string> theinfo); 120 118 121 // Select RestFreqID. FInds the restFreq ID for specified restFreq, 122 // and updates RESTFREQID column of table for specified IF index 123 // (-1 means all IFs) and source combination 124 virtual casa::Bool selectRestFreq (casa::Double restFreq, const casa::String& unit, 125 const casa::String& source, 126 casa::Int whichIF=-1); 119 // Set RestFreqID. source="" and IF=-1 means select all 120 virtual casa::Bool setRestFreqs (const casa::Vector<casa::Double>& restFreqs, 121 const casa::String& unit, 122 const casa::String& source, 123 casa::Int whichIF=-1); 127 124 128 125 // Get/Set flux unit -
trunk/src/SDMemTableWrapper.h
r386 r392 145 145 } 146 146 147 void setRestFreqs(std::vector<double> freqs, const std::string& theunit) { 148 table_->setRestFreqs(freqs, theunit); 149 } 150 151 bool selectRestFreq(double freq, const std::string& unit, 152 const std::string& source, int whichIF) { 153 return table_->selectRestFreq(casa::Double(freq), casa::String(unit), 154 casa::String(source), 155 casa::Int(whichIF)); 147 bool setRestFreqs (const std::vector<double>& restfreqs, const std::string& unit, 148 const std::string& source, int whichIF) { 149 casa::Vector<casa::Double> restFreqs2(restfreqs); 150 return table_->setRestFreqs(restFreqs2, casa::String(unit), 151 casa::String(source), 152 casa::Int(whichIF)); 156 153 } 157 154 -
trunk/src/python_SDMemTable.cc
r386 r392 87 87 .def("_save", &SDMemTableWrapper::makePersistent) 88 88 .def("_summary", &SDMemTableWrapper::summary) 89 .def("_getrestfreqs", &SDMemTableWrapper::getRestFreqs) 89 90 .def("_setrestfreqs", &SDMemTableWrapper::setRestFreqs) 90 .def("_getrestfreqs", &SDMemTableWrapper::getRestFreqs)91 .def("_selectrestfreq", &SDMemTableWrapper::selectRestFreq)92 91 .def("_setcoordinfo", &SDMemTableWrapper::setCoordInfo) 93 92 .def("_getcoordinfo", &SDMemTableWrapper::getCoordInfo)
Note:
See TracChangeset
for help on using the changeset viewer.