Changeset 1126
- Timestamp:
- 08/10/06 14:16:19 (18 years ago)
- Location:
- trunk/src
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/LineCatalog.cpp
r1113 r1126 38 38 std::string inname = path.expandedName(); 39 39 File f(inname); 40 if (f.isDirectory()) { //assume it s a table40 if (f.isDirectory()) { //assume it's a table 41 41 table_ = Table(inname); 42 42 } else { 43 43 String formatString; 44 44 // formatSring , TableType, ascii file name, TableDesc name, table name, autoheader 45 table_ = readAsciiTable(formatString, Table::Plain, inname, "", "", True); 45 table_ = readAsciiTable(formatString, Table::Plain, inname, "", "", True); 46 // do not keep aips++ table 47 table_.markForDelete(); 46 48 } 47 49 baseTable_ = table_; 48 50 } 49 51 50 void LineCatalog::setStrengthLimits( float smin, floatsmax)52 void LineCatalog::setStrengthLimits(double smin, double smax) 51 53 { 52 54 table_ = setLimits(smin, smax, "Column4"); 53 55 } 54 56 55 void LineCatalog::setFrequencyLimits( float fmin, floatfmax)57 void LineCatalog::setFrequencyLimits(double fmin, double fmax) 56 58 { 57 59 table_ = setLimits(fmin, fmax, "Column2"); … … 60 62 void LineCatalog::setPattern(const std::string& name, const std::string& stype) 61 63 { 62 std::string mode = stype+"('"+name+"')"; 63 std::string taql = "SELECT from $1 WHERE Column1 == "+mode; 64 //std::string mode = stype+"('"+name+"')"; 65 std::string taql = "SELECT FROM $1 WHERE Column1 == pattern('"+name+"')"; 66 cerr << taql << endl; 64 67 Table tmp = tableCommand(taql, table_); 65 if (tmp.nrow() > 0) table_ = tmp ;68 if (tmp.nrow() > 0) table_ = tmp.sort("Column2"); 66 69 else throw(AipsError("No match.")); 67 70 } 68 71 69 Table LineCatalog::setLimits( float lmin, floatlmax, const std::string& colname)72 Table LineCatalog::setLimits(double lmin, double lmax, const std::string& colname) 70 73 { 71 Table tmp = table_(table_.col(colname) > lmin && table_.col(colname) >lmax);72 if (tmp.nrow() > 0) return tmp ;74 Table tmp = table_(table_.col(colname) > lmin && table_.col(colname) < lmax); 75 if (tmp.nrow() > 0) return tmp.sort("Column2"); 73 76 else throw(AipsError("No match.")); 74 77 } … … 89 92 oss << asap::SEPERATOR << endl << endl; 90 93 if (row == -1) { 91 Vector<uInt> rownrs = table_.rowNumbers(baseTable_); 92 for (uint i=0; i<rownrs.nelements(); ++i) { 93 oss << std::right << setw(7) << rownrs[i]; 94 oss << std::left << setw(12) << getName(i); 94 for (uint i=0; i<table_.nrow(); ++i) { 95 oss << std::right << setw(7) << i << setw(2) << ""; 96 oss << std::left << setw(20) << getName(i); 95 97 oss << setw(12) << setprecision(8) << std::left << getFrequency(i); 96 98 oss << endl; 97 99 } 98 100 } else { 99 oss << std::right << setw(7) << row; 100 oss << std::left << setw(12) << getName(row); 101 oss << setw(12) << setprecision(8) << std::left << getFrequency(row); 102 oss << endl; 101 if ( row < table_.nrow() ) { 102 oss << std::right << setw(7) << row << setw(2) << ""; 103 oss << std::left << setw(20) << getName(row); 104 oss << setw(12) << setprecision(8) << std::left << getFrequency(row); 105 oss << endl; 106 } else { 107 throw(AipsError("Row doesn't exist")); 108 } 103 109 } 104 110 /// @todo implement me -
trunk/src/LineCatalog.h
r1113 r1126 49 49 * @param fmax the upper frequency bound 50 50 */ 51 void setFrequencyLimits( float fmin, floatfmax);51 void setFrequencyLimits(double fmin, double fmax); 52 52 /** 53 53 * select a subset of the table by line strength range … … 55 55 * @param smin the upper strength bound 56 56 */ 57 void setStrengthLimits( float smin, floatsmax);57 void setStrengthLimits(double smin, double smax); 58 58 /** 59 59 * select a subset of the data by name pattern match (unix-style) … … 71 71 /** 72 72 * Return a string representation of this table 73 * @param an integer descriing the row number to show73 * @param row an integer describing the row number to show 74 74 * default -1 is all rows 75 75 * @return std::string … … 77 77 std::string summary(int row=-1) const; 78 78 79 /** 80 * Return the rest frequency value for a specific row 81 * @param row the row number 82 * @return a double rest frequency value 83 */ 79 84 double getFrequency(uint row) const; 80 85 86 /** 87 * 88 * @param row 89 * @return 90 */ 81 91 std::string getName(uint row) const; 92 93 int nrow() const { return table_.nrow(); } 94 95 void reset() { table_ = baseTable_; } 82 96 83 97 private: 84 98 /** 85 * utility function to ha dle range limits99 * utility function to handle range limits 86 100 * @param lmin the lower limit 87 101 * @param lmax the upper limit … … 89 103 * @return a new casa::Table 90 104 */ 91 casa::Table setLimits( float lmin, floatlmax, const std::string& colname);105 casa::Table setLimits(double lmin, double lmax, const std::string& colname); 92 106 93 107 // the table with seelection -
trunk/src/python_asap.cpp
r1112 r1126 63 63 asap::python::python_STLineFinder(); 64 64 asap::python::python_STFitEntry(); 65 66 65 asap::python::python_STWriter(); 66 asap::python::python_LineCatalog(); 67 67 68 68 asap::python::python_Logger(); -
trunk/src/python_asap.h
r988 r1126 44 44 void python_STLineFinder(); 45 45 void python_STFitEntry(); 46 47 46 void python_STWriter(); 47 void python_LineCatalog(); 48 48 void python_Logger(); 49 49
Note:
See TracChangeset
for help on using the changeset viewer.