[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 | |
---|
| 23 | namespace asap { |
---|
| 24 | |
---|
| 25 | /** |
---|
| 26 | The Frequencies subtable of the Scantable |
---|
| 27 | |
---|
| 28 | @author Malte Marquarding |
---|
[836] | 29 | @brief The frequency subtable of the Scantable |
---|
[806] | 30 | */ |
---|
| 31 | class STFrequencies : public STSubTable { |
---|
| 32 | public: |
---|
| 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 | |
---|
[836] | 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 | */ |
---|
[830] | 53 | void getEntry( casa::Double& refpix, casa::Double& refval, |
---|
| 54 | casa::Double& inc, casa::uInt id ); |
---|
[806] | 55 | |
---|
[836] | 56 | |
---|
| 57 | /** |
---|
| 58 | * Retrieve the frequency values as a casa::SpectralCoordinate |
---|
| 59 | * @param freqID |
---|
| 60 | * @return casa::SpectralCoordinate |
---|
| 61 | */ |
---|
[806] | 62 | casa::SpectralCoordinate getSpectralCoordinate( casa::uInt freqID ); |
---|
| 63 | |
---|
[836] | 64 | /** |
---|
| 65 | * Return the unit of the frequency values |
---|
| 66 | * @return casa::Unit |
---|
| 67 | */ |
---|
[806] | 68 | const casa::Unit& getUnit() const; |
---|
[836] | 69 | /** |
---|
| 70 | * Return the doppler type of the values |
---|
| 71 | * @return casa::MDoppler |
---|
| 72 | */ |
---|
[806] | 73 | casa::MDoppler getDoppler() const; |
---|
| 74 | |
---|
| 75 | |
---|
[836] | 76 | /** |
---|
| 77 | * Return the frame type, e.g MFrequency::TOPO |
---|
| 78 | * @return casa::MFrequency::Types |
---|
| 79 | */ |
---|
[806] | 80 | casa::MFrequency::Types getFrame() const; |
---|
[836] | 81 | |
---|
| 82 | /** |
---|
| 83 | * Return a string representation of the frame type, e.g TOPO |
---|
| 84 | * @return |
---|
| 85 | */ |
---|
[806] | 86 | std::string getFrameString() const; |
---|
[836] | 87 | |
---|
| 88 | /** |
---|
| 89 | * set the frequency frame from a string value |
---|
| 90 | * @param frame a string identifier |
---|
| 91 | */ |
---|
[806] | 92 | void setFrame(const std::string& frame); |
---|
[836] | 93 | /** |
---|
| 94 | * set the frequency frame from a casa::MFrequency::Types |
---|
| 95 | * @param frame casa::MFrequency::Types |
---|
| 96 | */ |
---|
[806] | 97 | void setFrame(casa::MFrequency::Types frame); |
---|
| 98 | |
---|
[836] | 99 | /** |
---|
| 100 | * rescale the whole table by a given factor |
---|
| 101 | * @param factor the factor to bin or resample by |
---|
| 102 | * @param mode the rescaling mode |
---|
| 103 | * @li "BIN" |
---|
| 104 | * @li "RESAMPLE" |
---|
| 105 | */ |
---|
[806] | 106 | void rescale(casa::Float factor, const std::string& mode); |
---|
| 107 | |
---|
[836] | 108 | /** |
---|
| 109 | * get the reference frequency at a given channel for a specidif identifier |
---|
| 110 | * @param id the identifier |
---|
| 111 | * @param channel the channel number |
---|
| 112 | * @return teh reference frequency |
---|
| 113 | */ |
---|
[830] | 114 | float getRefFreq(casa::uInt id, casa::uInt channel); |
---|
[806] | 115 | |
---|
[836] | 116 | |
---|
| 117 | /** |
---|
| 118 | * Rteun this table or s specific row as a string representation |
---|
| 119 | * @param id the identifier. If id<0 all rows are returned |
---|
| 120 | * @return a string |
---|
| 121 | */ |
---|
[806] | 122 | std::string print(int id=-1); |
---|
| 123 | |
---|
| 124 | private: |
---|
[836] | 125 | |
---|
| 126 | /** |
---|
| 127 | * setup the the column structure of the casa::table |
---|
| 128 | */ |
---|
[806] | 129 | void setup(); |
---|
[836] | 130 | /** |
---|
| 131 | * the actual binning of the SpectralCoordinate as called by rescale |
---|
| 132 | * @param sc |
---|
| 133 | * @param factor the bin factor |
---|
| 134 | * @return casa::SpectralCoordinate |
---|
| 135 | */ |
---|
[806] | 136 | casa::SpectralCoordinate binCsys(const casa::SpectralCoordinate& sc, casa::Int factor); |
---|
[836] | 137 | /** |
---|
| 138 | * the actual resampling of the SpectralCoordinate as called by rescale |
---|
| 139 | * @param sc |
---|
| 140 | * @param width the resacle width. Can be decimal. |
---|
| 141 | * @return |
---|
| 142 | */ |
---|
[806] | 143 | casa::SpectralCoordinate resampleCsys(const casa::SpectralCoordinate& sc, casa::Float width); |
---|
| 144 | |
---|
| 145 | static const casa::String name_; |
---|
| 146 | casa::ScalarColumn<casa::Double> refvalCol_, refpixCol_, incrCol_; |
---|
| 147 | }; |
---|
| 148 | |
---|
| 149 | } |
---|
| 150 | |
---|
| 151 | #endif |
---|