[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:
|
---|
[849] | 33 | STFrequencies() {;}
|
---|
[1353] | 34 | explicit STFrequencies(casa::Table tab);
|
---|
| 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 | */
|
---|
| 48 | casa::uInt addEntry( casa::Double refpix, casa::Double refval,
|
---|
| 49 | casa::Double inc );
|
---|
| 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 | */
|
---|
[830] | 58 | void getEntry( casa::Double& refpix, casa::Double& refval,
|
---|
| 59 | casa::Double& inc, casa::uInt id );
|
---|
[806] | 60 |
|
---|
[836] | 61 |
|
---|
[840] | 62 | bool conformant(const STFrequencies& other) const;
|
---|
| 63 |
|
---|
[836] | 64 | /**
|
---|
| 65 | * Retrieve the frequency values as a casa::SpectralCoordinate
|
---|
| 66 | * @param freqID
|
---|
| 67 | * @return casa::SpectralCoordinate
|
---|
| 68 | */
|
---|
[847] | 69 | casa::SpectralCoordinate getSpectralCoordinate( casa::uInt freqID ) const;
|
---|
[806] | 70 |
|
---|
[847] | 71 | casa::SpectralCoordinate getSpectralCoordinate( const casa::MDirection& md,
|
---|
| 72 | const casa::MPosition& mp,
|
---|
| 73 | const casa::MEpoch& me,
|
---|
| 74 | casa::Double restfreq,
|
---|
| 75 | casa::uInt freqID
|
---|
| 76 | ) const;
|
---|
| 77 |
|
---|
[836] | 78 | /**
|
---|
| 79 | * Return the unit of the frequency values
|
---|
| 80 | * @return casa::Unit
|
---|
| 81 | */
|
---|
[847] | 82 | casa::Unit getUnit() const;
|
---|
| 83 | std::string getUnitString() const;
|
---|
| 84 |
|
---|
[836] | 85 | /**
|
---|
| 86 | * Return the doppler type of the values
|
---|
[847] | 87 | * @return casa::MDoppler::Types
|
---|
[836] | 88 | */
|
---|
[847] | 89 | casa::MDoppler::Types getDoppler() const;
|
---|
| 90 | std::string getDopplerString() const;
|
---|
[806] | 91 |
|
---|
| 92 |
|
---|
[836] | 93 | /**
|
---|
| 94 | * Return the frame type, e.g MFrequency::TOPO
|
---|
[847] | 95 | * @param base return the base frame or the user frame
|
---|
[836] | 96 | * @return casa::MFrequency::Types
|
---|
| 97 | */
|
---|
[847] | 98 | casa::MFrequency::Types getFrame(bool base=false) const;
|
---|
[836] | 99 |
|
---|
| 100 | /**
|
---|
| 101 | * Return a string representation of the frame type, e.g TOPO
|
---|
[847] | 102 | * @param base return the base frame or the user frame
|
---|
| 103 | * @return the string representation of the frame
|
---|
[836] | 104 | */
|
---|
[847] | 105 | std::string getFrameString(bool base=false) const;
|
---|
[836] | 106 |
|
---|
| 107 | /**
|
---|
| 108 | * set the frequency frame from a string value
|
---|
| 109 | * @param frame a string identifier
|
---|
| 110 | */
|
---|
[921] | 111 | void setFrame(const std::string& frame, bool base=false);
|
---|
[836] | 112 | /**
|
---|
| 113 | * set the frequency frame from a casa::MFrequency::Types
|
---|
| 114 | * @param frame casa::MFrequency::Types
|
---|
| 115 | */
|
---|
[921] | 116 | void setFrame(casa::MFrequency::Types frame, bool base=false);
|
---|
[866] | 117 | void setUnit( const std::string & unit );
|
---|
| 118 | void setDoppler( const std::string & doppler );
|
---|
[836] | 119 | /**
|
---|
| 120 | * rescale the whole table by a given factor
|
---|
| 121 | * @param factor the factor to bin or resample by
|
---|
| 122 | * @param mode the rescaling mode
|
---|
| 123 | * @li "BIN"
|
---|
| 124 | * @li "RESAMPLE"
|
---|
| 125 | */
|
---|
[806] | 126 | void rescale(casa::Float factor, const std::string& mode);
|
---|
| 127 |
|
---|
[836] | 128 | /**
|
---|
| 129 | * get the reference frequency at a given channel for a specidif identifier
|
---|
| 130 | * @param id the identifier
|
---|
| 131 | * @param channel the channel number
|
---|
| 132 | * @return teh reference frequency
|
---|
| 133 | */
|
---|
[830] | 134 | float getRefFreq(casa::uInt id, casa::uInt channel);
|
---|
[806] | 135 |
|
---|
[836] | 136 | /**
|
---|
[1360] | 137 | * shift the reference pixel by an integer amount
|
---|
| 138 | * @param npix the shift in pixels
|
---|
| 139 | * @param id the coordinate id
|
---|
| 140 | */
|
---|
| 141 | void shiftRefPix(int npix, casa::uInt id);
|
---|
| 142 | /**
|
---|
| 143 | * Return this table or s specific row as a string representation
|
---|
[836] | 144 | * @param id the identifier. If id<0 all rows are returned
|
---|
| 145 | * @return a string
|
---|
| 146 | */
|
---|
[1375] | 147 | std::string print(int id=-1, casa::Bool strip=casa::False) const;
|
---|
[806] | 148 |
|
---|
[847] | 149 | std::vector<std::string> getInfo() const;
|
---|
| 150 | void setInfo( const std::vector<std::string>& theinfo );
|
---|
| 151 |
|
---|
[856] | 152 | const casa::String& name() const { return name_; }
|
---|
| 153 |
|
---|
[806] | 154 | private:
|
---|
[836] | 155 |
|
---|
| 156 | /**
|
---|
| 157 | * setup the the column structure of the casa::table
|
---|
| 158 | */
|
---|
[806] | 159 | void setup();
|
---|
[836] | 160 | /**
|
---|
| 161 | * the actual binning of the SpectralCoordinate as called by rescale
|
---|
| 162 | * @param sc
|
---|
| 163 | * @param factor the bin factor
|
---|
| 164 | * @return casa::SpectralCoordinate
|
---|
| 165 | */
|
---|
[806] | 166 | casa::SpectralCoordinate binCsys(const casa::SpectralCoordinate& sc, casa::Int factor);
|
---|
[836] | 167 | /**
|
---|
| 168 | * the actual resampling of the SpectralCoordinate as called by rescale
|
---|
| 169 | * @param sc
|
---|
| 170 | * @param width the resacle width. Can be decimal.
|
---|
| 171 | * @return
|
---|
| 172 | */
|
---|
[806] | 173 | casa::SpectralCoordinate resampleCsys(const casa::SpectralCoordinate& sc, casa::Float width);
|
---|
| 174 |
|
---|
| 175 | static const casa::String name_;
|
---|
| 176 | casa::ScalarColumn<casa::Double> refvalCol_, refpixCol_, incrCol_;
|
---|
| 177 | };
|
---|
| 178 |
|
---|
| 179 | }
|
---|
| 180 |
|
---|
| 181 | #endif
|
---|