source: branches/casa-release-4_3/src/STFrequencies.h@ 3010

Last change on this file since 3010 was 2900, checked in by Takeshi Nakazato, 11 years ago

New Development: No

JIRA Issue: Yes CAS-5875

Ready for Test: Yes

Interface Changes: No

What Interface Changed: Please list interface changes

Test Programs: test_sdcoadd

Put in Release Notes: No

Module(s): sd

Description: Describe your changes here...

Added freq_tol parameter to asapmath.merge.
The freq_tol allows to specify frequency tolerance as
numeric value (1.0e6) or string ('1MHz'). The value will
be used to merge FREQUENCIES rows, FREQ_ID, and IFNO.


File size: 6.5 KB
Line 
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
23namespace asap {
24
25/**
26The Frequencies subtable of the Scantable
27
28@author Malte Marquarding
29@brief The frequency subtable of the Scantable
30*/
31class STFrequencies : public STSubTable {
32public:
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 /**
175 * Examine given set of refpix, refval, and increment matches
176 * any of the rows within a tolerance of freqTolInHz. If match,
177 * return true and id is filled properly. Otherwise, return false
178 * and id may have invalid value.
179 *
180 * @param[in] refpix
181 * @param[in] refval
182 * @param[in] inc
183 * @param[in] freqTolInHz
184 * @param[out] id
185 * @return boolean indicating match with any rows or not
186 */
187 bool match( casa::Double refpix, casa::Double refval, casa::Double inc,
188 casa::Double freqTolInHz, casa::uInt &id);
189
190private:
191
192 /**
193 * setup the the column structure of the casa::table
194 */
195 void setup();
196 /**
197 * the actual binning of the SpectralCoordinate as called by rescale
198 * @param sc
199 * @param factor the bin factor
200 * @return casa::SpectralCoordinate
201 */
202 casa::SpectralCoordinate binCsys(const casa::SpectralCoordinate& sc, casa::Int factor);
203 /**
204 * the actual resampling of the SpectralCoordinate as called by rescale
205 * @param sc
206 * @param width the resacle width. Can be decimal.
207 * @return
208 */
209 casa::SpectralCoordinate resampleCsys(const casa::SpectralCoordinate& sc, casa::Float width);
210
211 static const casa::String name_;
212 casa::ScalarColumn<casa::Double> refvalCol_, refpixCol_, incrCol_;
213};
214
215}
216
217#endif
Note: See TracBrowser for help on using the repository browser.