Changeset 832


Ignore:
Timestamp:
02/17/06 16:06:45 (19 years ago)
Author:
mar637
Message:

Removed actual SDContainer class

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/SDContainer.cc

    r685 r832  
    3535#include <casa/Exceptions.h>
    3636#include <casa/Utilities/Assert.h>
    37 #include <tables/Tables/Table.h>
    3837#include <casa/Arrays/IPosition.h>
    39 #include <casa/Arrays/Matrix.h>
    40 #include <casa/Arrays/VectorIter.h>
    41 #include <casa/Arrays/ArrayMath.h>
    42 #include <casa/BasicMath/Math.h>
    4338#include <casa/Quanta/MVTime.h>
    4439
    4540
    4641
    47 #include "SDDefs.h"
     42#include "STDefs.h"
    4843#include "SDContainer.h"
    4944
     
    5449  MVTime mvt(this->utc);
    5550  mvt.setFormat(MVTime::YMD);
    56   cout << "Observer: " << this->observer << endl 
     51  cout << "Observer: " << this->observer << endl
    5752       << "Project: " << this->project << endl
    5853       << "Obstype: " << this->obstype << endl
     
    6358       << "Ref. frequency: " << this->reffreq << endl
    6459       << "Bandwidth: "  << this->bandwidth << endl
    65        << "Time (utc): " 
     60       << "Time (utc): "
    6661       << mvt
    6762       << endl;
     
    6964}
    7065
    71 
    72 SDContainer::SDContainer(uInt nBeam, uInt nIF, uInt nPol, uInt nChan)
    73   : nBeam_(nBeam),
    74     nIF_(nIF),
    75     nPol_(nPol),
    76     nChan_(nChan),
    77     spectrum_(IPosition(4,nBeam,nIF,nPol,nChan)),
    78     flags_(IPosition(4,nBeam,nIF,nPol,nChan)),
    79     tsys_(IPosition(4,nBeam,nIF,nPol,nChan)),
    80     freqidx_(nIF),
    81     restfreqidx_(nIF),
    82     direction_(IPosition(2,nBeam,2)) {
    83   uChar x = 0;
    84   flags_ = ~x;
    85   tcal.resize(2);
    86 }
    87 
    88 SDContainer::SDContainer(IPosition shp)
    89   : nBeam_(shp(asap::BeamAxis)),
    90     nIF_(shp(asap::IFAxis)),
    91     nPol_(shp(asap::PolAxis)),
    92     nChan_(shp(asap::ChanAxis)),
    93     spectrum_(shp),
    94     flags_(shp),
    95     tsys_(shp),
    96     freqidx_(shp(asap::IFAxis)),
    97     restfreqidx_(shp(asap::IFAxis)) {
    98   IPosition ip(2,shp(asap::BeamAxis),2);
    99   direction_.resize(ip);
    100   uChar x = 0;
    101   flags_ = ~x;
    102   tcal.resize(2);
    103 }
    104 
    105 SDContainer::~SDContainer() {
    106 }
    107 
    108 Bool SDContainer::resize(IPosition shp) {
    109   nBeam_ = shp(asap::BeamAxis);
    110   nIF_ = shp(asap::IFAxis);
    111   nPol_ = shp(asap::PolAxis);
    112   nChan_ = shp(asap::ChanAxis);
    113   spectrum_.resize(shp);
    114   flags_.resize(shp);
    115   tsys_.resize(shp);
    116   freqidx_.resize(shp(asap::IFAxis));
    117   restfreqidx_.resize(shp(asap::IFAxis));
    118   IPosition ip(2,shp(asap::BeamAxis),2);
    119   direction_.resize(ip);
    120 }
    121 
    122 Bool SDContainer::putSpectrum(const Array<Float>& spec) {
    123   spectrum_ = spec;
    124 }
    125 Bool SDContainer::putFlags(const Array<uChar>& flag) {
    126   flags_ = flag;
    127 }
    128 Bool SDContainer::putTsys(const Array<Float>& tsys) {
    129   tsys_ = tsys;
    130 }
    131 
    132 Bool SDContainer::setSpectrum(const Matrix<Float>& spec,
    133                               const Vector<Complex>& cSpec,
    134                               uInt whichBeam, uInt whichIF)
    135 //
    136 // spec is [nChan,nPol]
    137 // cspec is [nChan]
    138 // spectrum_ is [,,,nChan]
    139 //
    140 // nPOl_ = 4  - xx, yy, real(xy), imag(xy)
    141 //
    142 {
    143   AlwaysAssert(nPol_==4,AipsError);
    144 
    145 // Get slice  and check dim
    146 
    147   Bool tSys = False;
    148   Bool xPol = True;
    149   IPosition start, end;
    150   setSlice(start, end, spec.shape(), spectrum_.shape(),
    151             whichBeam, whichIF, tSys, xPol);
    152 
    153 // Get a reference to the Pol/Chan slice we are interested in
    154 
    155   Array<Float> subArr = spectrum_(start,end);
    156 
    157 // Iterate through pol-chan plane and fill
    158 
    159   ReadOnlyVectorIterator<Float> inIt(spec,0);
    160   VectorIterator<Float> outIt(subArr,asap::ChanAxis);
    161   while (!outIt.pastEnd()) {
    162      const IPosition& pos = outIt.pos();
    163      if (pos(asap::PolAxis)<2) {
    164         outIt.vector() = inIt.vector();
    165         inIt.next();
    166      } else if (pos(asap::PolAxis)==2) {
    167         outIt.vector() = real(cSpec);
    168      } else if (pos(asap::PolAxis)==3) {
    169         outIt.vector() = imag(cSpec);
    170      }
    171 //
    172      outIt.next();
    173   }
    174 
    175   // unset flags for this spectrum, they might be set again by the
    176   // setFlags method
    177 
    178   Array<uChar> arr(flags_(start,end));
    179   arr = uChar(0);
    180 //
    181   return True;
    182 }
    183 
    184 
    185 Bool SDContainer::setSpectrum(const Matrix<Float>& spec,
    186                               uInt whichBeam, uInt whichIF)
    187 //
    188 // spec is [nChan,nPol]
    189 // spectrum_ is [,,,nChan]
    190 // How annoying.
    191 {
    192 
    193 // Get slice and check dim
    194 
    195   IPosition start, end;
    196   setSlice(start, end, spec.shape(), spectrum_.shape(),
    197             whichBeam, whichIF, False, False);
    198 
    199 // Get a reference to the Pol/Chan slice we are interested in
    200 
    201   Array<Float> subArr = spectrum_(start,end);
    202 
    203 // Iterate through it and fill
    204 
    205   ReadOnlyVectorIterator<Float> inIt(spec,0);
    206   VectorIterator<Float> outIt(subArr,asap::ChanAxis);
    207   while (!outIt.pastEnd()) {
    208      outIt.vector() = inIt.vector();
    209 //
    210      inIt.next();
    211      outIt.next();
    212   }
    213 
    214   // unset flags for this spectrum, they might be set again by the
    215   // setFlags method
    216 
    217   Array<uChar> arr(flags_(start,end));
    218   arr = uChar(0);
    219 //
    220   return True;
    221 }
    222 
    223 Bool SDContainer::setFlags(const Matrix<uChar>& flags,
    224                            uInt whichBeam, uInt whichIF,
    225                            Bool hasXPol)
    226 //
    227 // flags is [nChan,nPol]
    228 // flags_ is [nBeam,nIF,nPol,nChan]
    229 //
    230 // Note that there are no separate flags for the XY cross polarization so we make
    231 // them up from the X and Y which is all the silly code below.  This means
    232 // that nPol==2 on input but 4 on output
    233 //
    234 {
    235   if (hasXPol) AlwaysAssert(nPol_==4,AipsError);
    236 
    237 // Get slice and check dim
    238 
    239   IPosition start, end;
    240   setSlice(start, end, flags.shape(), flags_.shape(),
    241             whichBeam, whichIF, False, hasXPol);
    242 
    243 // Get a reference to the Pol/Chan slice we are interested in
    244 
    245   Array<uChar> subArr = flags_(start,end);
    246 
    247 // Iterate through pol/chan plane  and fill
    248 
    249   ReadOnlyVectorIterator<uChar> inIt(flags,0);
    250   VectorIterator<uChar> outIt(subArr,asap::ChanAxis);
    251 //
    252   Vector<uChar> maskPol0;
    253   Vector<uChar> maskPol1;
    254   Vector<uChar> maskPol01;
    255   while (!outIt.pastEnd()) {
    256      const IPosition& pos = outIt.pos();
    257      if (pos(asap::PolAxis)<2) {
    258         outIt.vector() = inIt.vector();
    259 //
    260         if (hasXPol) {
    261            if (pos(asap::PolAxis)==0) {
    262               maskPol0 = inIt.vector();
    263            } else if (pos(asap::PolAxis)==1) {
    264               maskPol1 = inIt.vector();
    265 //
    266               maskPol01.resize(maskPol0.nelements());
    267               for (uInt i=0; i<maskPol01.nelements(); i++) maskPol01[i] = maskPol0[i]&maskPol1[i];
    268            }
    269         }
    270         inIt.next();
    271      } else if (pos(asap::PolAxis)==2) {
    272         if (hasXPol) {
    273            outIt.vector() = maskPol01;
    274         } else {
    275            outIt.vector() = inIt.vector();
    276            inIt.next();
    277         }
    278 
    279      } else if (pos(asap::PolAxis)==3) {
    280         if (hasXPol) {
    281            outIt.vector() = maskPol01;
    282         } else {
    283            outIt.vector() = inIt.vector();
    284            inIt.next();
    285         }
    286      }
    287      outIt.next();
    288   }
    289 //
    290   return True;
    291 }
    292 
    293 
    294 Bool SDContainer::setTsys(const Vector<Float>& tsys,
    295                           uInt whichBeam, uInt whichIF,
    296                           Bool hasXpol)
    297 //
    298 // TSys shape is [nPol]
    299 // Tsys does not depend upon channel but is replicated
    300 // for simplicity of use.
    301 // There is no Tsys measurement for the cross polarization
    302 // so I have set TSys for XY to sqrt(Tx*Ty)
    303 //
    304 {
    305 
    306 // Get slice and check dim
    307 
    308   IPosition start, end;
    309   setSlice(start, end, tsys.shape(), tsys_.shape(),
    310             whichBeam, whichIF, True, hasXpol);
    311 
    312 // Get a reference to the Pol/Chan slice we are interested in
    313 
    314   Array<Float> subArr = tsys_(start,end);
    315 
    316 // Iterate through it and fill
    317 
    318   VectorIterator<Float> outIt(subArr,asap::ChanAxis);
    319   uInt i=0;
    320   while (!outIt.pastEnd()) {
    321      const IPosition& pos = outIt.pos();
    322 //
    323      if (pos(asap::PolAxis)<2) {
    324        outIt.vector() = tsys(i++);
    325      } else {
    326        if (hasXpol) {
    327           outIt.vector() = sqrt(tsys[0]*tsys[1]);
    328        } else {
    329           outIt.vector() = tsys(i++);
    330        }
    331      }
    332 //
    333      outIt.next();
    334   }
    335 }
    336 
    337 Array<Float> SDContainer::getSpectrum(uInt whichBeam, uInt whichIF)
    338 //
    339 // non-const function because of Array(start,end) slicer
    340 //
    341 // Input  [nBeam,nIF,nPol,nChan]
    342 // Output [nChan,nPol]
    343 //
    344 {
    345 
    346 // Get reference to slice and check dim
    347 
    348   IPosition start, end;
    349   setSlice(start, end, spectrum_.shape(), whichBeam, whichIF);
    350 //
    351   Array<Float> dataIn = spectrum_(start,end);
    352   Array<Float> dataOut(IPosition(2, nChan_, nPol_));
    353 //
    354   ReadOnlyVectorIterator<Float> itIn(dataIn, asap::ChanAxis);
    355   VectorIterator<Float> itOut(dataOut, 0);
    356   while (!itOut.pastEnd()) {
    357      itOut.vector() = itIn.vector();
    358 //
    359      itIn.next();
    360      itOut.next();
    361   }
    362 //
    363   return dataOut.copy();
    364 }
    365 
    366 Array<uChar> SDContainer::getFlags(uInt whichBeam, uInt whichIF)
    367 //
    368 // non-const function because of Array(start,end) slicer
    369 //
    370 // Input  [nBeam,nIF,nPol,nChan]
    371 // Output [nChan,nPol]
    372 //
    373 {
    374 
    375 // Get reference to slice and check dim
    376 
    377   IPosition start, end;
    378   setSlice(start, end, flags_.shape(), whichBeam, whichIF);
    379 //
    380   Array<uChar> dataIn = flags_(start,end);
    381   Array<uChar> dataOut(IPosition(2, nChan_, nPol_));
    382 //
    383   ReadOnlyVectorIterator<uChar> itIn(dataIn, asap::ChanAxis);
    384   VectorIterator<uChar> itOut(dataOut, 0);
    385   while (!itOut.pastEnd()) {
    386      itOut.vector() = itIn.vector();
    387 //
    388      itIn.next();
    389      itOut.next();
    390   }
    391 //
    392   return dataOut.copy();
    393 }
    394 
    395 Array<Float> SDContainer::getTsys(uInt whichBeam, uInt whichIF)
    396 //
    397 // Input  [nBeam,nIF,nPol,nChan]
    398 // Output [nPol]   (drop channel dependency and select first value only)
    399 //
    400 {
    401 // Get reference to slice and check dim
    402 
    403   IPosition start, end;
    404   setSlice(start, end, spectrum_.shape(), whichBeam, whichIF);
    405 //
    406   Array<Float> dataIn = tsys_(start,end);
    407   Vector<Float> dataOut(nPol_);
    408 //
    409   ReadOnlyVectorIterator<Float> itIn(dataIn, asap::ChanAxis);
    410   VectorIterator<Float> itOut(dataOut, 0);
    411   uInt i = 0;
    412   while (!itIn.pastEnd()) {
    413     dataOut[i++] = itIn.vector()[0];
    414     itIn.next();
    415   }
    416 //
    417   return dataOut.copy();
    418 }
    419 
    420 
    421 
    422 Array<Double> SDContainer::getDirection(uInt whichBeam) const
    423 //
    424 // Input [nBeam,2]
    425 // Output [nBeam]
    426 //
    427 {
    428   Vector<Double> dataOut(2);
    429   dataOut(0) = direction_(IPosition(2,whichBeam,0));
    430   dataOut(1) = direction_(IPosition(2,whichBeam,1));
    431   return dataOut.copy();
    432 }
    433 
    434 
    435 Bool SDContainer::setFrequencyMap(uInt freqID, uInt whichIF) {
    436   freqidx_[whichIF] = freqID;
    437   return True;
    438 }
    439 
    440 Bool SDContainer::putFreqMap(const Vector<uInt>& freqs) {
    441   freqidx_.resize();
    442   freqidx_ = freqs;
    443   return True;
    444 }
    445 
    446 Bool SDContainer::setRestFrequencyMap(uInt freqID, uInt whichIF) {
    447   restfreqidx_[whichIF] = freqID;
    448   return True;
    449 }
    450 
    451 Bool SDContainer::putRestFreqMap(const Vector<uInt>& freqs) {
    452   restfreqidx_.resize();
    453   restfreqidx_ = freqs;
    454   return True;
    455 }
    456 
    457 Bool SDContainer::setDirection(const Vector<Double>& point, uInt whichBeam)
    458 //
    459 // Input [2]
    460 // Output [nBeam,2]
    461 //
    462 {
    463   if (point.nelements() != 2) return False;
    464 //
    465   Vector<Double> dataOut(2);
    466   direction_(IPosition(2,whichBeam,0)) = point[0];
    467   direction_(IPosition(2,whichBeam,1)) = point[1];
    468   return True;
    469 }
    470 
    471 
    472 Bool SDContainer::putDirection(const Array<Double>& dir) {
    473   direction_.resize();
    474   direction_ = dir;
    475   return True;
    476 }
    477 
    478 Bool SDContainer::putFitMap(const Array<Int>& arr) {
    479   fitIDMap_.resize();
    480   fitIDMap_ = arr;
    481   return True;
    482 }
    483 
    484 void SDContainer::setSlice(IPosition& start, IPosition& end,
    485                            const IPosition& shpIn, const IPosition& shpOut,
    486                            uInt whichBeam, uInt whichIF, Bool tSys,
    487                            Bool xPol) const
    488 //
    489 // tSYs
    490 //   shpIn [nPol]
    491 // else
    492 //   shpIn [nCHan,nPol]
    493 //
    494 // if xPol present, the output nPol = 4 but
    495 // the input spectra are nPol=2 (tSys) or nPol=2 (spectra)
    496 //
    497 {
    498   AlwaysAssert(asap::nAxes==4,AipsError);
    499   uInt pOff = 0;
    500   if (xPol) pOff += 2;
    501   if (tSys) {
    502      AlwaysAssert(shpOut(asap::PolAxis)==shpIn(0)+pOff,AipsError);     // pol
    503   } else {
    504      AlwaysAssert(shpOut(asap::ChanAxis)==shpIn(0),AipsError);       // chan
    505      AlwaysAssert(shpOut(asap::PolAxis)==shpIn(1)+pOff,AipsError);   // pol
    506   }
    507 //
    508   setSlice(start, end, shpOut, whichBeam, whichIF);
    509 }
    510 
    511 
    512 void SDContainer::setSlice(IPosition& start, IPosition& end,
    513                            const IPosition& shape,
    514                            uInt whichBeam, uInt whichIF) const
    515 {
    516   AlwaysAssert(asap::nAxes==4,AipsError);
    517   //
    518   start.resize(asap::nAxes);
    519   start = 0;
    520   start(asap::BeamAxis) = whichBeam;
    521   start(asap::IFAxis) = whichIF;
    522 //
    523   end.resize(asap::nAxes);
    524   end = shape-1;
    525   end(asap::BeamAxis) = whichBeam;
    526   end(asap::IFAxis) = whichIF;
    527 }
    528 
    529 
    530 uInt SDFrequencyTable::addFrequency(Double refPix, Double refVal, Double inc)
    531 {
    532   if (length() > 0) {
    533     for (uInt i=0; i< length();i++) {
    534       if (near(refVal,refVal_[i]) &&
    535           near(refPix,refPix_[i]) &&
    536           near(inc,increment_[i])) {
    537          return i;
    538       }
    539     }
    540   }
    541 
    542 // Not found - add it
    543 
    544   nFreq_ += 1;
    545   refPix_.resize(nFreq_,True);
    546   refVal_.resize(nFreq_,True);
    547   increment_.resize(nFreq_,True);
    548   refPix_[nFreq_-1] = refPix;
    549   refVal_[nFreq_-1] = refVal;
    550   increment_[nFreq_-1] = inc;
    551   return nFreq_-1;
    552 }
    553 
    554 uInt SDFrequencyTable::addRestFrequency(Double val)
    555 {
    556   uInt nFreq = restFreqs_.nelements();
    557   if (nFreq>0) {
    558     for (uInt i=0; i<nFreq;i++) {
    559       if (near(restFreqs_[i],val)) {
    560          return i;
    561       }
    562     }
    563   }
    564 
    565 // Not found - add it
    566 
    567   nFreq += 1;
    568   restFreqs_.resize(nFreq,True);
    569   restFreqs_[nFreq-1] = val;
    570   return nFreq-1;
    571 }
    572 
    573 
    574 void SDFrequencyTable::restFrequencies(Vector<Double>& rfs,
    575                                        String& rfunit ) const
    576 {
    577   rfs.resize(restFreqs_.nelements());
    578   rfs = restFreqs_;
    579   rfunit = restFreqUnit_;
    580 }
    581 
    58266// SDDataDesc
    58367
    584 uInt SDDataDesc::addEntry(const String& source, uInt ID, 
     68uInt SDDataDesc::addEntry(const String& source, uInt ID,
    58569                          const MDirection& dir, uInt secID)
    58670{
     
    61599{
    616100   if (n_>0) {
    617       cerr << "Source    ID" << endl;   
     101      cerr << "Source    ID" << endl;
    618102      for (uInt i=0; i<n_; i++) {
    619103         cout << setw(11) << source_(i) << ID_(i) << endl;
  • trunk/src/SDContainer.h

    r754 r832  
    3636#include <casa/aips.h>
    3737#include <casa/BasicSL/String.h>
    38 #include <casa/Arrays/Array.h>
    3938#include <casa/Arrays/Vector.h>
    4039#include <casa/Containers/Block.h>
     
    6564  void print() const ;
    6665};
    67 
    68 class SDFrequencyTable {
    69 
    70 public:
    71 
    72   SDFrequencyTable() : nFreq_(0) {;}
    73   virtual ~SDFrequencyTable() {;}
    74 
    75   // Add a new entry or match an existing one. Returns the index into
    76   // the table
    77   casa::uInt addFrequency(casa::Double refPix, casa::Double refVal,
    78                           casa::Double inc);
    79 
    80   casa::Int length() const { return nFreq_;}  // # of stored Frequencies
    81   void setLength(casa::uInt length) {nFreq_ = length;}
    82 
    83   // Get attributes
    84   casa::Double referencePixel(casa::uInt which) const { return refPix_[which];}
    85   casa::Double referenceValue(casa::uInt which) const { return refVal_[which];}
    86   casa::Double increment(casa::uInt which) const { return increment_[which];}
    87   casa::Float equinox() const { return equinox_; }
    88   casa::String refFrame() const { return refFrame_; }
    89   casa::String baseRefFrame() const { return baseRefFrame_; }
    90   casa::String unit() const { return unit_; }
    91 
    92   void restFrequencies(casa::Vector<casa::Double>& rfs,
    93                        casa::String& rfunit ) const ;
    94 
    95   // Set attributes
    96   void setEquinox(casa::Float eq) { equinox_ = eq; }
    97   void setRefFrame(const casa::String& reff) { refFrame_ = reff; }
    98   void setBaseRefFrame(const casa::String& reff) { baseRefFrame_ = reff; }
    99   void setUnit(const casa::String& un) { unit_= un; }
    100 
    101   void deleteRestFrequencies() {restFreqs_.resize(0);}
    102   casa::uInt addRestFrequency(casa::Double);
    103   void setRestFrequencyUnit(const casa::String& theunit)
    104   { restFreqUnit_ = theunit;}
    105 
    106 private:
    107   casa::uInt nFreq_;
    108   casa::Vector<casa::Double> refPix_;
    109   casa::Vector<casa::Double> refVal_;           // Hz
    110   casa::Vector<casa::Double> increment_;        // Hz
    111   casa::Float equinox_;
    112   casa::String unit_;
    113   casa::String refFrame_;
    114   casa::String baseRefFrame_;
    115   casa::Vector<casa::Double> restFreqs_;        // Hz
    116   casa::String restFreqUnit_;
    117 };
    118 
    119 
    120 class SDContainer {
    121 
    122 public:
    123   SDContainer(casa::uInt nBeam, casa::uInt nIF, casa::uInt nPol,
    124               casa::uInt nChan);
    125   SDContainer(casa::IPosition shp);
    126 
    127   virtual ~SDContainer();
    128 
    129   casa::Bool resize(casa::IPosition shp);
    130 
    131   casa::Bool setSpectrum(const casa::Matrix<casa::Float>& spec,
    132                    casa::uInt whichBeam, casa::uInt whichIF);
    133   casa::Bool setSpectrum(const casa::Matrix<casa::Float>& spec,
    134                          const casa::Vector<casa::Complex>& cSpec,
    135                          casa::uInt whichBeam, casa::uInt whichIF);
    136   casa::Bool putSpectrum(const casa::Array<casa::Float>& spec);
    137 
    138   casa::Bool setFlags(const casa::Matrix<casa::uChar>& flgs,
    139                       casa::uInt whichBeam, casa::uInt whichIF,
    140                       casa::Bool hasXPol=casa::False);
    141   casa::Bool putFlags(const casa::Array<casa::uChar>& spec);
    142 
    143   casa::Bool setTsys(const casa::Vector<casa::Float>& ts,
    144                casa::uInt whichBeam, casa::uInt whichIF,
    145                casa::Bool hasXpol);
    146   casa::Bool putTsys(const casa::Array<casa::Float>& spec);
    147 
    148   casa::Bool setDirection(const casa::Vector<casa::Double>& point,
    149                           casa::uInt whichBeam);
    150   casa::Bool putDirection(const casa::Array<casa::Double>& dir);
    151 
    152   casa::Bool setFrequencyMap(casa::uInt freqslot, casa::uInt whichIF);
    153   casa::Bool putFreqMap(const casa::Vector<casa::uInt>& freqs);
    154 
    155   casa::Bool setRestFrequencyMap(casa::uInt freqslot, casa::uInt whichIF);
    156   casa::Bool putRestFreqMap(const casa::Vector<casa::uInt>& freqs);
    157 
    158   casa::Array<casa::Float> getSpectrum(casa::uInt whichBeam,
    159                                        casa::uInt whichIF);
    160   casa::Array<casa::uChar> getFlags(casa::uInt whichBeam,
    161                                     casa::uInt whichIF);
    162   casa::Array<casa::Float> getTsys(casa::uInt whichBeam,
    163                                    casa::uInt whichIF);
    164   casa::Array<casa::Double> getDirection(casa::uInt whichBeam) const;
    165 
    166   const casa::Array<casa::Float>& getSpectrum() const { return spectrum_; }
    167   const casa::Array<casa::uChar>& getFlags() const { return flags_; }
    168   const casa::Array<casa::Float>& getTsys() const { return tsys_; }
    169   const casa::Array<casa::Double>& getDirection() const { return direction_; }
    170 
    171   const casa::Vector<casa::uInt>& getFreqMap() const { return freqidx_; }
    172   const casa::Vector<casa::uInt>& getRestFreqMap() const
    173   { return restfreqidx_; }
    174 
    175   casa::Bool putFitMap(const casa::Array<casa::Int>& arr);
    176 
    177   const casa::Array<casa::Int>& getFitMap() const { return fitIDMap_; }
    178 
    179 
    180   casa::Double timestamp;
    181   //Double bandwidth;
    182   casa::String sourcename;
    183   casa::String fieldname;
    184   casa::Double interval;
    185   casa::Int scanid;
    186   casa::Vector<casa::Float> tcal;
    187   casa::String tcaltime;
    188   casa::Float azimuth;
    189   casa::Float elevation;
    190   casa::Float parangle;
    191   casa::Int refbeam;
    192 
    193 private:
    194   casa::uInt nBeam_,nIF_,nPol_,nChan_;
    195 
    196   // (nBeam,nIF,nPol,nChannel)
    197   casa::Array<casa::Float>    spectrum_;
    198   casa::Array<casa::uChar>    flags_;
    199 
    200   // (nBeam,nIF,nPol,[nChannel]) Tsys is not really a function of
    201   // channel, but this makes it easier to work with at the expense of
    202   // a little memory
    203   casa::Array<casa::Float>    tsys_;
    204   casa::Array<casa::Float>    tcal_;
    205 
    206   //(nIF) indx into "global" frequency table
    207   casa::Vector<casa::uInt>    freqidx_;
    208 
    209  // (nIF) indx into "global" rest frequency table
    210   casa::Vector<casa::uInt>    restfreqidx_;
    211 
    212   //(nBeam,2) maybe use Measures here...
    213   casa::Array<casa::Double>   direction_;
    214   casa::Array<casa::Int> fitIDMap_;
    215 
    216   void setSlice(casa::IPosition& start, casa::IPosition& end,
    217                 const casa::IPosition& shpIn, const casa::IPosition& shpOut,
    218                 casa::uInt whichBeam, casa::uInt whichIF, casa::Bool checkPol,
    219                 casa::Bool xPol) const;
    220   void setSlice(casa::IPosition& start, casa::IPosition& end,
    221                 const casa::IPosition& shape,
    222                 casa::uInt whichBeam, casa::uInt whichIF) const;
    223 };
    224 
    225 
    22666
    22767class SDDataDesc {
Note: See TracChangeset for help on using the changeset viewer.