source: trunk/src/SDContainer.h@ 127

Last change on this file since 127 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
Line 
1//#---------------------------------------------------------------------------
2//# SDContainer.h: A container class for single dish integrations
3//#---------------------------------------------------------------------------
4//# Copyright (C) 2004
5//# 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
34#include <vector>
35
36#include <casa/aips.h>
37#include <casa/BasicSL/String.h>
38#include <casa/Arrays/Array.h>
39#include <casa/Arrays/Vector.h>
40
41template<class T> class casa::Matrix;
42
43namespace asap {
44
45
46struct SDHeader {
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;
61 void print() const ;
62};
63
64class SDFrequencyTable {
65
66public:
67
68 SDFrequencyTable() : nFreq_(0) {;}
69 virtual ~SDFrequencyTable() {;}
70
71 casa::Int length() const { return nFreq_;};// # of stored Frequencies
72
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_; }
78
79 // returns the index into the table
80 // this creates a new one or returns an existing one
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; }
85
86private:
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_;
93};
94
95
96class SDContainer {
97
98public:
99 SDContainer(casa::uInt nBeam, casa::uInt nIF, casa::uInt nPol,
100 casa::uInt nChan);
101 SDContainer(casa::IPosition shp);
102
103 virtual ~SDContainer();
104
105 casa::Bool resize(casa::IPosition shp);
106
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);
110
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);
114
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);
118
119 casa::Bool setDirection(const casa::Vector<casa::Double>& point,
120 casa::uInt whichBeam);
121 casa::Bool putDirection(const casa::Array<casa::Double>& dir);
122
123 casa::Bool setFrequencyMap(casa::uInt freqslot, casa::uInt whichIF);
124 casa::Bool putFreqMap(const casa::Vector<casa::uInt>& freqs);
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;
133
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_; }
138
139 const casa::Vector<casa::uInt>& getFreqMap() const { return freqidx_; }
140
141 casa::Double timestamp;
142 //Double bandwidth;
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;
153
154private:
155 casa::uInt nBeam_,nIF_,nPol_,nChan_;
156
157 // (nBeam,nIF,nPol,nChannel)
158 casa::Array<casa::Float> spectrum_;
159 casa::Array<casa::uChar> flags_;
160 // (nBeam,nIF,nPol,[nChannel]) Tsys is not really a function of
161 // channel, but this makes it easier to work with at the expense of
162 // a little memory
163 casa::Array<casa::Float> tsys_;
164 casa::Array<casa::Float> tcal_;
165
166 //(nIF) indx into "global" frequency table
167 casa::Vector<casa::uInt> freqidx_;
168 //(nBeam,2) maybe use Measures here...
169 casa::Array<casa::Double> direction_;
170
171};
172
173} // namespace
174#endif
Note: See TracBrowser for help on using the repository browser.