source: trunk/src/SDContainer.h@ 136

Last change on this file since 136 was 125, checked in by mar637, 20 years ago

Moved to casa namespace.
Adjusted the copyright to be ATNF.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.6 KB
RevLine 
[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]41template<class T> class casa::Matrix;
[2]42
[83]43namespace asap {
[2]44
[18]45
46struct 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;
[18]61 void print() const ;
62};
63
[2]64class SDFrequencyTable {
65
66public:
67
[34]68 SDFrequencyTable() : nFreq_(0) {;}
69 virtual ~SDFrequencyTable() {;}
70
[125]71 casa::Int length() const { return nFreq_;};// # of stored Frequencies
[34]72
[125]73 casa::Double referencePixel(casa::uInt which) const { return refPix_[which];}
74 casa::Double referenceValue(casa::uInt which) const { return refVal_[which];}
75 casa::Double increment(casa::uInt which) const { return increment_[which];}
76 casa::Float equinox() const { return equinox_; }
77 casa::String refFrame() const { return refFrame_; }
[34]78
[2]79 // returns the index into the table
80 // this creates a new one or returns an existing one
[125]81 casa::Int addFrequency(casa::Int refPix, casa::Double refVal,
82 casa::Double inc);
83 void setEquinox(casa::Float eq) { equinox_ = eq; }
84 void setRefFrame(const casa::String& reff) { refFrame_ = reff; }
[2]85
86private:
[125]87 casa::Int nFreq_;
88 casa::Vector<casa::Double> refPix_;
89 casa::Vector<casa::Double> refVal_;
90 casa::Vector<casa::Double> increment_;
91 casa::Float equinox_;
92 casa::String refFrame_;
[2]93};
94
95
96class SDContainer {
97
98public:
[125]99 SDContainer(casa::uInt nBeam, casa::uInt nIF, casa::uInt nPol,
100 casa::uInt nChan);
101 SDContainer(casa::IPosition shp);
[2]102
103 virtual ~SDContainer();
104
[125]105 casa::Bool resize(casa::IPosition shp);
[47]106
[125]107 casa::Bool setSpectrum(const casa::Matrix<casa::Float>& spec,
108 casa::uInt whichBeam, casa::uInt whichIF);
109 casa::Bool putSpectrum(const casa::Array<casa::Float>& spec);
[2]110
[125]111 casa::Bool setFlags(const casa::Matrix<casa::uChar>& flgs,
112 casa::uInt whichBeam, casa::uInt whichIF);
113 casa::Bool putFlags(const casa::Array<casa::uChar>& spec);
[2]114
[125]115 casa::Bool setTsys(const casa::Vector<casa::Float>& ts,
116 casa::uInt whichBeam, casa::uInt whichIF);
117 casa::Bool putTsys(const casa::Array<casa::Float>& spec);
[2]118
[125]119 casa::Bool setDirection(const casa::Vector<casa::Double>& point,
120 casa::uInt whichBeam);
121 casa::Bool putDirection(const casa::Array<casa::Double>& dir);
[2]122
[125]123 casa::Bool setFrequencyMap(casa::uInt freqslot, casa::uInt whichIF);
124 casa::Bool putFreqMap(const casa::Vector<casa::uInt>& freqs);
[2]125
[125]126 casa::Array<casa::Float> getSpectrum(casa::uInt whichBeam,
127 casa::uInt whichIF) const;
128 casa::Array<casa::uChar> getFlags(casa::uInt whichBeam,
129 casa::uInt whichIF) const;
130 casa::Array<casa::Float> getTsys(casa::uInt whichBeam,
131 casa::uInt whichIF) const;
132 casa::Array<casa::Double> getDirection(casa::uInt whichBeam) const;
[34]133
[125]134 const casa::Array<casa::Float>& getSpectrum() const { return spectrum_; }
135 const casa::Array<casa::uChar>& getFlags() const { return flags_; }
136 const casa::Array<casa::Float>& getTsys() const { return tsys_; }
137 const casa::Array<casa::Double>& getDirection() const { return direction_; }
[2]138
[125]139 const casa::Vector<casa::uInt>& getFreqMap() const { return freqidx_; }
[79]140
[125]141 casa::Double timestamp;
[104]142 //Double bandwidth;
[125]143 casa::String sourcename;
144 casa::String fieldname;
145 casa::Double interval;
146 casa::Int scanid;
147 casa::Vector<casa::Float> tcal;
148 casa::String tcaltime;
149 casa::Float azimuth;
150 casa::Float elevation;
151 casa::Float parangle;
152 casa::Int refbeam;
[104]153
[2]154private:
[125]155 casa::uInt nBeam_,nIF_,nPol_,nChan_;
[2]156
[16]157 // (nBeam,nIF,nPol,nChannel)
[125]158 casa::Array<casa::Float> spectrum_;
159 casa::Array<casa::uChar> flags_;
[16]160 // (nBeam,nIF,nPol,[nChannel]) Tsys is not really a function of
[7]161 // channel, but this makes it easier to work with at the expense of
162 // a little memory
[125]163 casa::Array<casa::Float> tsys_;
164 casa::Array<casa::Float> tcal_;
[2]165
166 //(nIF) indx into "global" frequency table
[125]167 casa::Vector<casa::uInt> freqidx_;
[79]168 //(nBeam,2) maybe use Measures here...
[125]169 casa::Array<casa::Double> direction_;
[2]170
171};
172
173} // namespace
174#endif
Note: See TracBrowser for help on using the repository browser.