| [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 |
|
|---|
| [840] | 57 | bool conformant(const STFrequencies& other) const;
|
|---|
| 58 |
|
|---|
| [836] | 59 | /**
|
|---|
| 60 | * Retrieve the frequency values as a casa::SpectralCoordinate
|
|---|
| 61 | * @param freqID
|
|---|
| 62 | * @return casa::SpectralCoordinate
|
|---|
| 63 | */
|
|---|
| [806] | 64 | casa::SpectralCoordinate getSpectralCoordinate( casa::uInt freqID );
|
|---|
| 65 |
|
|---|
| [836] | 66 | /**
|
|---|
| 67 | * Return the unit of the frequency values
|
|---|
| 68 | * @return casa::Unit
|
|---|
| 69 | */
|
|---|
| [806] | 70 | const casa::Unit& getUnit() const;
|
|---|
| [836] | 71 | /**
|
|---|
| 72 | * Return the doppler type of the values
|
|---|
| 73 | * @return casa::MDoppler
|
|---|
| 74 | */
|
|---|
| [806] | 75 | casa::MDoppler getDoppler() const;
|
|---|
| 76 |
|
|---|
| 77 |
|
|---|
| [836] | 78 | /**
|
|---|
| 79 | * Return the frame type, e.g MFrequency::TOPO
|
|---|
| 80 | * @return casa::MFrequency::Types
|
|---|
| 81 | */
|
|---|
| [806] | 82 | casa::MFrequency::Types getFrame() const;
|
|---|
| [836] | 83 |
|
|---|
| 84 | /**
|
|---|
| 85 | * Return a string representation of the frame type, e.g TOPO
|
|---|
| 86 | * @return
|
|---|
| 87 | */
|
|---|
| [806] | 88 | std::string getFrameString() const;
|
|---|
| [836] | 89 |
|
|---|
| 90 | /**
|
|---|
| 91 | * set the frequency frame from a string value
|
|---|
| 92 | * @param frame a string identifier
|
|---|
| 93 | */
|
|---|
| [806] | 94 | void setFrame(const std::string& frame);
|
|---|
| [836] | 95 | /**
|
|---|
| 96 | * set the frequency frame from a casa::MFrequency::Types
|
|---|
| 97 | * @param frame casa::MFrequency::Types
|
|---|
| 98 | */
|
|---|
| [806] | 99 | void setFrame(casa::MFrequency::Types frame);
|
|---|
| 100 |
|
|---|
| [836] | 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 | */
|
|---|
| [806] | 108 | void rescale(casa::Float factor, const std::string& mode);
|
|---|
| 109 |
|
|---|
| [836] | 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 | */
|
|---|
| [830] | 116 | float getRefFreq(casa::uInt id, casa::uInt channel);
|
|---|
| [806] | 117 |
|
|---|
| [836] | 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 | */
|
|---|
| [806] | 124 | std::string print(int id=-1);
|
|---|
| 125 |
|
|---|
| 126 | private:
|
|---|
| [836] | 127 |
|
|---|
| 128 | /**
|
|---|
| 129 | * setup the the column structure of the casa::table
|
|---|
| 130 | */
|
|---|
| [806] | 131 | void setup();
|
|---|
| [836] | 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 | */
|
|---|
| [806] | 138 | casa::SpectralCoordinate binCsys(const casa::SpectralCoordinate& sc, casa::Int factor);
|
|---|
| [836] | 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 | */
|
|---|
| [806] | 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
|
|---|