source: trunk/src/STHeader.cpp@ 1305

Last change on this file since 1305 was 901, checked in by mar637, 19 years ago

SDContainer -> STHeader

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.3 KB
Line 
1//#---------------------------------------------------------------------------
2//# STHeader.cpp: 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
32#include <casa/aips.h>
33#include <casa/iostream.h>
34#include <casa/iomanip.h>
35#include <casa/Exceptions.h>
36#include <casa/Utilities/Assert.h>
37#include <casa/Arrays/IPosition.h>
38#include <casa/Quanta/MVTime.h>
39
40
41
42#include "STDefs.h"
43#include "STHeader.h"
44
45using namespace casa;
46using namespace asap;
47
48
49
50bool STHeader::conformant( const STHeader& other )
51{
52 bool conforms;
53 conforms = (this->antennaname == other.antennaname
54 && this->equinox == other.equinox
55 && this->obstype == other.obstype
56 && this->fluxunit == other.fluxunit
57 );
58 return conforms;
59}
60
61void STHeader::print() const {
62 MVTime mvt(this->utc);
63 mvt.setFormat(MVTime::YMD);
64 cout << "Observer: " << this->observer << endl
65 << "Project: " << this->project << endl
66 << "Obstype: " << this->obstype << endl
67 << "Antenna: " << this->antennaname << endl
68 << "Ant. Position: " << this->antennaposition << endl
69 << "Equinox: " << this->equinox << endl
70 << "Freq. ref.: " << this->freqref << endl
71 << "Ref. frequency: " << this->reffreq << endl
72 << "Bandwidth: " << this->bandwidth << endl
73 << "Time (utc): "
74 << mvt
75 << endl;
76 //setprecision(10) << this->utc << endl;
77}
78
79// SDDataDesc
80
81uInt SDDataDesc::addEntry(const String& source, uInt ID,
82 const MDirection& dir, uInt secID)
83{
84
85// See if already exists
86
87 if (n_ > 0) {
88 for (uInt i=0; i<n_; i++) {
89 if (source==source_[i] && ID==ID_[i]) {
90 return i;
91 }
92 }
93 }
94
95// Not found - add it
96
97 n_ += 1;
98 source_.resize(n_,True);
99 ID_.resize(n_,True);
100 secID_.resize(n_,True);
101 secDir_.resize(n_,True,True);
102//
103 source_[n_-1] = source;
104 ID_[n_-1] = ID;
105 secID_[n_-1] = secID;
106 secDir_[n_-1] = dir;
107//
108 return n_-1;
109}
110
111void SDDataDesc::summary() const
112{
113 if (n_>0) {
114 cerr << "Source ID" << endl;
115 for (uInt i=0; i<n_; i++) {
116 cout << setw(11) << source_(i) << ID_(i) << endl;
117 }
118 }
119}
120
Note: See TracBrowser for help on using the repository browser.