source: branches/alma/src/STFrequencies.h@ 2188

Last change on this file since 2188 was 1446, checked in by TakTsutsumi, 16 years ago

Merged recent updates (since 2007) from nrao-asap

File size: 5.9 KB
RevLine 
[806]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
[836]29@brief The frequency subtable of the Scantable
[806]30*/
31class STFrequencies : public STSubTable {
32public:
[849]33 STFrequencies() {;}
[1353]34 explicit STFrequencies(casa::Table tab);
35 explicit STFrequencies(const Scantable& parent);
[806]36
[849]37 virtual ~STFrequencies();
38
39 STFrequencies& operator=(const STFrequencies& other);
40
[806]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
[836]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 */
[830]58 void getEntry( casa::Double& refpix, casa::Double& refval,
59 casa::Double& inc, casa::uInt id );
[806]60
[1446]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 ) ;
[836]72
[1446]73
[840]74 bool conformant(const STFrequencies& other) const;
75
[836]76 /**
77 * Retrieve the frequency values as a casa::SpectralCoordinate
78 * @param freqID
79 * @return casa::SpectralCoordinate
80 */
[847]81 casa::SpectralCoordinate getSpectralCoordinate( casa::uInt freqID ) const;
[806]82
[1446]83 /**
[847]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;
[1446]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;
[847]97
[836]98 /**
99 * Return the unit of the frequency values
100 * @return casa::Unit
101 */
[847]102 casa::Unit getUnit() const;
103 std::string getUnitString() const;
104
[836]105 /**
106 * Return the doppler type of the values
[847]107 * @return casa::MDoppler::Types
[836]108 */
[847]109 casa::MDoppler::Types getDoppler() const;
110 std::string getDopplerString() const;
[806]111
112
[836]113 /**
114 * Return the frame type, e.g MFrequency::TOPO
[847]115 * @param base return the base frame or the user frame
[836]116 * @return casa::MFrequency::Types
117 */
[847]118 casa::MFrequency::Types getFrame(bool base=false) const;
[836]119
120 /**
121 * Return a string representation of the frame type, e.g TOPO
[847]122 * @param base return the base frame or the user frame
123 * @return the string representation of the frame
[836]124 */
[847]125 std::string getFrameString(bool base=false) const;
[836]126
127 /**
128 * set the frequency frame from a string value
129 * @param frame a string identifier
130 */
[921]131 void setFrame(const std::string& frame, bool base=false);
[836]132 /**
133 * set the frequency frame from a casa::MFrequency::Types
134 * @param frame casa::MFrequency::Types
135 */
[921]136 void setFrame(casa::MFrequency::Types frame, bool base=false);
[866]137 void setUnit( const std::string & unit );
138 void setDoppler( const std::string & doppler );
[836]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 */
[806]146 void rescale(casa::Float factor, const std::string& mode);
147
[836]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 */
[830]154 float getRefFreq(casa::uInt id, casa::uInt channel);
[806]155
[836]156 /**
[1360]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
[836]164 * @param id the identifier. If id<0 all rows are returned
165 * @return a string
166 */
[1375]167 std::string print(int id=-1, casa::Bool strip=casa::False) const;
[806]168
[847]169 std::vector<std::string> getInfo() const;
170 void setInfo( const std::vector<std::string>& theinfo );
171
[856]172 const casa::String& name() const { return name_; }
173
[806]174private:
[836]175
176 /**
177 * setup the the column structure of the casa::table
178 */
[806]179 void setup();
[836]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 */
[806]186 casa::SpectralCoordinate binCsys(const casa::SpectralCoordinate& sc, casa::Int factor);
[836]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 */
[806]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
Note: See TracBrowser for help on using the repository browser.