[2] | 1 | //#---------------------------------------------------------------------------
|
---|
| 2 | //# SDContainer.h: A container class for single dish integrations
|
---|
| 3 | //#---------------------------------------------------------------------------
|
---|
| 4 | //# Copyright (C) 2004
|
---|
[125] | 5 | //# ATNF
|
---|
[2] | 6 | //#
|
---|
| 7 | //# This program is free software; you can redistribute it and/or modify it
|
---|
| 8 | //# under the terms of the GNU General Public License as published by the Free
|
---|
| 9 | //# Software Foundation; either version 2 of the License, or (at your option)
|
---|
| 10 | //# any later version.
|
---|
| 11 | //#
|
---|
| 12 | //# This program is distributed in the hope that it will be useful, but
|
---|
| 13 | //# WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 14 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
---|
| 15 | //# Public License for more details.
|
---|
| 16 | //#
|
---|
| 17 | //# You should have received a copy of the GNU General Public License along
|
---|
| 18 | //# with this program; if not, write to the Free Software Foundation, Inc.,
|
---|
| 19 | //# 675 Massachusetts Ave, Cambridge, MA 02139, USA.
|
---|
| 20 | //#
|
---|
| 21 | //# Correspondence concerning this software should be addressed as follows:
|
---|
| 22 | //# Internet email: Malte.Marquarding@csiro.au
|
---|
| 23 | //# Postal address: Malte Marquarding,
|
---|
| 24 | //# Australia Telescope National Facility,
|
---|
| 25 | //# P.O. Box 76,
|
---|
| 26 | //# Epping, NSW, 2121,
|
---|
| 27 | //# AUSTRALIA
|
---|
| 28 | //#
|
---|
| 29 | //# $Id:
|
---|
| 30 | //#---------------------------------------------------------------------------
|
---|
[125] | 31 | #ifndef SDCONTAINER_H
|
---|
| 32 | #define SDCONTAINER_H
|
---|
[2] | 33 |
|
---|
[18] | 34 | #include <vector>
|
---|
| 35 |
|
---|
[81] | 36 | #include <casa/aips.h>
|
---|
| 37 | #include <casa/BasicSL/String.h>
|
---|
| 38 | #include <casa/Arrays/Array.h>
|
---|
| 39 | #include <casa/Arrays/Vector.h>
|
---|
[2] | 40 |
|
---|
[125] | 41 | template<class T> class casa::Matrix;
|
---|
[2] | 42 |
|
---|
[83] | 43 | namespace asap {
|
---|
[2] | 44 |
|
---|
[18] | 45 |
|
---|
| 46 | struct SDHeader {
|
---|
[125] | 47 | casa::Int nchan;
|
---|
| 48 | casa::Int npol;
|
---|
| 49 | casa::Int nif;
|
---|
| 50 | casa::Int nbeam;
|
---|
| 51 | casa::String observer;
|
---|
| 52 | casa::String project;
|
---|
| 53 | casa::String obstype;
|
---|
| 54 | casa::String antennaname;
|
---|
| 55 | casa::Vector<casa::Double> antennaposition;
|
---|
| 56 | casa::Float equinox;
|
---|
| 57 | casa::String freqref;
|
---|
| 58 | casa::Double reffreq;
|
---|
| 59 | casa::Double bandwidth;
|
---|
| 60 | casa::Double utc;
|
---|
[204] | 61 | casa::String fluxunit;
|
---|
| 62 | casa::String epoch;
|
---|
[18] | 63 | void print() const ;
|
---|
| 64 | };
|
---|
| 65 |
|
---|
[2] | 66 | class SDFrequencyTable {
|
---|
| 67 |
|
---|
| 68 | public:
|
---|
| 69 |
|
---|
[34] | 70 | SDFrequencyTable() : nFreq_(0) {;}
|
---|
| 71 | virtual ~SDFrequencyTable() {;}
|
---|
| 72 |
|
---|
[125] | 73 | casa::Int length() const { return nFreq_;};// # of stored Frequencies
|
---|
[34] | 74 |
|
---|
[125] | 75 | casa::Double referencePixel(casa::uInt which) const { return refPix_[which];}
|
---|
| 76 | casa::Double referenceValue(casa::uInt which) const { return refVal_[which];}
|
---|
| 77 | casa::Double increment(casa::uInt which) const { return increment_[which];}
|
---|
| 78 | casa::Float equinox() const { return equinox_; }
|
---|
| 79 | casa::String refFrame() const { return refFrame_; }
|
---|
[204] | 80 | void restFrequencies(casa::Vector<casa::Double>& rfs,
|
---|
| 81 | casa::String& rfunit ) const ;
|
---|
[34] | 82 |
|
---|
[2] | 83 | // returns the index into the table
|
---|
| 84 | // this creates a new one or returns an existing one
|
---|
[125] | 85 | casa::Int addFrequency(casa::Int refPix, casa::Double refVal,
|
---|
| 86 | casa::Double inc);
|
---|
| 87 | void setEquinox(casa::Float eq) { equinox_ = eq; }
|
---|
| 88 | void setRefFrame(const casa::String& reff) { refFrame_ = reff; }
|
---|
[204] | 89 | void addRestFrequency(casa::Double);
|
---|
| 90 | void setRestFrequencyUnit(const casa::String& theunit) {
|
---|
| 91 | restFreqUnit_ = theunit;
|
---|
| 92 | };
|
---|
| 93 |
|
---|
[2] | 94 | private:
|
---|
[125] | 95 | casa::Int nFreq_;
|
---|
| 96 | casa::Vector<casa::Double> refPix_;
|
---|
| 97 | casa::Vector<casa::Double> refVal_;
|
---|
| 98 | casa::Vector<casa::Double> increment_;
|
---|
| 99 | casa::Float equinox_;
|
---|
| 100 | casa::String refFrame_;
|
---|
[204] | 101 | casa::Vector<casa::Double> restFreqs_;
|
---|
| 102 | casa::String restFreqUnit_;
|
---|
[2] | 103 | };
|
---|
| 104 |
|
---|
| 105 |
|
---|
| 106 | class SDContainer {
|
---|
| 107 |
|
---|
| 108 | public:
|
---|
[125] | 109 | SDContainer(casa::uInt nBeam, casa::uInt nIF, casa::uInt nPol,
|
---|
| 110 | casa::uInt nChan);
|
---|
| 111 | SDContainer(casa::IPosition shp);
|
---|
[2] | 112 |
|
---|
| 113 | virtual ~SDContainer();
|
---|
| 114 |
|
---|
[125] | 115 | casa::Bool resize(casa::IPosition shp);
|
---|
[47] | 116 |
|
---|
[125] | 117 | casa::Bool setSpectrum(const casa::Matrix<casa::Float>& spec,
|
---|
| 118 | casa::uInt whichBeam, casa::uInt whichIF);
|
---|
| 119 | casa::Bool putSpectrum(const casa::Array<casa::Float>& spec);
|
---|
[2] | 120 |
|
---|
[125] | 121 | casa::Bool setFlags(const casa::Matrix<casa::uChar>& flgs,
|
---|
| 122 | casa::uInt whichBeam, casa::uInt whichIF);
|
---|
| 123 | casa::Bool putFlags(const casa::Array<casa::uChar>& spec);
|
---|
[2] | 124 |
|
---|
[125] | 125 | casa::Bool setTsys(const casa::Vector<casa::Float>& ts,
|
---|
| 126 | casa::uInt whichBeam, casa::uInt whichIF);
|
---|
| 127 | casa::Bool putTsys(const casa::Array<casa::Float>& spec);
|
---|
[2] | 128 |
|
---|
[125] | 129 | casa::Bool setDirection(const casa::Vector<casa::Double>& point,
|
---|
| 130 | casa::uInt whichBeam);
|
---|
| 131 | casa::Bool putDirection(const casa::Array<casa::Double>& dir);
|
---|
[2] | 132 |
|
---|
[125] | 133 | casa::Bool setFrequencyMap(casa::uInt freqslot, casa::uInt whichIF);
|
---|
| 134 | casa::Bool putFreqMap(const casa::Vector<casa::uInt>& freqs);
|
---|
[2] | 135 |
|
---|
[125] | 136 | casa::Array<casa::Float> getSpectrum(casa::uInt whichBeam,
|
---|
| 137 | casa::uInt whichIF) const;
|
---|
| 138 | casa::Array<casa::uChar> getFlags(casa::uInt whichBeam,
|
---|
| 139 | casa::uInt whichIF) const;
|
---|
| 140 | casa::Array<casa::Float> getTsys(casa::uInt whichBeam,
|
---|
| 141 | casa::uInt whichIF) const;
|
---|
| 142 | casa::Array<casa::Double> getDirection(casa::uInt whichBeam) const;
|
---|
[34] | 143 |
|
---|
[125] | 144 | const casa::Array<casa::Float>& getSpectrum() const { return spectrum_; }
|
---|
| 145 | const casa::Array<casa::uChar>& getFlags() const { return flags_; }
|
---|
| 146 | const casa::Array<casa::Float>& getTsys() const { return tsys_; }
|
---|
| 147 | const casa::Array<casa::Double>& getDirection() const { return direction_; }
|
---|
[2] | 148 |
|
---|
[125] | 149 | const casa::Vector<casa::uInt>& getFreqMap() const { return freqidx_; }
|
---|
[79] | 150 |
|
---|
[204] | 151 | const casa::Vector<casa::String>& getHistory() const { return history_; }
|
---|
| 152 | casa::Bool putHistory(const casa::Vector<casa::String>& hist);
|
---|
| 153 | casa::Bool appendHistory(const casa::String& hist);
|
---|
| 154 |
|
---|
[125] | 155 | casa::Double timestamp;
|
---|
[104] | 156 | //Double bandwidth;
|
---|
[125] | 157 | casa::String sourcename;
|
---|
| 158 | casa::String fieldname;
|
---|
| 159 | casa::Double interval;
|
---|
| 160 | casa::Int scanid;
|
---|
| 161 | casa::Vector<casa::Float> tcal;
|
---|
| 162 | casa::String tcaltime;
|
---|
| 163 | casa::Float azimuth;
|
---|
| 164 | casa::Float elevation;
|
---|
| 165 | casa::Float parangle;
|
---|
| 166 | casa::Int refbeam;
|
---|
[104] | 167 |
|
---|
[2] | 168 | private:
|
---|
[125] | 169 | casa::uInt nBeam_,nIF_,nPol_,nChan_;
|
---|
[2] | 170 |
|
---|
[16] | 171 | // (nBeam,nIF,nPol,nChannel)
|
---|
[125] | 172 | casa::Array<casa::Float> spectrum_;
|
---|
| 173 | casa::Array<casa::uChar> flags_;
|
---|
[16] | 174 | // (nBeam,nIF,nPol,[nChannel]) Tsys is not really a function of
|
---|
[7] | 175 | // channel, but this makes it easier to work with at the expense of
|
---|
| 176 | // a little memory
|
---|
[125] | 177 | casa::Array<casa::Float> tsys_;
|
---|
| 178 | casa::Array<casa::Float> tcal_;
|
---|
[2] | 179 |
|
---|
| 180 | //(nIF) indx into "global" frequency table
|
---|
[125] | 181 | casa::Vector<casa::uInt> freqidx_;
|
---|
[79] | 182 | //(nBeam,2) maybe use Measures here...
|
---|
[125] | 183 | casa::Array<casa::Double> direction_;
|
---|
[204] | 184 | casa::Vector<casa::String> history_;
|
---|
[2] | 185 |
|
---|
| 186 | };
|
---|
| 187 |
|
---|
| 188 | } // namespace
|
---|
| 189 | #endif
|
---|