Changeset 429


Ignore:
Timestamp:
02/14/05 17:33:53 (19 years ago)
Author:
kil064
Message:

add functions

getStokesSLice
circularPolarization

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/SDPol.cc

    r427 r429  
    176176// array of shape (nBeam,nIF,nPol,nChan)
    177177//
     178// We use the scaling convention I=(XX+YY)
     179//
    178180{
    179181
     
    209211//
    210212   if (nPol==1) {
    211       I = C1;
     213      I = Float(2.0)*C1;
    212214      return;
    213215   }
     
    217219   Array<Float> C2 = input2(start,end);          // Input : C1
    218220//
    219    I = Float(0.5)*(C1 + C2);
     221   I = C1 + C2;
    220222   if (nPol <= 2) return;
    221223//
     
    231233   end(polAxis) = 1;
    232234   Array<Float> Q = output(start,end);           // Output : Q
    233    Q = Float(0.5)*(C1 - C2);
     235   Q = C1 - C2;
    234236//
    235237   start(polAxis) = 2;
    236238   end(polAxis) = 2;
    237239   Array<Float> U = output(start,end);           // Output : U
    238    U = C3;
     240   U = Float(2.0)*C3;
    239241//
    240242   start(polAxis) = 3;
    241243   end(polAxis) = 3;
    242244   Array<Float> V = output(start,end);           // Output : V
    243    V = C4;
     245   V = Float(2.0)*C4;
    244246}
    245247
     
    311313
    312314
     315
     316Array<Float> SDPolUtil::getStokesSlice (Array<Float>& in, const IPosition& start,
     317                                        const IPosition& end, const String& stokes)
     318{
     319   IPosition s(start);
     320   IPosition e(end);
     321//
     322   if (stokes=="I") {
     323      s(asap::PolAxis) = 0;
     324      e(asap::PolAxis) = 0;
     325   } else if (stokes=="Q") {
     326      s(asap::PolAxis) = 1;
     327      e(asap::PolAxis) = 1;
     328   } else if (stokes=="U") {
     329      s(asap::PolAxis) = 2;
     330      e(asap::PolAxis) = 2;
     331   } else if (stokes=="V") {
     332      s(asap::PolAxis) = 3;
     333      e(asap::PolAxis) = 3;
     334   }
     335//
     336   return in(s,e);
     337}
    313338 
     339
     340Array<Float> SDPolUtil::circularPolarizationFromStokes (Array<Float>& I,
     341                                                        Array<Float>& V,
     342                                                        Bool doRR)
     343{
     344   if (doRR) {
     345      return Float(0.5)*(I+V);
     346   } else {
     347      return Float(0.5)*(I-V);
     348   }
     349}
     350
  • trunk/src/SDPol.h

    r427 r429  
    5353                             casa::Array<casa::Float>& C4,
    5454                             casa::Float phase);
     55
     56// Get Stokes slices from the Array.  Start and End should
     57// already be setup to access the Array at the current cursor location
     58// (beam, IF, chanells; see SDMemTable).  This function will modify the asap::PolAxis
     59// location to access the desired Stokes slice ("I", "Q", "U", "V")
     60  static casa::Array<casa::Float> getStokesSlice (casa::Array<casa::Float>& input, const casa::IPosition& start,
     61                                                  const casa::IPosition& end, const casa::String& stokes);
     62
     63// Compute Circular polarization RR or LL from I and V
     64  static casa::Array<casa::Float> circularPolarizationFromStokes (casa::Array<casa::Float>& I,
     65                                                                  casa::Array<casa::Float>& V,
     66                                                                  casa::Bool doRR);
    5567};
    5668
Note: See TracChangeset for help on using the changeset viewer.