Changeset 80
- Timestamp:
- 09/07/04 10:56:27 (20 years ago)
- Location:
- trunk/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/SDMemTable.cc
r78 r80 31 31 32 32 33 #include < aips/iostream.h>34 #include < aips/iomanip.h>35 #include < aips/Arrays/Array.h>36 #include < aips/Arrays/ArrayMath.h>37 #include < aips/Arrays/MaskArrMath.h>38 #include < aips/Arrays/ArrayLogical.h>39 #include < aips/Arrays/ArrayAccessor.h>40 41 #include < aips/Tables/TableParse.h>42 #include < aips/Tables/TableDesc.h>43 #include < aips/Tables/SetupNewTab.h>44 #include < aips/Tables/ScaColDesc.h>45 #include < aips/Tables/ArrColDesc.h>46 47 #include < aips/Tables/ExprNode.h>48 #include < aips/Tables/ScalarColumn.h>49 #include < aips/Tables/ArrayColumn.h>50 #include < aips/Tables/TableRecord.h>51 #include < aips/Measures/MFrequency.h>52 #include < aips/Measures/MeasTable.h>53 #include < aips/Quanta/MVTime.h>33 #include <casa/iostream.h> 34 #include <casa/iomanip.h> 35 #include <casa/Arrays/Array.h> 36 #include <casa/Arrays/ArrayMath.h> 37 #include <casa/Arrays/MaskArrMath.h> 38 #include <casa/Arrays/ArrayLogical.h> 39 #include <casa/Arrays/ArrayAccessor.h> 40 41 #include <tables/Tables/TableParse.h> 42 #include <tables/Tables/TableDesc.h> 43 #include <tables/Tables/SetupNewTab.h> 44 #include <tables/Tables/ScaColDesc.h> 45 #include <tables/Tables/ArrColDesc.h> 46 47 #include <tables/Tables/ExprNode.h> 48 #include <tables/Tables/ScalarColumn.h> 49 #include <tables/Tables/ArrayColumn.h> 50 #include <tables/Tables/TableRecord.h> 51 #include <measures/Measures/MFrequency.h> 52 #include <measures/Measures/MeasTable.h> 53 #include <casa/Quanta/MVTime.h> 54 54 55 55 #include "SDMemTable.h" … … 88 88 } 89 89 90 SDMemTable::SDMemTable(const Table& tab, Int scanID) :90 SDMemTable::SDMemTable(const Table& tab, const std::string& exprs) : 91 91 IFSel_(0), 92 92 beamSel_(0), 93 93 polSel_(0) { 94 String exprs = String("select * from $1 where SCANID == ")95 +String::toString(scanID);96 94 //cerr << exprs << endl; 97 95 Table t = tableCommand(exprs,tab); … … 104 102 105 103 SDMemTable SDMemTable::getScan(Int scanID) { 106 return SDMemTable(table_, scanID); 104 String cond("SELECT * from $1 WHERE SCANID == "); 105 cond += String::toString(scanID); 106 return SDMemTable(table_, cond); 107 } 108 109 SDMemTable SDMemTable::getSource(const std::string& source) { 110 String cond("SELECT * from $1 WHERE SRCNAME == "); 111 cond += source; 112 return SDMemTable(table_, cond); 107 113 } 108 114 -
trunk/src/SDMemTable.h
r78 r80 29 29 //# $Id: 30 30 //#--------------------------------------------------------------------------- 31 #ifndef _SDMEMTABLE_H _32 #define _SDMEMTABLE_H _31 #ifndef _SDMEMTABLE_H 32 #define _SDMEMTABLE_H 33 33 34 34 // STL … … 36 36 #include <vector> 37 37 // AIPS++ 38 #include < aips/aips.h>39 #include < aips/Utilities/String.h>40 #include < aips/Tables/Table.h>41 #include < aips/Arrays/MaskedArray.h>38 #include <casa/aips.h> 39 #include <casa/BasicSL/String.h> 40 #include <tables/Tables/Table.h> 41 #include <casa/Arrays/MaskedArray.h> 42 42 43 #include < trial/Coordinates/SpectralCoordinate.h>43 #include <coordinates/Coordinates/SpectralCoordinate.h> 44 44 45 45 namespace atnf_sd { … … 63 63 // Copy Construct a SDMemTable, give a scanid constraint 64 64 // see also getScan() 65 SDMemTable(const Table& tab, Int scanID);65 SDMemTable(const Table& tab, const std::string& expr); 66 66 67 67 virtual ~SDMemTable(); … … 114 114 // get a new SDMemTable containg all rows with the same give SCANID 115 115 SDMemTable getScan(Int scanID); 116 SDMemTable getSource(const std::string& source); 116 117 117 118 const TableRecord& getHeader() const {return table_.keywordSet();} -
trunk/src/SDMemTableWrapper.h
r79 r80 29 29 //# $Id: 30 30 //#--------------------------------------------------------------------------- 31 #ifndef _SDMEMTABLEWRAPPER_H _32 #define _SDMEMTABLEWRAPPER_H _31 #ifndef _SDMEMTABLEWRAPPER_H 32 #define _SDMEMTABLEWRAPPER_H 33 33 34 34 #include <vector> … … 50 50 SDMemTableWrapper(SDMemTable* sdmt) : table_(sdmt) {;} 51 51 52 SDMemTableWrapper(const SDMemTableWrapper& mt, int scan) :53 table_(new SDMemTable(mt.getCP()->table(), scan)) {;}52 SDMemTableWrapper(const SDMemTableWrapper& mt, const std::string& expr) : 53 table_(new SDMemTable(mt.getCP()->table(), expr)) {;} 54 54 55 55 SDMemTableWrapper getScan(int scan) { 56 return SDMemTableWrapper(*this, scan); 56 String cond("SELECT * from $1 WHERE SCANID == "); 57 cond += String::toString(scan); 58 return SDMemTableWrapper(*this, cond); 57 59 } 60 61 SDMemTableWrapper getSource(const std::string& source) { 62 String cond("SELECT * from $1 WHERE SRCNAME == '"); 63 cond += source;cond += "'"; 64 return SDMemTableWrapper(*this, cond); 65 } 66 58 67 std::vector<float> getSpectrum(int whichRow=0) const { 59 68 return table_->getSpectrum(whichRow); -
trunk/src/python_SDMemTable.cc
r79 r80 44 44 .def( init <> () ) 45 45 .def( init < std::string > () ) 46 .def( init < SDMemTableWrapper, int> () )46 .def( init < SDMemTableWrapper, std::string > () ) 47 47 .def("getscan", &SDMemTableWrapper::getScan) 48 .def("getsource", &SDMemTableWrapper::getSource) 48 49 .def("getspectrum", &SDMemTableWrapper::getSpectrum, 49 50 (boost::python::arg("whichRow")=0) )
Note:
See TracChangeset
for help on using the changeset viewer.