source: trunk/src/STFrequencies.h@ 3122

Last change on this file since 3122 was 3106, checked in by Takeshi Nakazato, 8 years ago

New Development: No

JIRA Issue: No

Ready for Test: Yes/No

Interface Changes: Yes/No

What Interface Changed: Please list interface changes

Test Programs: List test programs

Put in Release Notes: Yes/No

Module(s): Module Names change impacts.

Description: Describe your changes here...


Check-in asap modifications from Jim regarding casacore namespace conversion.

File size: 6.7 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() {;}
[3106]34 explicit STFrequencies(casacore::Table tab);
[1353]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 */
[3106]48 casacore::uInt addEntry( casacore::Double refpix, casacore::Double refval,
49 casacore::Double inc );
[806]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 */
[3106]58 void getEntry( casacore::Double& refpix, casacore::Double& refval,
59 casacore::Double& inc, casacore::uInt id );
[806]60
[1819]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 ***/
[3106]70 void setEntry( casacore::Double refpix, casacore::Double refval,
71 casacore::Double inc, casacore::uInt id ) ;
[836]72
[1819]73
[840]74 bool conformant(const STFrequencies& other) const;
75
[836]76 /**
[3106]77 * Retrieve the frequency values as a casacore::SpectralCoordinate
[836]78 * @param freqID
[3106]79 * @return casacore::SpectralCoordinate
[836]80 */
[3106]81 casacore::SpectralCoordinate getSpectralCoordinate( casacore::uInt freqID ) const;
[806]82
[1819]83 /**
[3106]84 casacore::SpectralCoordinate getSpectralCoordinate( const casacore::MDirection& md,
85 const casacore::MPosition& mp,
86 const casacore::MEpoch& me,
87 casacore::Double restfreq,
88 casacore::uInt freqID
[847]89 ) const;
[1819]90 **/
[3106]91 casacore::SpectralCoordinate getSpectralCoordinate( const casacore::MDirection& md,
92 const casacore::MPosition& mp,
93 const casacore::MEpoch& me,
94 casacore::Vector<casacore::Double> restfreq,
95 casacore::uInt freqID
[1819]96 ) const;
[847]97
[836]98 /**
99 * Return the unit of the frequency values
[3106]100 * @return casacore::Unit
[836]101 */
[3106]102 casacore::Unit getUnit() const;
[847]103 std::string getUnitString() const;
104
[836]105 /**
106 * Return the doppler type of the values
[3106]107 * @return casacore::MDoppler::Types
[836]108 */
[3106]109 casacore::MDoppler::Types getDoppler() const;
[847]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
[3106]116 * @return casacore::MFrequency::Types
[836]117 */
[3106]118 casacore::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 /**
[3106]133 * set the frequency frame from a casacore::MFrequency::Types
134 * @param frame casacore::MFrequency::Types
[836]135 */
[3106]136 void setFrame(casacore::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 */
[3106]146 void rescale(casacore::Float factor, const std::string& mode);
[806]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 */
[3106]154 float getRefFreq(casacore::uInt id, casacore::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 */
[3106]161 void shiftRefPix(int npix, casacore::uInt id);
[1360]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 */
[3106]167 std::string print(int id=-1, casacore::Bool strip=casacore::False) const;
[806]168
[847]169 std::vector<std::string> getInfo() const;
170 void setInfo( const std::vector<std::string>& theinfo );
171
[3106]172 const casacore::String& name() const { return name_; }
[856]173
[2900]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 */
[3106]187 bool match( casacore::Double refpix, casacore::Double refval, casacore::Double inc,
188 casacore::Double freqTolInHz, casacore::uInt &id);
[2900]189
[806]190private:
[836]191
192 /**
[3106]193 * setup the the column structure of the casacore::table
[836]194 */
[806]195 void setup();
[836]196 /**
197 * the actual binning of the SpectralCoordinate as called by rescale
198 * @param sc
199 * @param factor the bin factor
[3106]200 * @return casacore::SpectralCoordinate
[836]201 */
[3106]202 casacore::SpectralCoordinate binCsys(const casacore::SpectralCoordinate& sc, casacore::Int factor);
[836]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 */
[3106]209 casacore::SpectralCoordinate resampleCsys(const casacore::SpectralCoordinate& sc, casacore::Float width);
[806]210
[3106]211 static const casacore::String name_;
212 casacore::ScalarColumn<casacore::Double> refvalCol_, refpixCol_, incrCol_;
[806]213};
214
215}
216
217#endif
Note: See TracBrowser for help on using the repository browser.