[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 | //#---------------------------------------------------------------------------
|
---|
[125] | 31 | #include <casa/aips.h>
|
---|
[327] | 32 | #include <casa/iostream.h>
|
---|
| 33 | #include <casa/iomanip.h>
|
---|
[104] | 34 | #include <casa/Exceptions.h>
|
---|
[81] | 35 | #include <tables/Tables/Table.h>
|
---|
| 36 | #include <casa/Arrays/IPosition.h>
|
---|
[125] | 37 | #include <casa/Arrays/Matrix.h>
|
---|
[81] | 38 | #include <casa/Arrays/ArrayAccessor.h>
|
---|
[308] | 39 | #include <casa/BasicMath/Math.h>
|
---|
[81] | 40 | #include <casa/Quanta/MVTime.h>
|
---|
[2] | 41 |
|
---|
[308] | 42 |
|
---|
[215] | 43 | #include "SDDefs.h"
|
---|
[2] | 44 | #include "SDContainer.h"
|
---|
| 45 |
|
---|
[125] | 46 | using namespace casa;
|
---|
[83] | 47 | using namespace asap;
|
---|
[2] | 48 |
|
---|
[18] | 49 | void SDHeader::print() const {
|
---|
| 50 | MVTime mvt(this->utc);
|
---|
[47] | 51 | mvt.setFormat(MVTime::YMD);
|
---|
[18] | 52 | cout << "Observer: " << this->observer << endl
|
---|
| 53 | << "Project: " << this->project << endl
|
---|
| 54 | << "Obstype: " << this->obstype << endl
|
---|
| 55 | << "Antenna: " << this->antennaname << endl
|
---|
| 56 | << "Ant. Position: " << this->antennaposition << endl
|
---|
| 57 | << "Equinox: " << this->equinox << endl
|
---|
| 58 | << "Freq. ref.: " << this->freqref << endl
|
---|
| 59 | << "Ref. frequency: " << this->reffreq << endl
|
---|
| 60 | << "Bandwidth: " << this->bandwidth << endl
|
---|
| 61 | << "Time (utc): "
|
---|
[47] | 62 | << mvt
|
---|
[18] | 63 | << endl;
|
---|
| 64 | //setprecision(10) << this->utc << endl;
|
---|
| 65 | }
|
---|
| 66 |
|
---|
| 67 |
|
---|
[16] | 68 | SDContainer::SDContainer(uInt nBeam, uInt nIF, uInt nPol, uInt nChan)
|
---|
[2] | 69 | : nBeam_(nBeam),
|
---|
[16] | 70 | nIF_(nIF),
|
---|
| 71 | nPol_(nPol),
|
---|
| 72 | nChan_(nChan),
|
---|
| 73 | spectrum_(IPosition(4,nBeam,nIF,nPol,nChan)),
|
---|
| 74 | flags_(IPosition(4,nBeam,nIF,nPol,nChan)),
|
---|
[34] | 75 | tsys_(IPosition(4,nBeam,nIF,nPol,nChan)),
|
---|
[79] | 76 | freqidx_(nIF),
|
---|
| 77 | direction_(IPosition(2,nBeam,2)) {
|
---|
[2] | 78 | uChar x = 0;
|
---|
| 79 | flags_ = ~x;
|
---|
[104] | 80 | tcal.resize(2);
|
---|
[2] | 81 | }
|
---|
| 82 |
|
---|
[16] | 83 | SDContainer::SDContainer(IPosition shp)
|
---|
| 84 | : nBeam_(shp(0)),
|
---|
| 85 | nIF_(shp(1)),
|
---|
| 86 | nPol_(shp(2)),
|
---|
| 87 | nChan_(shp(3)),
|
---|
| 88 | spectrum_(shp),
|
---|
| 89 | flags_(shp),
|
---|
[34] | 90 | tsys_(shp),
|
---|
[79] | 91 | freqidx_(shp(1)) {
|
---|
| 92 | IPosition ip(2,shp(0),2);
|
---|
| 93 | direction_.resize(ip);
|
---|
[16] | 94 | uChar x = 0;
|
---|
| 95 | flags_ = ~x;
|
---|
[104] | 96 | tcal.resize(2);
|
---|
[16] | 97 | }
|
---|
| 98 |
|
---|
[2] | 99 | SDContainer::~SDContainer() {
|
---|
| 100 | }
|
---|
| 101 |
|
---|
[47] | 102 | Bool SDContainer::resize(IPosition shp) {
|
---|
| 103 | nBeam_ = shp(0);
|
---|
| 104 | nIF_ = shp(1);
|
---|
| 105 | nPol_ = shp(2);
|
---|
| 106 | nChan_ = shp(3);
|
---|
| 107 | spectrum_.resize(shp);
|
---|
| 108 | flags_.resize(shp);
|
---|
| 109 | tsys_.resize(shp);
|
---|
| 110 | freqidx_.resize(shp(1));
|
---|
[79] | 111 | IPosition ip(2,shp(0),2);
|
---|
| 112 | direction_.resize(ip);
|
---|
[47] | 113 | }
|
---|
| 114 |
|
---|
[2] | 115 | Bool SDContainer::putSpectrum(const Array<Float>& spec) {
|
---|
| 116 | spectrum_ = spec;
|
---|
| 117 | }
|
---|
[7] | 118 | Bool SDContainer::putFlags(const Array<uChar>& flag) {
|
---|
| 119 | flags_ = flag;
|
---|
[2] | 120 | }
|
---|
[7] | 121 | Bool SDContainer::putTsys(const Array<Float>& tsys) {
|
---|
| 122 | tsys_ = tsys;
|
---|
[2] | 123 | }
|
---|
| 124 |
|
---|
| 125 | Bool SDContainer::setSpectrum(const Matrix<Float>& spec,
|
---|
| 126 | uInt whichBeam, uInt whichIF) {
|
---|
| 127 |
|
---|
[204] | 128 | ArrayAccessor<Float, Axis<asap::BeamAxis> > aa0(spectrum_);
|
---|
[2] | 129 | aa0.reset(aa0.begin(whichBeam));
|
---|
[204] | 130 | ArrayAccessor<Float, Axis<asap::IFAxis> > aa1(aa0);
|
---|
[2] | 131 | aa1.reset(aa1.begin(whichIF));
|
---|
| 132 |
|
---|
[14] | 133 | //Vector<Float> pols(nPol);
|
---|
[204] | 134 | ArrayAccessor<Float, Axis<asap::IFAxis> > j(spec);
|
---|
[14] | 135 | IPosition shp0 = spectrum_.shape();
|
---|
| 136 | IPosition shp1 = spec.shape();
|
---|
[16] | 137 | if ( (shp0(2) != shp1(1)) || (shp0(3) != shp1(0)) ) {
|
---|
[104] | 138 | throw(AipsError("Arrays not conformant"));
|
---|
[14] | 139 | return False;
|
---|
| 140 | }
|
---|
[2] | 141 | // assert dimensions are the same....
|
---|
[204] | 142 | for (ArrayAccessor<Float, Axis<asap::PolAxis> > i(aa1);i != i.end(); ++i) {
|
---|
| 143 | ArrayAccessor<Float, Axis<asap::BeamAxis> > jj(j);
|
---|
| 144 | for (ArrayAccessor<Float, Axis<asap::ChanAxis> > ii(i);ii != ii.end(); ++ii) {
|
---|
[14] | 145 | (*ii) = (*jj);
|
---|
| 146 | jj++;
|
---|
[2] | 147 | }
|
---|
[14] | 148 | j++;
|
---|
[2] | 149 | }
|
---|
| 150 | // unset flags for this spectrum, they might be set again by the
|
---|
| 151 | // setFlags method
|
---|
[14] | 152 |
|
---|
[2] | 153 | IPosition shp = flags_.shape();
|
---|
| 154 | IPosition start(4,whichBeam,whichIF,0,0);
|
---|
| 155 | IPosition end(4,whichBeam,whichIF,shp(2)-1,shp(3)-1);
|
---|
| 156 | Array<uChar> arr(flags_(start,end));
|
---|
| 157 | arr = uChar(0);
|
---|
[336] | 158 | //
|
---|
| 159 | return True;
|
---|
[2] | 160 | }
|
---|
| 161 |
|
---|
| 162 | Bool SDContainer::setFlags(const Matrix<uChar>& flag,
|
---|
| 163 | uInt whichBeam, uInt whichIF) {
|
---|
| 164 |
|
---|
[204] | 165 | ArrayAccessor<uChar, Axis<asap::BeamAxis> > aa0(flags_);
|
---|
[2] | 166 | aa0.reset(aa0.begin(whichBeam));
|
---|
[204] | 167 | ArrayAccessor<uChar, Axis<asap::IFAxis> > aa1(aa0);
|
---|
[2] | 168 | aa1.reset(aa1.begin(whichIF));
|
---|
| 169 |
|
---|
[204] | 170 | ArrayAccessor<uChar, Axis<asap::IFAxis> > j(flag);
|
---|
[14] | 171 | IPosition shp0 = flags_.shape();
|
---|
| 172 | IPosition shp1 = flag.shape();
|
---|
[16] | 173 | if ( (shp0(2) != shp1(1)) || (shp0(3) != shp1(0)) ) {
|
---|
[14] | 174 | cerr << "Arrays not conformant" << endl;
|
---|
| 175 | return False;
|
---|
| 176 | }
|
---|
| 177 |
|
---|
[2] | 178 | // assert dimensions are the same....
|
---|
[204] | 179 | for (ArrayAccessor<uChar, Axis<asap::PolAxis> > i(aa1);i != i.end(); ++i) {
|
---|
| 180 | ArrayAccessor<uChar, Axis<asap::BeamAxis> > jj(j);
|
---|
| 181 | for (ArrayAccessor<uChar, Axis<asap::ChanAxis> > ii(i);ii != ii.end(); ++ii) {
|
---|
[14] | 182 | (*ii) = (*jj);
|
---|
| 183 | jj++;
|
---|
[2] | 184 | }
|
---|
[14] | 185 | j++;
|
---|
[2] | 186 | }
|
---|
[16] | 187 | return True;
|
---|
[2] | 188 | }
|
---|
| 189 |
|
---|
| 190 | Bool SDContainer::setTsys(const Vector<Float>& tsys,
|
---|
| 191 | uInt whichBeam, uInt whichIF) {
|
---|
[204] | 192 | ArrayAccessor<Float, Axis<asap::BeamAxis> > aa0(tsys_);
|
---|
[2] | 193 | aa0.reset(aa0.begin(whichBeam));
|
---|
[204] | 194 | ArrayAccessor<Float, Axis<asap::IFAxis> > aa1(aa0);
|
---|
[2] | 195 | aa1.reset(aa1.begin(whichIF));
|
---|
| 196 | // assert dimensions are the same....
|
---|
[204] | 197 | for (ArrayAccessor<Float, Axis<asap::ChanAxis> > i(aa1);i != i.end(); ++i) {
|
---|
| 198 | ArrayAccessor<Float, Axis<asap::BeamAxis> > j(tsys);
|
---|
| 199 | for (ArrayAccessor<Float, Axis<asap::PolAxis> > ii(i);ii != ii.end(); ++ii) {
|
---|
[14] | 200 | (*ii) = (*j);
|
---|
| 201 | j++;
|
---|
[7] | 202 | }
|
---|
| 203 | }
|
---|
[2] | 204 | }
|
---|
[27] | 205 |
|
---|
[125] | 206 | Array<Float> SDContainer::getSpectrum(uInt whichBeam, uInt whichIF) const
|
---|
| 207 | {
|
---|
[27] | 208 | Matrix<Float> spectra(nChan_, nPol_);
|
---|
| 209 |
|
---|
| 210 | // Beam.
|
---|
[204] | 211 | ArrayAccessor<Float, Axis<asap::BeamAxis> > i0(spectrum_);
|
---|
[27] | 212 | i0.reset(i0.begin(whichBeam));
|
---|
| 213 |
|
---|
| 214 | // IF.
|
---|
[204] | 215 | ArrayAccessor<Float, Axis<asap::IFAxis> > i1(i0);
|
---|
[27] | 216 | i1.reset(i1.begin(whichIF));
|
---|
| 217 |
|
---|
| 218 | // Polarization.
|
---|
[204] | 219 | ArrayAccessor<Float, Axis<asap::PolAxis> > i2(i1);
|
---|
| 220 | ArrayAccessor<Float, Axis<asap::IFAxis> > o1(spectra);
|
---|
[27] | 221 |
|
---|
| 222 | while (i2 != i2.end()) {
|
---|
| 223 | // Channel.
|
---|
[204] | 224 | ArrayAccessor<Float, Axis<asap::ChanAxis> > i3(i2);
|
---|
| 225 | ArrayAccessor<Float, Axis<asap::BeamAxis> > o0(o1);
|
---|
[27] | 226 |
|
---|
| 227 | while (i3 != i3.end()) {
|
---|
| 228 | *o0 = *i3;
|
---|
| 229 |
|
---|
| 230 | i3++;
|
---|
| 231 | o0++;
|
---|
| 232 | }
|
---|
| 233 |
|
---|
| 234 | i2++;
|
---|
| 235 | o1++;
|
---|
| 236 | }
|
---|
| 237 |
|
---|
[67] | 238 | return spectra.copy();
|
---|
[27] | 239 | }
|
---|
| 240 |
|
---|
[125] | 241 |
|
---|
[67] | 242 | Array<uChar> SDContainer::getFlags(uInt whichBeam, uInt whichIF) const
|
---|
[27] | 243 | {
|
---|
| 244 | Matrix<uChar> flagtra(nChan_, nPol_);
|
---|
| 245 |
|
---|
| 246 | // Beam.
|
---|
[204] | 247 | ArrayAccessor<uChar, Axis<asap::BeamAxis> > i0(flags_);
|
---|
[27] | 248 | i0.reset(i0.begin(whichBeam));
|
---|
| 249 |
|
---|
| 250 | // IF.
|
---|
[204] | 251 | ArrayAccessor<uChar, Axis<asap::IFAxis> > i1(i0);
|
---|
[27] | 252 | i1.reset(i1.begin(whichIF));
|
---|
| 253 |
|
---|
| 254 | // Polarization.
|
---|
[204] | 255 | ArrayAccessor<uChar, Axis<asap::PolAxis> > i2(i1);
|
---|
| 256 | ArrayAccessor<uChar, Axis<asap::IFAxis> > o1(flagtra);
|
---|
[27] | 257 |
|
---|
| 258 | while (i2 != i2.end()) {
|
---|
| 259 | // Channel.
|
---|
[204] | 260 | ArrayAccessor<uChar, Axis<asap::ChanAxis> > i3(i2);
|
---|
| 261 | ArrayAccessor<uChar, Axis<asap::BeamAxis> > o0(o1);
|
---|
[27] | 262 |
|
---|
| 263 | while (i3 != i3.end()) {
|
---|
| 264 | *o0 = *i3;
|
---|
| 265 |
|
---|
| 266 | i3++;
|
---|
| 267 | o0++;
|
---|
| 268 | }
|
---|
| 269 |
|
---|
| 270 | i2++;
|
---|
| 271 | o1++;
|
---|
| 272 | }
|
---|
| 273 |
|
---|
[67] | 274 | return flagtra.copy();
|
---|
[27] | 275 | }
|
---|
| 276 |
|
---|
[67] | 277 | Array<Float> SDContainer::getTsys(uInt whichBeam, uInt whichIF) const
|
---|
[27] | 278 | {
|
---|
| 279 | Vector<Float> tsys(nPol_);
|
---|
| 280 |
|
---|
| 281 | // Beam.
|
---|
[204] | 282 | ArrayAccessor<Float, Axis<asap::BeamAxis> > i0(tsys_);
|
---|
[27] | 283 | i0.reset(i0.begin(whichBeam));
|
---|
| 284 |
|
---|
| 285 | // IF.
|
---|
[204] | 286 | ArrayAccessor<Float, Axis<asap::IFAxis> > i1(i0);
|
---|
[27] | 287 | i1.reset(i1.begin(whichIF));
|
---|
| 288 |
|
---|
| 289 | // Channel.
|
---|
[204] | 290 | ArrayAccessor<Float, Axis<asap::ChanAxis> > i3(i1);
|
---|
[27] | 291 |
|
---|
| 292 | // Polarization.
|
---|
[204] | 293 | ArrayAccessor<Float, Axis<asap::PolAxis> > i2(i3);
|
---|
| 294 | ArrayAccessor<Float, Axis<asap::BeamAxis> > o0(tsys);
|
---|
[27] | 295 |
|
---|
| 296 | while (i2 != i2.end()) {
|
---|
| 297 | *o0 = *i2;
|
---|
| 298 |
|
---|
| 299 | i2++;
|
---|
| 300 | o0++;
|
---|
| 301 | }
|
---|
[67] | 302 | return tsys.copy();
|
---|
[27] | 303 | }
|
---|
[34] | 304 |
|
---|
[79] | 305 | Array<Double> SDContainer::getDirection(uInt whichBeam) const {
|
---|
| 306 | Vector<Double> direct(2);
|
---|
[204] | 307 | ArrayAccessor<Double, Axis<asap::BeamAxis> > i0(direction_);
|
---|
[79] | 308 | i0.reset(i0.begin(whichBeam));
|
---|
[204] | 309 | ArrayAccessor<Double, Axis<asap::BeamAxis> > o0(direct);
|
---|
| 310 | ArrayAccessor<Double, Axis<asap::IFAxis> > i1(i0);
|
---|
[79] | 311 | while (i1 != i1.end()) {
|
---|
| 312 | *o0 = *i1;
|
---|
| 313 | i1++;
|
---|
| 314 | o0++;
|
---|
| 315 | }
|
---|
| 316 | return direct.copy();
|
---|
| 317 | }
|
---|
| 318 |
|
---|
| 319 |
|
---|
[34] | 320 | Bool SDContainer::setFrequencyMap(uInt freqslot, uInt whichIF) {
|
---|
| 321 | freqidx_[whichIF] = freqslot;
|
---|
| 322 | return True;
|
---|
| 323 | }
|
---|
| 324 |
|
---|
| 325 | Bool SDContainer::putFreqMap(const Vector<uInt>& freqs) {
|
---|
| 326 | freqidx_.resize();
|
---|
| 327 | freqidx_ = freqs;
|
---|
| 328 | return True;
|
---|
| 329 | }
|
---|
| 330 |
|
---|
[79] | 331 | Bool SDContainer::setDirection(const Vector<Double>& point, uInt whichBeam) {
|
---|
| 332 | if (point.nelements() != 2) return False;
|
---|
[204] | 333 | ArrayAccessor<Double, Axis<asap::BeamAxis> > aa0(direction_);
|
---|
[79] | 334 | aa0.reset(aa0.begin(whichBeam));
|
---|
[204] | 335 | ArrayAccessor<Double, Axis<asap::BeamAxis> > jj(point);
|
---|
| 336 | for (ArrayAccessor<Double, Axis<asap::IFAxis> > i(aa0);i != i.end(); ++i) {
|
---|
[79] | 337 |
|
---|
| 338 | (*i) = (*jj);
|
---|
| 339 | jj++;
|
---|
| 340 | }
|
---|
| 341 | return True;
|
---|
| 342 | }
|
---|
| 343 |
|
---|
| 344 | Bool SDContainer::putDirection(const Array<Double>& dir) {
|
---|
| 345 | direction_.resize();
|
---|
| 346 | direction_ = dir;
|
---|
| 347 | return True;
|
---|
| 348 | }
|
---|
| 349 |
|
---|
[204] | 350 | Bool SDContainer::appendHistory(const String& hist)
|
---|
| 351 | {
|
---|
| 352 | history_.resize(history_.nelements()+1,True);
|
---|
| 353 | history_[history_.nelements()-1] = hist;
|
---|
| 354 | return True;
|
---|
| 355 | }
|
---|
| 356 | Bool SDContainer::putHistory(const Vector<String>& hist)
|
---|
| 357 | {
|
---|
| 358 | history_.resize();
|
---|
| 359 | history_ = hist;
|
---|
| 360 | return True;
|
---|
| 361 | }
|
---|
| 362 |
|
---|
[308] | 363 | Int SDFrequencyTable::addFrequency(Double refPix, Double refVal, Double inc) {
|
---|
[34] | 364 | Int idx = -1;
|
---|
| 365 | Bool addit = False;
|
---|
| 366 | if (length() > 0) {
|
---|
| 367 | for (uInt i=0; i< length();++i) {
|
---|
[308] | 368 | if ( near(refVal,refVal_[i]) ) {
|
---|
| 369 | if (near(refPix,refPix_[i]) )
|
---|
| 370 | if ( near(inc,increment_[i]) )
|
---|
[34] | 371 | idx = Int(i);
|
---|
| 372 | }
|
---|
| 373 | }
|
---|
| 374 | if (idx >= 0) {
|
---|
| 375 | return idx;
|
---|
| 376 | }
|
---|
| 377 | }
|
---|
| 378 | nFreq_ += 1;
|
---|
| 379 | refPix_.resize(nFreq_,True);
|
---|
| 380 | refVal_.resize(nFreq_,True);
|
---|
| 381 | increment_.resize(nFreq_,True);
|
---|
| 382 | refPix_[nFreq_-1] = refPix;
|
---|
| 383 | refVal_[nFreq_-1] = refVal;
|
---|
| 384 | increment_[nFreq_-1] = inc;
|
---|
| 385 | idx = nFreq_-1;
|
---|
| 386 | return idx;
|
---|
| 387 | }
|
---|
| 388 |
|
---|
[204] | 389 | void SDFrequencyTable::addRestFrequency(Double val)
|
---|
| 390 | {
|
---|
| 391 | if (restFreqs_.nelements() == 0) {
|
---|
| 392 | restFreqs_.resize(1);
|
---|
| 393 | restFreqs_[0] = val;
|
---|
| 394 | } else {
|
---|
| 395 | Bool found = False;
|
---|
| 396 | for (uInt i=0;i<restFreqs_.nelements();++i) {
|
---|
| 397 | if (restFreqs_[i] == val) {
|
---|
| 398 | found = True;
|
---|
| 399 | return;
|
---|
| 400 | }
|
---|
| 401 | }
|
---|
| 402 | if (!found) {
|
---|
| 403 | restFreqs_.resize(restFreqs_.nelements()+1,True);
|
---|
| 404 | restFreqs_[restFreqs_.nelements()-1] = val;
|
---|
| 405 | }
|
---|
| 406 | }
|
---|
| 407 | }
|
---|
| 408 | void SDFrequencyTable::restFrequencies(Vector<Double>& rfs,
|
---|
| 409 | String& rfunit ) const
|
---|
| 410 | {
|
---|
| 411 | rfs.resize(restFreqs_.nelements());
|
---|
| 412 | rfs = restFreqs_;
|
---|
| 413 | rfunit = restFreqUnit_;
|
---|
| 414 | }
|
---|
[326] | 415 |
|
---|
| 416 |
|
---|
| 417 | uInt SDDataDesc::addEntry (const String& source, uInt freqID, const MDirection& dir)
|
---|
| 418 | {
|
---|
| 419 |
|
---|
| 420 | // See if already exists
|
---|
| 421 |
|
---|
| 422 | if (n_ > 0) {
|
---|
| 423 | for (uInt i=0; i<n_; i++) {
|
---|
| 424 | if (source==source_[i] && freqID==freqID_[i]) {
|
---|
| 425 | return i;
|
---|
| 426 | }
|
---|
| 427 | }
|
---|
| 428 | }
|
---|
| 429 |
|
---|
| 430 | // Not found - add it
|
---|
| 431 |
|
---|
| 432 | n_ += 1;
|
---|
| 433 | source_.resize(n_,True);
|
---|
| 434 | freqID_.resize(n_,True);
|
---|
| 435 | dir_.resize(n_,True,True);
|
---|
| 436 | //
|
---|
| 437 | source_[n_-1] = source;
|
---|
| 438 | freqID_[n_-1] = freqID;
|
---|
| 439 | dir_[n_-1] = dir;
|
---|
| 440 | //
|
---|
| 441 | return n_-1;
|
---|
| 442 | }
|
---|
| 443 |
|
---|
| 444 |
|
---|
| 445 | void SDDataDesc::summary() const
|
---|
| 446 | {
|
---|
| 447 | cerr << "Source FreqID" << endl;
|
---|
| 448 | for (uInt i=0; i<n_; i++) {
|
---|
[327] | 449 | cerr << setw(11) << source_(i) << freqID_(i) << endl;
|
---|
[326] | 450 | }
|
---|
| 451 | }
|
---|
| 452 |
|
---|