source: trunk/src/STHeader.cpp@ 2136

Last change on this file since 2136 was 1819, checked in by Kana Sugimoto, 14 years ago

New Development: No

JIRA Issue: No (merge alma branch to trunk)

Ready for Test: Yes

Interface Changes: No

Test Programs: regressions may work

Module(s): all single dish modules

Description:

Merged all changes in alma (r1386:1818) and newfiller (r1774:1818) branch.


  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.7 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#include <casa/Logging/LogIO.h>
40
41#include <sstream>
42
43#include "STDefs.h"
44#include "STHeader.h"
45
46using namespace casa;
47using namespace asap;
48
49
50
51bool STHeader::conformant( const STHeader& other )
52{
53 bool conforms;
54 conforms = (this->antennaname == other.antennaname
55 && this->equinox == other.equinox
56 && this->fluxunit == other.fluxunit
57 );
58 return conforms;
59}
60
61String STHeader::diff( const STHeader& other )
62{
63 ostringstream thediff;
64 if ( this->equinox != other.equinox ) {
65 thediff << "Equinox: " << this->equinox << " <-> "
66 << other.equinox << endl;
67 }
68 if ( this->obstype != other.obstype ) {
69 thediff << "Obs. Type: " << this->obstype << " <-> "
70 << other.obstype << endl;
71 }
72 if ( this->fluxunit != other.fluxunit ) {
73 thediff << "Flux unit: " << this->fluxunit << " <-> "
74 << other.fluxunit << endl;
75 }
76 return String(thediff);
77}
78
79void STHeader::print() const {
80 MVTime mvt(this->utc);
81 mvt.setFormat(MVTime::YMD);
82// cout << "Observer: " << this->observer << endl
83// << "Project: " << this->project << endl
84// << "Obstype: " << this->obstype << endl
85// << "Antenna: " << this->antennaname << endl
86// << "Ant. Position: " << this->antennaposition << endl
87// << "Equinox: " << this->equinox << endl
88// << "Freq. ref.: " << this->freqref << endl
89// << "Ref. frequency: " << this->reffreq << endl
90// << "Bandwidth: " << this->bandwidth << endl
91// << "Time (utc): "
92// << mvt
93// << endl;
94 LogIO os( LogOrigin( "STHeader", "print()", WHERE ) ) ;
95 os << "Observer: " << this->observer << endl
96 << "Project: " << this->project << endl
97 << "Obstype: " << this->obstype << endl
98 << "Antenna: " << this->antennaname << endl
99 << "Ant. Position: " << this->antennaposition << endl
100 << "Equinox: " << this->equinox << endl
101 << "Freq. ref.: " << this->freqref << endl
102 << "Ref. frequency: " << this->reffreq << endl
103 << "Bandwidth: " << this->bandwidth << endl
104 << "Time (utc): "
105 << mvt
106 << LogIO::POST ;
107 //setprecision(10) << this->utc << endl;
108}
109
110// SDDataDesc
111
112uInt SDDataDesc::addEntry(const String& source, uInt ID,
113 const MDirection& dir, uInt secID)
114{
115
116// See if already exists
117
118 if (n_ > 0) {
119 for (uInt i=0; i<n_; i++) {
120 if (source==source_[i] && ID==ID_[i]) {
121 return i;
122 }
123 }
124 }
125
126// Not found - add it
127
128 n_ += 1;
129 source_.resize(n_,True);
130 ID_.resize(n_,True);
131 secID_.resize(n_,True);
132 secDir_.resize(n_,True,True);
133//
134 source_[n_-1] = source;
135 ID_[n_-1] = ID;
136 secID_[n_-1] = secID;
137 secDir_[n_-1] = dir;
138//
139 return n_-1;
140}
141
142void SDDataDesc::summary() const
143{
144 if (n_>0) {
145// cerr << "Source ID" << endl;
146// for (uInt i=0; i<n_; i++) {
147// cout << setw(11) << source_(i) << ID_(i) << endl;
148 LogIO os( LogOrigin( "SDDataDesc", "summary()", WHERE ) ) ;
149 ostringstream oss ;
150 oss << "Source ID" << endl;
151 for (uInt i=0; i<n_; i++) {
152 oss << setw(11) << source_(i) << ID_(i) << endl;
153 }
154 os << oss.str() << LogIO::POST ;
155 }
156}
157
Note: See TracBrowser for help on using the repository browser.