Changeset 492


Ignore:
Timestamp:
02/21/05 18:03:36 (19 years ago)
Author:
kil064
Message:

add function polarizationLabel

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/SDPol.cc

    r469 r492  
    328328   if (toStokes) {
    329329      if (val==0) {
    330          stokes = Stokes::I;
     330          stokes = Stokes::I;
    331331      } else if (val==1) {
    332332         stokes = Stokes::Q;
     
    361361}
    362362
     363
     364
     365String SDPolUtil::polarizationLabel (uInt polIdx, Bool linear, Bool stokes, Bool linPol)
     366{   
     367   Stokes::StokesTypes type = Stokes::Undefined;
     368   if (stokes) {
     369      switch (polIdx) {
     370         case 0:
     371           {
     372              type = Stokes::I;
     373           }
     374           break;
     375         case 1:
     376           {
     377              if (linPol) {
     378                 type = Stokes::Plinear;
     379              } else {
     380                 type = Stokes::Q;
     381              }
     382           }
     383           break;
     384         case 2:
     385           {
     386              if (linPol) {
     387                 type = Stokes::Pangle;
     388              } else {
     389                 type = Stokes::U;
     390              }
     391           }
     392           break;
     393         case 3:
     394           {
     395              type = Stokes::V;
     396           }
     397           break;
     398         default: 
     399           {
     400               throw(AipsError("Unknown Stokes type"));
     401           }
     402      }
     403   } else {
     404      if (linear) {
     405         switch (polIdx) {
     406            case 0:
     407              {
     408                 type = Stokes::XX;
     409              }
     410              break;
     411            case 1:
     412              {
     413                 type = Stokes::YY;
     414              }
     415              break;
     416            case 2:
     417              {
     418                 type = Stokes::XY;              // Really Real(XY)
     419                 return String("Real(XY)");
     420              }
     421              break;
     422            case 3:
     423              {
     424                 type = Stokes::YX;              // Really Imag(XY)
     425                 return String("Imag(XY)");
     426              }
     427              break;
     428            default: 
     429              {
     430                  throw(AipsError("Unknown linear polarization type"));
     431              }
     432         }
     433      } else { 
     434         switch (polIdx) {
     435            case 0:
     436              {
     437                 type = Stokes::RR;
     438              }
     439              break;
     440            case 1:
     441              {
     442                 type = Stokes::LL;
     443              }
     444            case 2:
     445              {
     446                 type = Stokes::RL;               // Really Real(RL)
     447                 return String("Real(RL)");
     448              }
     449              break;
     450            case 3:
     451              {
     452                 type = Stokes::LR;               // Really Imag(RL)
     453                 return String("Imag(RL)");
     454              }
     455              break;
     456            default: 
     457              {
     458                  throw(AipsError("Unknown circular polarization type"));
     459              }
     460         }
     461      }
     462   }
     463//
     464   return SDPolUtil::stokesString(type);
     465}
     466
     467
     468
     469
     470// private
     471
     472String SDPolUtil::stokesString (Stokes::StokesTypes type)
     473{
     474  return Stokes::name (type);
     475}
     476
     477
    363478Array<casa::uChar> SDPolUtil::andArrays (const Array<casa::uChar>& in1,
    364479                                         const Array<casa::uChar>& in2)
     
    404519}
    405520
     521
     522
     523
     524
  • trunk/src/SDPol.h

    r469 r492  
    194194   static casa::Stokes::StokesTypes convertStokes(casa::Int val, casa::Bool toStokes,
    195195                                                  casa::Bool linear);
     196
     197// Return a label for the given polarization index (0-3).   
     198   static casa::String polarizationLabel (casa::uInt polIdx, casa::Bool linear,
     199                                          casa::Bool stokes, casa::Bool linPol);
    196200
    197201
     
    220224
    221225private:
     226// Return a label for the given StokesType
     227   static casa::String stokesString (casa::Stokes::StokesTypes stokes);
     228
     229// specializations
    222230  static casa::Array<casa::Float> andArrays (const casa::Array<casa::Float>& in1,
    223231                                             const casa::Array<casa::Float>& in2)
    224232                                             {return (in1+in2)/casa::Float(2.0);}
    225 
    226233  static casa::Array<casa::Bool> andArrays (const casa::Array<casa::Bool>& in1,
    227234                                            const casa::Array<casa::Bool>& in2)
Note: See TracChangeset for help on using the changeset viewer.