source: trunk/src/SDContainer.h@ 318

Last change on this file since 318 was 314, checked in by kil064, 20 years ago

add a missing ; :-(

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 6.3 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 casa::String fluxunit;
62 casa::String epoch;
63 void print() const ;
64};
65
66class SDFrequencyTable {
67
68public:
69
70 SDFrequencyTable() : nFreq_(0) {;}
71 virtual ~SDFrequencyTable() {;}
72
73 casa::Int length() const { return nFreq_;};// # of stored Frequencies
74 void setLength(casa::Int length) {nFreq_ = length;};
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_; }
80 void restFrequencies(casa::Vector<casa::Double>& rfs,
81 casa::String& rfunit ) const ;
82
83 // returns the index into the table
84 // this creates a new one or returns an existing one
85 casa::Int addFrequency(casa::Double 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; }
89 void addRestFrequency(casa::Double);
90 void setRestFrequencyUnit(const casa::String& theunit) {
91 restFreqUnit_ = theunit;
92 };
93
94private:
95 casa::Int nFreq_;
96 casa::Vector<casa::Double> refPix_;
97 casa::Vector<casa::Double> refVal_; // Hz
98 casa::Vector<casa::Double> increment_; // Hz
99 casa::Float equinox_;
100 casa::String refFrame_;
101 casa::Vector<casa::Double> restFreqs_; // Hz
102 casa::String restFreqUnit_;
103};
104
105
106class SDContainer {
107
108public:
109 SDContainer(casa::uInt nBeam, casa::uInt nIF, casa::uInt nPol,
110 casa::uInt nChan);
111 SDContainer(casa::IPosition shp);
112
113 virtual ~SDContainer();
114
115 casa::Bool resize(casa::IPosition shp);
116
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);
120
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);
124
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);
128
129 casa::Bool setDirection(const casa::Vector<casa::Double>& point,
130 casa::uInt whichBeam);
131 casa::Bool putDirection(const casa::Array<casa::Double>& dir);
132
133 casa::Bool setFrequencyMap(casa::uInt freqslot, casa::uInt whichIF);
134 casa::Bool putFreqMap(const casa::Vector<casa::uInt>& freqs);
135
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;
143
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_; }
148
149 const casa::Vector<casa::uInt>& getFreqMap() const { return freqidx_; }
150
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
155 casa::Double timestamp;
156 //Double bandwidth;
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;
167
168private:
169 casa::uInt nBeam_,nIF_,nPol_,nChan_;
170
171 // (nBeam,nIF,nPol,nChannel)
172 casa::Array<casa::Float> spectrum_;
173 casa::Array<casa::uChar> flags_;
174 // (nBeam,nIF,nPol,[nChannel]) Tsys is not really a function of
175 // channel, but this makes it easier to work with at the expense of
176 // a little memory
177 casa::Array<casa::Float> tsys_;
178 casa::Array<casa::Float> tcal_;
179
180 //(nIF) indx into "global" frequency table
181 casa::Vector<casa::uInt> freqidx_;
182 //(nBeam,2) maybe use Measures here...
183 casa::Array<casa::Double> direction_;
184 casa::Vector<casa::String> history_;
185
186};
187
188} // namespace
189#endif
Note: See TracBrowser for help on using the repository browser.