source: trunk/src/STHeader.cpp@ 2424

Last change on this file since 2424 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
RevLine 
[2]1//#---------------------------------------------------------------------------
[901]2//# STHeader.cpp: A container class for single dish integrations
[2]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//#---------------------------------------------------------------------------
[349]31
[125]32#include <casa/aips.h>
[327]33#include <casa/iostream.h>
34#include <casa/iomanip.h>
[104]35#include <casa/Exceptions.h>
[349]36#include <casa/Utilities/Assert.h>
[81]37#include <casa/Arrays/IPosition.h>
38#include <casa/Quanta/MVTime.h>
[1819]39#include <casa/Logging/LogIO.h>
[2]40
[1819]41#include <sstream>
[308]42
[832]43#include "STDefs.h"
[901]44#include "STHeader.h"
[2]45
[125]46using namespace casa;
[83]47using namespace asap;
[2]48
[838]49
50
[901]51bool STHeader::conformant( const STHeader& other )
[838]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
[1439]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
[901]79void STHeader::print() const {
[18]80 MVTime mvt(this->utc);
[47]81 mvt.setFormat(MVTime::YMD);
[1819]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 ;
[18]107 //setprecision(10) << this->utc << endl;
108}
109
[349]110// SDDataDesc
111
[832]112uInt SDDataDesc::addEntry(const String& source, uInt ID,
[453]113 const MDirection& dir, uInt secID)
[326]114{
115
116// See if already exists
117
118 if (n_ > 0) {
119 for (uInt i=0; i<n_; i++) {
[396]120 if (source==source_[i] && ID==ID_[i]) {
[326]121 return i;
122 }
123 }
124 }
125
126// Not found - add it
127
128 n_ += 1;
129 source_.resize(n_,True);
[396]130 ID_.resize(n_,True);
131 secID_.resize(n_,True);
132 secDir_.resize(n_,True,True);
[326]133//
134 source_[n_-1] = source;
[396]135 ID_[n_-1] = ID;
136 secID_[n_-1] = secID;
137 secDir_[n_-1] = dir;
[326]138//
139 return n_-1;
140}
141
142void SDDataDesc::summary() const
143{
[396]144 if (n_>0) {
[1819]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 ;
[326]155 }
156}
[453]157
Note: See TracBrowser for help on using the repository browser.