[1108] | 1 | //
|
---|
| 2 | // C++ Interface: LineCatalog
|
---|
| 3 | //
|
---|
| 4 | // Description:
|
---|
| 5 | //
|
---|
| 6 | //
|
---|
| 7 | // Author: Malte Marquarding <Malte.Marquarding@csiro.au>, (C) 2006
|
---|
| 8 | //
|
---|
| 9 | // Copyright: See COPYING file that comes with this distribution
|
---|
| 10 | //
|
---|
| 11 | //
|
---|
| 12 | #ifndef LINECATALOG_H
|
---|
| 13 | #define LINECATALOG_H
|
---|
| 14 |
|
---|
| 15 | #include <string>
|
---|
| 16 |
|
---|
| 17 | #include <casa/aips.h>
|
---|
| 18 | #include <tables/Tables/Table.h>
|
---|
| 19 |
|
---|
| 20 | namespace asap {
|
---|
| 21 | /**
|
---|
| 22 | * A represenation of a line catalog, which can be ASCII, or an aips++ table
|
---|
| 23 | *
|
---|
| 24 | * ASCII catalogs have to be formatted like JPL.
|
---|
| 25 | * Name frequency error log(I)
|
---|
| 26 | * Only "name", "frequency" and log(I) are used at this stage
|
---|
| 27 | *
|
---|
| 28 | * @author Malte Marquarding
|
---|
| 29 | * @date $Date:$
|
---|
| 30 | */
|
---|
| 31 | class LineCatalog {
|
---|
| 32 | public:
|
---|
| 33 | /**
|
---|
| 34 | *
|
---|
| 35 | * @param name the name of the ASCII file or aips++ table
|
---|
| 36 | */
|
---|
| 37 | LineCatalog(const std::string& name = "jpl");
|
---|
| 38 | /**
|
---|
| 39 | * select a subset of the table by frequency range
|
---|
| 40 | * @param fmin the lower frequency bound
|
---|
| 41 | * @param fmin the upper frequency bound
|
---|
| 42 | */
|
---|
| 43 |
|
---|
| 44 | virtual ~LineCatalog() {}
|
---|
| 45 |
|
---|
| 46 | /**
|
---|
| 47 | * select a subset of the data by frequency range
|
---|
| 48 | * @param fmin the lower frequency bound
|
---|
| 49 | * @param fmax the upper frequency bound
|
---|
| 50 | */
|
---|
[1126] | 51 | void setFrequencyLimits(double fmin, double fmax);
|
---|
[1108] | 52 | /**
|
---|
| 53 | * select a subset of the table by line strength range
|
---|
| 54 | * @param smin the lower strength bound
|
---|
| 55 | * @param smin the upper strength bound
|
---|
| 56 | */
|
---|
[1126] | 57 | void setStrengthLimits(double smin, double smax);
|
---|
[1108] | 58 | /**
|
---|
| 59 | * select a subset of the data by name pattern match (unix-style)
|
---|
| 60 | * @param name the string pattern e.g. "*CS*"
|
---|
| 61 | * @param ptype pattern type e.g.
|
---|
| 62 | * @li "pattern"
|
---|
| 63 | * @li "regex"
|
---|
| 64 | */
|
---|
| 65 | void setPattern(const std::string& name, const std::string& ptype="pattern");
|
---|
| 66 | /**
|
---|
| 67 | * save the table with current limits to disk (as an aips++ table)
|
---|
| 68 | * @param name the filename
|
---|
| 69 | */
|
---|
| 70 | void save(const std::string& name);
|
---|
| 71 | /**
|
---|
| 72 | * Return a string representation of this table
|
---|
[1126] | 73 | * @param row an integer describing the row number to show
|
---|
[1113] | 74 | * default -1 is all rows
|
---|
[1108] | 75 | * @return std::string
|
---|
| 76 | */
|
---|
[1113] | 77 | std::string summary(int row=-1) const;
|
---|
[1108] | 78 |
|
---|
[1126] | 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 | */
|
---|
[1113] | 84 | double getFrequency(uint row) const;
|
---|
| 85 |
|
---|
[1126] | 86 | /**
|
---|
| 87 | *
|
---|
| 88 | * @param row
|
---|
| 89 | * @return
|
---|
| 90 | */
|
---|
[1113] | 91 | std::string getName(uint row) const;
|
---|
| 92 |
|
---|
[1126] | 93 | int nrow() const { return table_.nrow(); }
|
---|
| 94 |
|
---|
| 95 | void reset() { table_ = baseTable_; }
|
---|
| 96 |
|
---|
[1108] | 97 | private:
|
---|
| 98 | /**
|
---|
[1126] | 99 | * utility function to handle range limits
|
---|
[1108] | 100 | * @param lmin the lower limit
|
---|
| 101 | * @param lmax the upper limit
|
---|
| 102 | * @param colname the columd to apply the limits to
|
---|
| 103 | * @return a new casa::Table
|
---|
| 104 | */
|
---|
[1126] | 105 | casa::Table setLimits(double lmin, double lmax, const std::string& colname);
|
---|
[1108] | 106 |
|
---|
| 107 | // the table with seelection
|
---|
| 108 | casa::Table table_;
|
---|
| 109 | // the pristine table
|
---|
| 110 | casa::Table baseTable_;
|
---|
| 111 | };
|
---|
| 112 |
|
---|
| 113 | } // namespace
|
---|
| 114 |
|
---|
| 115 | #endif //LINECATALOG_H
|
---|