1 | // |
---|
2 | // C++ Interface: STFrequencies |
---|
3 | // |
---|
4 | // Description: |
---|
5 | // |
---|
6 | // |
---|
7 | // Author: Malte Marquarding <asap@atnf.csiro.au>, (C) 2006 |
---|
8 | // |
---|
9 | // Copyright: See COPYING file that comes with this distribution |
---|
10 | // |
---|
11 | // |
---|
12 | #ifndef ASAPSTFREQUENCIES_H |
---|
13 | #define ASAPSTFREQUENCIES_H |
---|
14 | |
---|
15 | #include <casa/aips.h> |
---|
16 | #include <casa/BasicSL/String.h> |
---|
17 | #include <coordinates/Coordinates/SpectralCoordinate.h> |
---|
18 | #include <tables/Tables/Table.h> |
---|
19 | #include <tables/Tables/ScalarColumn.h> |
---|
20 | |
---|
21 | #include "STSubTable.h" |
---|
22 | |
---|
23 | namespace asap { |
---|
24 | |
---|
25 | /** |
---|
26 | The Frequencies subtable of the Scantable |
---|
27 | |
---|
28 | @author Malte Marquarding |
---|
29 | @brief The frequency subtable of the Scantable |
---|
30 | */ |
---|
31 | class STFrequencies : public STSubTable { |
---|
32 | public: |
---|
33 | STFrequencies() {;} |
---|
34 | explicit STFrequencies(casa::Table tab); |
---|
35 | explicit STFrequencies(const Scantable& parent); |
---|
36 | |
---|
37 | virtual ~STFrequencies(); |
---|
38 | |
---|
39 | STFrequencies& operator=(const STFrequencies& other); |
---|
40 | |
---|
41 | /** |
---|
42 | * Add a new Entry to the Frequency subtable. This checks for duplicates. |
---|
43 | * @param[in] refpix the reference pixel |
---|
44 | * @param[in] refval the reference value |
---|
45 | * @param[in] inc the increment |
---|
46 | * @return an index into the frequency table |
---|
47 | */ |
---|
48 | casa::uInt addEntry( casa::Double refpix, casa::Double refval, |
---|
49 | casa::Double inc ); |
---|
50 | |
---|
51 | /** |
---|
52 | * Retrieve the frequency values for a specific id via references |
---|
53 | * @param refpix the reference pixel |
---|
54 | * @param refval the reference value |
---|
55 | * @param inc the increment |
---|
56 | * @param id the identifier |
---|
57 | */ |
---|
58 | void getEntry( casa::Double& refpix, casa::Double& refval, |
---|
59 | casa::Double& inc, casa::uInt id ); |
---|
60 | |
---|
61 | /*** |
---|
62 | * Set the frequency values for a specific id via references |
---|
63 | * @param refpix the reference pixel |
---|
64 | * @param refval the reference value |
---|
65 | * @param inc the increment |
---|
66 | * @param id the identifier |
---|
67 | * |
---|
68 | * 17/09/2008 Takeshi Nakazato |
---|
69 | ***/ |
---|
70 | void setEntry( casa::Double refpix, casa::Double refval, |
---|
71 | casa::Double inc, casa::uInt id ) ; |
---|
72 | |
---|
73 | |
---|
74 | bool conformant(const STFrequencies& other) const; |
---|
75 | |
---|
76 | /** |
---|
77 | * Retrieve the frequency values as a casa::SpectralCoordinate |
---|
78 | * @param freqID |
---|
79 | * @return casa::SpectralCoordinate |
---|
80 | */ |
---|
81 | casa::SpectralCoordinate getSpectralCoordinate( casa::uInt freqID ) const; |
---|
82 | |
---|
83 | /** |
---|
84 | casa::SpectralCoordinate getSpectralCoordinate( const casa::MDirection& md, |
---|
85 | const casa::MPosition& mp, |
---|
86 | const casa::MEpoch& me, |
---|
87 | casa::Double restfreq, |
---|
88 | casa::uInt freqID |
---|
89 | ) const; |
---|
90 | **/ |
---|
91 | casa::SpectralCoordinate getSpectralCoordinate( const casa::MDirection& md, |
---|
92 | const casa::MPosition& mp, |
---|
93 | const casa::MEpoch& me, |
---|
94 | casa::Vector<casa::Double> restfreq, |
---|
95 | casa::uInt freqID |
---|
96 | ) const; |
---|
97 | |
---|
98 | /** |
---|
99 | * Return the unit of the frequency values |
---|
100 | * @return casa::Unit |
---|
101 | */ |
---|
102 | casa::Unit getUnit() const; |
---|
103 | std::string getUnitString() const; |
---|
104 | |
---|
105 | /** |
---|
106 | * Return the doppler type of the values |
---|
107 | * @return casa::MDoppler::Types |
---|
108 | */ |
---|
109 | casa::MDoppler::Types getDoppler() const; |
---|
110 | std::string getDopplerString() const; |
---|
111 | |
---|
112 | |
---|
113 | /** |
---|
114 | * Return the frame type, e.g MFrequency::TOPO |
---|
115 | * @param base return the base frame or the user frame |
---|
116 | * @return casa::MFrequency::Types |
---|
117 | */ |
---|
118 | casa::MFrequency::Types getFrame(bool base=false) const; |
---|
119 | |
---|
120 | /** |
---|
121 | * Return a string representation of the frame type, e.g TOPO |
---|
122 | * @param base return the base frame or the user frame |
---|
123 | * @return the string representation of the frame |
---|
124 | */ |
---|
125 | std::string getFrameString(bool base=false) const; |
---|
126 | |
---|
127 | /** |
---|
128 | * set the frequency frame from a string value |
---|
129 | * @param frame a string identifier |
---|
130 | */ |
---|
131 | void setFrame(const std::string& frame, bool base=false); |
---|
132 | /** |
---|
133 | * set the frequency frame from a casa::MFrequency::Types |
---|
134 | * @param frame casa::MFrequency::Types |
---|
135 | */ |
---|
136 | void setFrame(casa::MFrequency::Types frame, bool base=false); |
---|
137 | void setUnit( const std::string & unit ); |
---|
138 | void setDoppler( const std::string & doppler ); |
---|
139 | /** |
---|
140 | * rescale the whole table by a given factor |
---|
141 | * @param factor the factor to bin or resample by |
---|
142 | * @param mode the rescaling mode |
---|
143 | * @li "BIN" |
---|
144 | * @li "RESAMPLE" |
---|
145 | */ |
---|
146 | void rescale(casa::Float factor, const std::string& mode); |
---|
147 | |
---|
148 | /** |
---|
149 | * get the reference frequency at a given channel for a specidif identifier |
---|
150 | * @param id the identifier |
---|
151 | * @param channel the channel number |
---|
152 | * @return teh reference frequency |
---|
153 | */ |
---|
154 | float getRefFreq(casa::uInt id, casa::uInt channel); |
---|
155 | |
---|
156 | /** |
---|
157 | * shift the reference pixel by an integer amount |
---|
158 | * @param npix the shift in pixels |
---|
159 | * @param id the coordinate id |
---|
160 | */ |
---|
161 | void shiftRefPix(int npix, casa::uInt id); |
---|
162 | /** |
---|
163 | * Return this table or s specific row as a string representation |
---|
164 | * @param id the identifier. If id<0 all rows are returned |
---|
165 | * @return a string |
---|
166 | */ |
---|
167 | std::string print(int id=-1, casa::Bool strip=casa::False) const; |
---|
168 | |
---|
169 | std::vector<std::string> getInfo() const; |
---|
170 | void setInfo( const std::vector<std::string>& theinfo ); |
---|
171 | |
---|
172 | const casa::String& name() const { return name_; } |
---|
173 | |
---|
174 | private: |
---|
175 | |
---|
176 | /** |
---|
177 | * setup the the column structure of the casa::table |
---|
178 | */ |
---|
179 | void setup(); |
---|
180 | /** |
---|
181 | * the actual binning of the SpectralCoordinate as called by rescale |
---|
182 | * @param sc |
---|
183 | * @param factor the bin factor |
---|
184 | * @return casa::SpectralCoordinate |
---|
185 | */ |
---|
186 | casa::SpectralCoordinate binCsys(const casa::SpectralCoordinate& sc, casa::Int factor); |
---|
187 | /** |
---|
188 | * the actual resampling of the SpectralCoordinate as called by rescale |
---|
189 | * @param sc |
---|
190 | * @param width the resacle width. Can be decimal. |
---|
191 | * @return |
---|
192 | */ |
---|
193 | casa::SpectralCoordinate resampleCsys(const casa::SpectralCoordinate& sc, casa::Float width); |
---|
194 | |
---|
195 | static const casa::String name_; |
---|
196 | casa::ScalarColumn<casa::Double> refvalCol_, refpixCol_, incrCol_; |
---|
197 | }; |
---|
198 | |
---|
199 | } |
---|
200 | |
---|
201 | #endif |
---|