[2] | 1 | //#---------------------------------------------------------------------------
|
---|
| 2 | //# SDContainer.h: A container class for single dish integrations
|
---|
| 3 | //#---------------------------------------------------------------------------
|
---|
| 4 | //# Copyright (C) 2004
|
---|
| 5 | //# Malte Marquarding, ATNF
|
---|
| 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 | //#---------------------------------------------------------------------------
|
---|
| 31 | #ifndef _SDCONTAINER_H_
|
---|
| 32 | #define _SDCONTAINER_H_
|
---|
| 33 |
|
---|
[18] | 34 | #include <vector>
|
---|
| 35 |
|
---|
[2] | 36 | #include <aips/aips.h>
|
---|
| 37 | #include <aips/Utilities/String.h>
|
---|
| 38 | #include <aips/Arrays/Array.h>
|
---|
| 39 | #include <aips/Arrays/Vector.h>
|
---|
| 40 |
|
---|
| 41 | template<class T> class Matrix;
|
---|
| 42 |
|
---|
| 43 | namespace atnf_sd {
|
---|
| 44 |
|
---|
[18] | 45 |
|
---|
| 46 | struct SDHeader {
|
---|
| 47 | Int nchan;
|
---|
| 48 | Int npol;
|
---|
| 49 | Int nif;
|
---|
| 50 | Int nbeam;
|
---|
| 51 | String observer;
|
---|
| 52 | String project;
|
---|
| 53 | String obstype;
|
---|
| 54 | String antennaname;
|
---|
| 55 | Vector<Double> antennaposition;
|
---|
| 56 | Float equinox;
|
---|
| 57 | String freqref;
|
---|
| 58 | Double reffreq;
|
---|
| 59 | Double bandwidth;
|
---|
| 60 | Double utc;
|
---|
| 61 | void print() const ;
|
---|
| 62 | };
|
---|
| 63 |
|
---|
[2] | 64 | class SDFrequencyTable {
|
---|
| 65 |
|
---|
| 66 | public:
|
---|
| 67 |
|
---|
[34] | 68 | SDFrequencyTable() : nFreq_(0) {;}
|
---|
| 69 | virtual ~SDFrequencyTable() {;}
|
---|
| 70 |
|
---|
| 71 | Int length() const { return nFreq_;};// # of stored Frequencies
|
---|
| 72 |
|
---|
| 73 | Double referencePixel(uInt which) const { return refPix_[which];}
|
---|
| 74 | Double referenceValue(uInt which) const { return refVal_[which];}
|
---|
| 75 | Double increment(uInt which) const { return increment_[which];}
|
---|
| 76 | Float equinox() const { return equinox_; }
|
---|
| 77 | String refFrame() const { return refFrame_; }
|
---|
| 78 |
|
---|
[2] | 79 | // returns the index into the table
|
---|
| 80 | // this creates a new one or returns an existing one
|
---|
[34] | 81 | Int addFrequency(Int refPix, Double refVal, Double inc);
|
---|
| 82 | void setEquinox(Float eq) { equinox_ = eq; }
|
---|
| 83 | void setRefFrame(const String& reff) { refFrame_ = reff; }
|
---|
[2] | 84 |
|
---|
| 85 | private:
|
---|
| 86 | Int nFreq_;
|
---|
[34] | 87 | Vector<Double> refPix_;
|
---|
| 88 | Vector<Double> refVal_;
|
---|
| 89 | Vector<Double> increment_;
|
---|
| 90 | Float equinox_;
|
---|
| 91 | String refFrame_;
|
---|
[2] | 92 | };
|
---|
| 93 |
|
---|
| 94 |
|
---|
| 95 | class SDContainer {
|
---|
| 96 |
|
---|
| 97 | public:
|
---|
[16] | 98 | SDContainer(uInt nBeam, uInt nIF, uInt nPol, uInt nChan);
|
---|
| 99 | SDContainer(IPosition shp);
|
---|
[2] | 100 |
|
---|
| 101 | virtual ~SDContainer();
|
---|
| 102 |
|
---|
| 103 | Bool setSpectrum(const Matrix<Float>& spec,
|
---|
| 104 | uInt whichBeam, uInt whichIF);
|
---|
| 105 | Bool putSpectrum(const Array<Float>& spec);
|
---|
| 106 |
|
---|
| 107 | Bool setFlags(const Matrix<uChar>& flgs,
|
---|
| 108 | uInt whichBeam, uInt whichIF);
|
---|
| 109 | Bool putFlags(const Array<uChar>& spec);
|
---|
| 110 |
|
---|
| 111 | Bool setTsys(const Vector<Float>& ts,
|
---|
| 112 | uInt whichBeam, uInt whichIF);
|
---|
| 113 | Bool putTsys(const Array<Float>& spec);
|
---|
| 114 |
|
---|
| 115 | Bool setPointing(const Vector<Double>& point, uInt whichBeam) {;}
|
---|
| 116 |
|
---|
[34] | 117 | Bool setFrequencyMap(uInt freqslot, uInt whichIF);
|
---|
| 118 | Bool putFreqMap(const Vector<uInt>& freqs);
|
---|
[2] | 119 |
|
---|
[34] | 120 | const Array<Float>& getSpectrum(uInt whichBeam, uInt whichIF) const;
|
---|
| 121 | const Array<uChar>& getFlags(uInt whichBeam, uInt whichIF) const;
|
---|
| 122 | const Array<Float>& getTsys(uInt whichBeam, uInt whichIF) const;
|
---|
| 123 |
|
---|
[2] | 124 | const Array<Float>& getSpectrum() const { return spectrum_; }
|
---|
| 125 | const Array<uChar>& getFlags() const { return flags_; }
|
---|
| 126 | const Array<Float>& getTsys() const { return tsys_; }
|
---|
| 127 |
|
---|
[34] | 128 | const Vector<uInt>& getFreqMap() const { return freqidx_; }
|
---|
| 129 |
|
---|
[2] | 130 | Double timestamp;
|
---|
| 131 | String sourcename;
|
---|
| 132 | Double interval;
|
---|
[26] | 133 | Int scanid;
|
---|
[2] | 134 |
|
---|
| 135 | private:
|
---|
[16] | 136 | uInt nBeam_,nIF_,nPol_,nChan_;
|
---|
[2] | 137 |
|
---|
[16] | 138 | // (nBeam,nIF,nPol,nChannel)
|
---|
[2] | 139 | Array<Float> spectrum_;
|
---|
| 140 | Array<uChar> flags_;
|
---|
[16] | 141 | // (nBeam,nIF,nPol,[nChannel]) Tsys is not really a function of
|
---|
[7] | 142 | // channel, but this makes it easier to work with at the expense of
|
---|
| 143 | // a little memory
|
---|
[2] | 144 | Array<Float> tsys_;
|
---|
| 145 | Array<Float> tcal_;
|
---|
| 146 |
|
---|
| 147 | //(nBeam) maybe use Measures here...
|
---|
| 148 | //*** Vector<Vector<Double>> pointing_;
|
---|
| 149 | //(nIF) indx into "global" frequency table
|
---|
| 150 | Vector<uInt> freqidx_;
|
---|
| 151 |
|
---|
| 152 | };
|
---|
| 153 |
|
---|
| 154 | } // namespace
|
---|
| 155 | #endif
|
---|