source: trunk/src/STHeader.cpp @ 1439

Last change on this file since 1439 was 1439, checked in by Malte Marquarding, 16 years ago

added Header diff function. Don't use obstype for conformance test

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