source: trunk/src/STFrequencies.h @ 3106

Last change on this file since 3106 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
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(casacore::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  casacore::uInt addEntry( casacore::Double refpix, casacore::Double refval,
49                       casacore::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( casacore::Double& refpix, casacore::Double& refval,
59                 casacore::Double& inc, casacore::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( casacore::Double refpix, casacore::Double refval,
71                 casacore::Double inc, casacore::uInt id ) ;
72
73
74  bool conformant(const STFrequencies& other) const;
75
76  /**
77   * Retrieve  the frequency values as a casacore::SpectralCoordinate
78   * @param freqID
79   * @return casacore::SpectralCoordinate
80   */
81  casacore::SpectralCoordinate getSpectralCoordinate( casacore::uInt freqID ) const;
82
83  /**
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
89                                                  ) const;
90  **/
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
96                                                  ) const;
97
98  /**
99   * Return the unit of the frequency values
100   * @return casacore::Unit
101   */
102  casacore::Unit getUnit() const;
103  std::string getUnitString() const;
104
105  /**
106   * Return the doppler type of the values
107   * @return casacore::MDoppler::Types
108   */
109  casacore::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 casacore::MFrequency::Types
117   */
118  casacore::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 casacore::MFrequency::Types
134   * @param frame casacore::MFrequency::Types
135   */
136  void setFrame(casacore::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(casacore::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(casacore::uInt id, casacore::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, casacore::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, casacore::Bool strip=casacore::False) const;
168
169  std::vector<std::string> getInfo() const;
170  void setInfo( const std::vector<std::string>& theinfo );
171
172  const casacore::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( casacore::Double refpix, casacore::Double refval, casacore::Double inc,
188              casacore::Double freqTolInHz, casacore::uInt &id);
189
190private:
191
192  /**
193   * setup the the column structure of the casacore::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 casacore::SpectralCoordinate
201   */
202  casacore::SpectralCoordinate binCsys(const casacore::SpectralCoordinate& sc, casacore::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  casacore::SpectralCoordinate resampleCsys(const casacore::SpectralCoordinate& sc, casacore::Float width);
210
211  static const casacore::String name_;
212  casacore::ScalarColumn<casacore::Double> refvalCol_, refpixCol_, incrCol_;
213};
214
215}
216
217#endif
Note: See TracBrowser for help on using the repository browser.