source: trunk/src/STFrequencies.h@ 841

Last change on this file since 841 was 840, checked in by mar637, 19 years ago

added conformant() which checks if to objects are conformant

File size: 3.9 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 );
65
66 /**
67 * Return the unit of the frequency values
68 * @return casa::Unit
69 */
70 const casa::Unit& getUnit() const;
71 /**
72 * Return the doppler type of the values
73 * @return casa::MDoppler
74 */
75 casa::MDoppler getDoppler() const;
76
77
78 /**
79 * Return the frame type, e.g MFrequency::TOPO
80 * @return casa::MFrequency::Types
81 */
82 casa::MFrequency::Types getFrame() const;
83
84 /**
85 * Return a string representation of the frame type, e.g TOPO
86 * @return
87 */
88 std::string getFrameString() const;
89
90 /**
91 * set the frequency frame from a string value
92 * @param frame a string identifier
93 */
94 void setFrame(const std::string& frame);
95 /**
96 * set the frequency frame from a casa::MFrequency::Types
97 * @param frame casa::MFrequency::Types
98 */
99 void setFrame(casa::MFrequency::Types frame);
100
101 /**
102 * rescale the whole table by a given factor
103 * @param factor the factor to bin or resample by
104 * @param mode the rescaling mode
105 * @li "BIN"
106 * @li "RESAMPLE"
107 */
108 void rescale(casa::Float factor, const std::string& mode);
109
110 /**
111 * get the reference frequency at a given channel for a specidif identifier
112 * @param id the identifier
113 * @param channel the channel number
114 * @return teh reference frequency
115 */
116 float getRefFreq(casa::uInt id, casa::uInt channel);
117
118
119 /**
120 * Rteun this table or s specific row as a string representation
121 * @param id the identifier. If id<0 all rows are returned
122 * @return a string
123 */
124 std::string print(int id=-1);
125
126private:
127
128 /**
129 * setup the the column structure of the casa::table
130 */
131 void setup();
132 /**
133 * the actual binning of the SpectralCoordinate as called by rescale
134 * @param sc
135 * @param factor the bin factor
136 * @return casa::SpectralCoordinate
137 */
138 casa::SpectralCoordinate binCsys(const casa::SpectralCoordinate& sc, casa::Int factor);
139 /**
140 * the actual resampling of the SpectralCoordinate as called by rescale
141 * @param sc
142 * @param width the resacle width. Can be decimal.
143 * @return
144 */
145 casa::SpectralCoordinate resampleCsys(const casa::SpectralCoordinate& sc, casa::Float width);
146
147 static const casa::String name_;
148 casa::ScalarColumn<casa::Double> refvalCol_, refpixCol_, incrCol_;
149};
150
151}
152
153#endif
Note: See TracBrowser for help on using the repository browser.