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 | explicit LineCatalog(const std::string& name = "jpl");
|
---|
38 |
|
---|
39 | virtual ~LineCatalog() {}
|
---|
40 |
|
---|
41 | /**
|
---|
42 | * select a subset of the data by frequency range
|
---|
43 | * @param fmin the lower frequency bound
|
---|
44 | * @param fmax the upper frequency bound
|
---|
45 | */
|
---|
46 | void setFrequencyLimits(double fmin, double fmax);
|
---|
47 |
|
---|
48 | /**
|
---|
49 | * select a subset of the table by line strength range
|
---|
50 | * @param smin the lower strength bound
|
---|
51 | * @param smin the upper strength bound
|
---|
52 | */
|
---|
53 | void setStrengthLimits(double smin, double smax);
|
---|
54 |
|
---|
55 | /**
|
---|
56 | * select a subset of the data by name pattern match (unix-style)
|
---|
57 | * @param name the string pattern e.g. "*CS*"
|
---|
58 | * @param ptype pattern type e.g.
|
---|
59 | * @li "pattern"
|
---|
60 | * @li "regex"
|
---|
61 | */
|
---|
62 | void setPattern(const std::string& name, const std::string& ptype="pattern");
|
---|
63 |
|
---|
64 | /**
|
---|
65 | * save the table with current limits to disk (as an aips++ table)
|
---|
66 | * @param name the filename
|
---|
67 | */
|
---|
68 | void save(const std::string& name);
|
---|
69 |
|
---|
70 | /**
|
---|
71 | * Return a string representation of this table
|
---|
72 | * @param row an integer describing the row number to show
|
---|
73 | * default -1 is all rows
|
---|
74 | * @return std::string
|
---|
75 | */
|
---|
76 | std::string summary(int row=-1) const;
|
---|
77 |
|
---|
78 | /**
|
---|
79 | * Return the rest frequency value for a specific row
|
---|
80 | * @param row the row number
|
---|
81 | * @return a double rest frequency value
|
---|
82 | */
|
---|
83 | double getFrequency(uint row) const;
|
---|
84 |
|
---|
85 | /**
|
---|
86 | * Return the line strength value for a specific row
|
---|
87 | * @param row the row number
|
---|
88 | * @return a double rest line strength value
|
---|
89 | */
|
---|
90 | double getStrength(uint row) const;
|
---|
91 |
|
---|
92 | /**
|
---|
93 | *
|
---|
94 | * @param row
|
---|
95 | * @return
|
---|
96 | */
|
---|
97 | std::string getName(uint row) const;
|
---|
98 |
|
---|
99 | int nrow() const { return table_.nrow(); }
|
---|
100 |
|
---|
101 | void reset() { table_ = baseTable_; }
|
---|
102 |
|
---|
103 | private:
|
---|
104 | /**
|
---|
105 | * utility function to handle range limits
|
---|
106 | * @param lmin the lower limit
|
---|
107 | * @param lmax the upper limit
|
---|
108 | * @param colname the columd to apply the limits to
|
---|
109 | * @return a new casacore::Table
|
---|
110 | */
|
---|
111 | casacore::Table setLimits(double lmin, double lmax, const std::string& colname);
|
---|
112 |
|
---|
113 | double getDouble(const std::string& colname, uint row) const;
|
---|
114 |
|
---|
115 | // the table with seelection
|
---|
116 | casacore::Table table_;
|
---|
117 | // the pristine table
|
---|
118 | casacore::Table baseTable_;
|
---|
119 | };
|
---|
120 |
|
---|
121 | } // namespace
|
---|
122 |
|
---|
123 | #endif //LINECATALOG_H
|
---|