Changeset 539


Ignore:
Timestamp:
03/08/05 15:27:49 (19 years ago)
Author:
mar637
Message:

Reworked stokestopolspectrum to have polIdx=-1 to enable polSel_.

Location:
trunk/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/SDMemTable.cc

    r527 r539  
    440440}
    441441
    442 std::string SDMemTable::getPolarizationLabel (Bool linear, Bool stokes, Bool linPol, Int polIdx) const
     442std::string SDMemTable::getPolarizationLabel(Bool linear, Bool stokes,
     443                                              Bool linPol, Int polIdx) const
    443444{
    444445   uInt idx = polSel_;   
    445446   if (polIdx >=0) idx = polIdx;
    446 //
    447    return SDPolUtil::polarizationLabel (idx, linear, stokes, linPol);
    448 }
    449 
    450 
    451 
    452 std::vector<float> SDMemTable::stokesToPolSpectrum (Int whichRow, Bool toLinear, uInt polIdx) const
     447   return SDPolUtil::polarizationLabel(idx, linear, stokes, linPol);
     448}
     449
     450
     451
     452std::vector<float> SDMemTable::stokesToPolSpectrum(Int whichRow,
     453                                                   Bool toLinear,
     454                                                   Int polIdx) const
    453455//
    454456// polIdx
     
    481483     throw(AipsError("Conversion to linears not yet supported"));
    482484  } else {
    483      Bool doRR = (polIdx==0);
    484      if(polIdx>1) {
    485         throw(AipsError("Only conversion to RR & LL is currently supported"));
    486      }
    487 
    488 // Get I and V slices
    489 
    490      Array<Float> I = SDPolUtil::getStokesSlice(arr,start,end,"I");
    491      Array<Float> V = SDPolUtil::getStokesSlice(arr,start,end,"V");
    492 
    493 // Compute output
    494 
    495      out = SDPolUtil::circularPolarizationFromStokes(I, V, doRR);
    496    }
    497 
    498 // Copy to output
    499 
     485    uInt selection = polSel_;
     486    if (polIdx > -1) selection = polIdx;
     487    Bool doRR = (selection==0);
     488    if (selection>1) {
     489      throw(AipsError("Only conversion to RR & LL is currently supported"));
     490    }
     491   
     492    // Get I and V slices   
     493    Array<Float> I = SDPolUtil::getStokesSlice(arr,start,end,"I");
     494    Array<Float> V = SDPolUtil::getStokesSlice(arr,start,end,"V");
     495   
     496    // Compute output     
     497    out = SDPolUtil::circularPolarizationFromStokes(I, V, doRR);
     498  }
     499 
     500  // Copy to output
    500501   IPosition vecShape(1,shape(asap::ChanAxis));
    501502   Vector<Float> outV = out.reform(vecShape);
  • trunk/src/SDMemTable.h

    r527 r539  
    117117  virtual std::vector<float> stokesToPolSpectrum(casa::Int whichRow,
    118118                                                 casa::Bool toLinear,
    119                                                  casa::uInt polIdx) const;
     119                                                 casa::Int polIdx) const;
    120120
    121121  // Get all Stokes at the specified Beam/IF cursor location (ignoring
  • trunk/src/SDMemTableWrapper.h

    r527 r539  
    9191  }
    9292
    93   std::vector<float> stokesToPolSpectrum(int whichRow, bool linear,
    94                                          int polIdx) const {
     93  std::vector<float> stokesToPolSpectrum(int whichRow=0, bool linear=false,
     94                                         int polIdx=-1) const {
    9595    return table_->stokesToPolSpectrum(whichRow, linear, polIdx);
    9696  }
  • trunk/src/python_SDMemTable.cc

    r505 r539  
    7777         (boost::python::arg("whichRow")=0),
    7878         (boost::python::arg("linear")=false),
    79          (boost::python::arg("thepol")=0) )
     79         (boost::python::arg("thepol")=-1) )
    8080    .def("_getpolarizationlabel", &SDMemTableWrapper::getPolarizationLabel,
    8181         (boost::python::arg("linear")=false),
Note: See TracChangeset for help on using the changeset viewer.