[2] | 1 | //#--------------------------------------------------------------------------- |
---|
| 2 | //# SDContainer.cc: A container class for single dish integrations |
---|
| 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" |
---|
[2] | 43 | #include "SDContainer.h" |
---|
| 44 | |
---|
[125] | 45 | using namespace casa; |
---|
[83] | 46 | using namespace asap; |
---|
[2] | 47 | |
---|
[18] | 48 | void SDHeader::print() const { |
---|
| 49 | MVTime mvt(this->utc); |
---|
[47] | 50 | mvt.setFormat(MVTime::YMD); |
---|
[832] | 51 | cout << "Observer: " << this->observer << endl |
---|
[18] | 52 | << "Project: " << this->project << endl |
---|
| 53 | << "Obstype: " << this->obstype << endl |
---|
| 54 | << "Antenna: " << this->antennaname << endl |
---|
| 55 | << "Ant. Position: " << this->antennaposition << endl |
---|
| 56 | << "Equinox: " << this->equinox << endl |
---|
| 57 | << "Freq. ref.: " << this->freqref << endl |
---|
| 58 | << "Ref. frequency: " << this->reffreq << endl |
---|
| 59 | << "Bandwidth: " << this->bandwidth << endl |
---|
[832] | 60 | << "Time (utc): " |
---|
[47] | 61 | << mvt |
---|
[18] | 62 | << endl; |
---|
| 63 | //setprecision(10) << this->utc << endl; |
---|
| 64 | } |
---|
| 65 | |
---|
[349] | 66 | // SDDataDesc |
---|
| 67 | |
---|
[832] | 68 | uInt SDDataDesc::addEntry(const String& source, uInt ID, |
---|
[453] | 69 | const MDirection& dir, uInt secID) |
---|
[326] | 70 | { |
---|
| 71 | |
---|
| 72 | // See if already exists |
---|
| 73 | |
---|
| 74 | if (n_ > 0) { |
---|
| 75 | for (uInt i=0; i<n_; i++) { |
---|
[396] | 76 | if (source==source_[i] && ID==ID_[i]) { |
---|
[326] | 77 | return i; |
---|
| 78 | } |
---|
| 79 | } |
---|
| 80 | } |
---|
| 81 | |
---|
| 82 | // Not found - add it |
---|
| 83 | |
---|
| 84 | n_ += 1; |
---|
| 85 | source_.resize(n_,True); |
---|
[396] | 86 | ID_.resize(n_,True); |
---|
| 87 | secID_.resize(n_,True); |
---|
| 88 | secDir_.resize(n_,True,True); |
---|
[326] | 89 | // |
---|
| 90 | source_[n_-1] = source; |
---|
[396] | 91 | ID_[n_-1] = ID; |
---|
| 92 | secID_[n_-1] = secID; |
---|
| 93 | secDir_[n_-1] = dir; |
---|
[326] | 94 | // |
---|
| 95 | return n_-1; |
---|
| 96 | } |
---|
| 97 | |
---|
| 98 | void SDDataDesc::summary() const |
---|
| 99 | { |
---|
[396] | 100 | if (n_>0) { |
---|
[832] | 101 | cerr << "Source ID" << endl; |
---|
[396] | 102 | for (uInt i=0; i<n_; i++) { |
---|
[414] | 103 | cout << setw(11) << source_(i) << ID_(i) << endl; |
---|
[396] | 104 | } |
---|
[326] | 105 | } |
---|
| 106 | } |
---|
[453] | 107 | |
---|