Changeset 490


Ignore:
Timestamp:
02/21/05 13:56:17 (19 years ago)
Author:
kil064
Message:

add functions

stokesLength
getStokesSpectrumLabel
getCircularSpectrumLabel

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/SDMemTable.cc

    r488 r490  
    370370}
    371371
     372
     373int SDMemTable::stokesLength() const
     374{
     375   return stokesCol_.shape(0).nelements();        // All rows same shape
     376}
     377
     378
    372379std::vector<float> SDMemTable::getStokesSpectrum(Int whichRow, Bool doPol,
    373380                                                 Float paOffset) const
     
    421428}
    422429
     430std::string SDMemTable::getStokesSpectrumLabel (Bool doPol) const
     431//
     432// Gets STokes label depending on cursor polSel location
     433//  doPol=False  : I,Q,U,V
     434//  doPol=True   : I,P,PA,V   ; P = sqrt(Q**2+U**2), PA = 0.5*atan2(Q,U)
     435//
     436{
     437  AlwaysAssert(asap::nAxes==4,AipsError);
     438  if (nPol()!=1 && nPol()!=2 && nPol()!=4) {
     439     throw (AipsError("You must have 1,2 or 4 polarizations to get the Stokes parameters"));
     440  }
     441//
     442   Stokes::StokesTypes type = Stokes::Undefined;
     443   switch (polSel_) {
     444      case 0:
     445        {
     446           type = Stokes::I;
     447        }
     448        break;
     449      case 1:
     450        {
     451           if (doPol) {
     452              type = Stokes::Plinear;
     453           } else {
     454              type = Stokes::Q;
     455           }
     456        }
     457      case 2:
     458        {
     459           if (doPol) {
     460              type = Stokes::Pangle;
     461           } else {
     462              type = Stokes::U;
     463           }
     464        }
     465        break;
     466      case 3:
     467        {
     468           type = Stokes::V;
     469        }
     470        break;
     471      default:
     472        {
     473            throw(AipsError("Unknown Stokes type"));
     474        }
     475   }
     476//
     477   return SDPolUtil::stokesString(type);
     478}
     479
     480
     481
    423482std::vector<float> SDMemTable::getCircularSpectrum(Int whichRow,
    424483                                                   Bool doRR) const
     
    458517  return stlout;
    459518}
     519
     520
     521std::string SDMemTable::getCircularSpectrumLabel (Bool doRR) const
     522//
     523// Gets Circular label
     524//
     525{
     526   Stokes::StokesTypes type = Stokes::Undefined;
     527   if (doRR) {
     528      type = Stokes::RR;
     529   } else {
     530      type = Stokes::LL;
     531   }
     532//
     533   return SDPolUtil::stokesString(type);
     534}
     535
     536
     537
     538
     539
    460540
    461541Array<Float> SDMemTable::getStokesSpectrum(Int whichRow, Int iBeam, Int iIF) const
  • trunk/src/SDMemTable.h

    r488 r490  
    103103  // getCircularSpectrum is 'getCircular'
    104104
     105  // Get length of STokes spectrum. XX & YY -> I
     106  // Anything else the length stays the same.
     107  int stokesLength() const;
     108
    105109  // Get specific Stokes at cursor location. One of either I,Q,U,V or I,P,PA,V (doPol=True)
    106110  // (determined by the polSel cursor location 0->3)
     
    110114                                               casa::Float paOffset=0.0) const;
    111115
     116  // Returns String for selected Stokes (polSel_)
     117  std::string getStokesSpectrumLabel (casa::Bool doPol) const;
     118
    112119  // Get RR or LL at cursor location (except not polSel_)
    113120  virtual std::vector<float> getCircularSpectrum(casa::Int whichRow=0,
    114121                                                 casa::Bool rr=casa::True) const;
     122
     123  // Get circular label
     124  std::string getCircularSpectrumLabel (casa::Bool rr=casa::True) const;
    115125
    116126  // Get all Stokes at the specified Beam/IF cursor location (ignoring
Note: See TracChangeset for help on using the changeset viewer.