source: trunk/src/STFrequencies.h @ 847

Last change on this file since 847 was 847, checked in by mar637, 18 years ago

numerous changes before move to new svn repository sourcecode.atnf.csiro.au

File size: 4.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( casa::Table::TableType tt = casa::Table::Memory);
34
35    virtual ~STFrequencies();
36  /**
37   * Add a new Entry to the Frequency subtable. This checks for duplicates.
38   * @param[in] refpix the reference pixel
39   * @param[in] refval the reference value
40   * @param[in] inc the increment
41   * @return an index into the frequency table
42   */
43  casa::uInt addEntry( casa::Double refpix, casa::Double refval,
44                       casa::Double inc );
45
46  /**
47   * Retrieve the frequency values for a specific id via references
48   * @param refpix the reference pixel
49   * @param refval the reference value
50   * @param inc the increment
51   * @param id the identifier
52   */
53  void getEntry( casa::Double& refpix, casa::Double& refval,
54                 casa::Double& inc, casa::uInt id );
55
56
57  bool conformant(const STFrequencies& other) const;
58
59  /**
60   * Retrieve  the frequency values as a casa::SpectralCoordinate
61   * @param freqID
62   * @return casa::SpectralCoordinate
63   */
64  casa::SpectralCoordinate getSpectralCoordinate( casa::uInt freqID ) const;
65
66  casa::SpectralCoordinate getSpectralCoordinate( const casa::MDirection& md,
67                                                  const casa::MPosition& mp,
68                                                  const casa::MEpoch& me,
69                                                  casa::Double restfreq,
70                                                  casa::uInt freqID
71                                                  ) const;
72
73  /**
74   * Return the unit of the frequency values
75   * @return casa::Unit
76   */
77  casa::Unit getUnit() const;
78  std::string getUnitString() const;
79
80  /**
81   * Return the doppler type of the values
82   * @return casa::MDoppler::Types
83   */
84  casa::MDoppler::Types getDoppler() const;
85  std::string getDopplerString() const;
86
87
88  /**
89   * Return the frame type, e.g MFrequency::TOPO
90   * @param base return the base frame or the user frame
91   * @return casa::MFrequency::Types
92   */
93  casa::MFrequency::Types getFrame(bool base=false) const;
94
95  /**
96   * Return a string representation of the frame type, e.g TOPO
97   * @param base return the base frame or the user frame
98   * @return the string representation of the frame
99   */
100  std::string getFrameString(bool base=false) const;
101
102  /**
103   * set the frequency frame from a string value
104   * @param frame a string identifier
105   */
106  void setFrame(const std::string& frame);
107  /**
108   * set the frequency frame from a casa::MFrequency::Types
109   * @param frame casa::MFrequency::Types
110   */
111  void setFrame(casa::MFrequency::Types frame);
112
113  /**
114   * rescale the whole table by a given factor
115   * @param factor the factor to bin or resample by
116   * @param mode the rescaling mode
117   * @li "BIN"
118   * @li "RESAMPLE"
119   */
120  void rescale(casa::Float factor, const std::string& mode);
121
122  /**
123   * get the reference frequency at a given channel for a specidif identifier
124   * @param id the identifier
125   * @param channel the channel number
126   * @return teh reference frequency
127   */
128  float getRefFreq(casa::uInt id, casa::uInt channel);
129
130
131  /**
132   * Rteun this table or s specific row as a string representation
133   * @param id the identifier. If id<0 all rows are returned
134   * @return a string
135   */
136  std::string print(int id=-1);
137
138  std::vector<std::string> getInfo() const;
139  void setInfo( const std::vector<std::string>& theinfo );
140
141private:
142
143  /**
144   * setup the the column structure of the casa::table
145   */
146  void setup();
147  /**
148   * the actual binning of the SpectralCoordinate as called by rescale
149   * @param sc
150   * @param factor the bin factor
151   * @return casa::SpectralCoordinate
152   */
153  casa::SpectralCoordinate binCsys(const casa::SpectralCoordinate& sc, casa::Int factor);
154  /**
155   * the actual resampling of the SpectralCoordinate as called by rescale
156   * @param sc
157   * @param width the resacle width. Can be decimal.
158   * @return
159   */
160  casa::SpectralCoordinate resampleCsys(const casa::SpectralCoordinate& sc, casa::Float width);
161
162  static const casa::String name_;
163  casa::ScalarColumn<casa::Double> refvalCol_, refpixCol_, incrCol_;
164};
165
166}
167
168#endif
Note: See TracBrowser for help on using the repository browser.