- Timestamp:
- 03/01/05 15:02:15 (20 years ago)
- Location:
- trunk/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/SDMemTable.cc
r521 r527 93 93 } 94 94 table_ = tab.copyToMemoryTable("dummy"); 95 //cerr << "hello from C SDMemTable @ " << this << endl;96 95 attach(); 97 96 } … … 116 115 117 116 attach(); 118 //cerr << "hello from CC SDMemTable @ " << this << endl;119 117 } 120 118 … … 378 376 379 377 380 std::vector<float> SDMemTable::getStokesSpectrum(Int whichRow, Bool doPol) const 381 // 382 // Gets one STokes parameter depending on cursor polSel location 383 // doPol=False : I,Q,U,V 384 // doPol=True : I,P,PA,V ; P = sqrt(Q**2+U**2), PA = 0.5*atan2(Q,U) 385 // 378 std::vector<float> SDMemTable::getStokesSpectrum(Int whichRow, 379 Bool doPol) const 380 // 381 // Gets one STokes parameter depending on cursor polSel location 382 // doPol=False : I,Q,U,V 383 // doPol=True : I,P,PA,V ; P = sqrt(Q**2+U**2), PA = 0.5*atan2(Q,U) 384 // 386 385 { 387 386 AlwaysAssert(asap::nAxes==4,AipsError); 388 387 if (nPol()!=1 && nPol()!=2 && nPol()!=4) { 389 390 } 391 392 // For full conversion we are only supporting linears at the moment393 388 throw (AipsError("You must have 1,2 or 4 polarizations to get the Stokes parameters")); 389 } 390 391 // For full conversion we are only supporting linears at the moment 392 394 393 if (nPol() > 2) { 395 396 397 398 399 400 401 402 } 403 // 394 String antName; 395 table_.keywordSet().get("AntennaName", antName); 396 Instrument inst = SDAttr::convertInstrument (antName, True); 397 SDAttr sdAtt; 398 if (sdAtt.feedPolType(inst) != LINEAR) { 399 throw(AipsError("Only linear polarizations are supported")); 400 } 401 } 402 404 403 Array<Float> arr; 405 404 stokesCol_.get(whichRow, arr); 406 // 405 407 406 if (doPol && (polSel_==1 || polSel_==2)) { // Q,U --> P, P.A. 408 409 // Set current cursor location 410 411 const IPosition& shape = arr.shape(); 412 IPosition start, end; 413 getCursorSlice(start, end, shape); 414 415 // Get Q and U slices 416 417 Array<Float> Q = SDPolUtil::getStokesSlice(arr,start,end,"Q"); 418 Array<Float> U = SDPolUtil::getStokesSlice(arr,start,end,"U"); 419 420 // Compute output 421 422 Array<Float> out; 423 if (polSel_==1) { // P 424 out = SDPolUtil::polarizedIntensity(Q,U); 425 } else if (polSel_==2) { // P.A. 426 out = SDPolUtil::positionAngle(Q,U); 427 } 428 429 // Copy to output 430 431 IPosition vecShape(1,shape(asap::ChanAxis)); 432 Vector<Float> outV = out.reform(vecShape); 433 std::vector<float> stlout; 434 outV.tovector(stlout); 435 return stlout; 436 437 } else { 438 407 408 // Set current cursor location 409 410 const IPosition& shape = arr.shape(); 411 IPosition start, end; 412 getCursorSlice(start, end, shape); 413 414 // Get Q and U slices 415 416 Array<Float> Q = SDPolUtil::getStokesSlice(arr,start,end,"Q"); 417 Array<Float> U = SDPolUtil::getStokesSlice(arr,start,end,"U"); 418 419 // Compute output 420 421 Array<Float> out; 422 if (polSel_==1) { // P 423 out = SDPolUtil::polarizedIntensity(Q,U); 424 } else if (polSel_==2) { // P.A. 425 out = SDPolUtil::positionAngle(Q,U); 426 } 427 428 // Copy to output 429 430 IPosition vecShape(1,shape(asap::ChanAxis)); 431 Vector<Float> outV = out.reform(vecShape); 432 std::vector<float> stlout; 433 outV.tovector(stlout); 434 return stlout; 435 436 } else { 439 437 // Selects at the cursor location 440 438 return getFloatSpectrum(arr); … … 1085 1083 1086 1084 SDFitTable SDMemTable::getSDFitTable(uInt whichRow) const { 1085 const Table& t = table_.keywordSet().asTable("FITS"); 1086 if (t.nrow() == 0 || whichRow >= t.nrow()) return SDFitTable(); 1087 1087 Array<Int> fitid; 1088 1088 fitCol_.get(whichRow, fitid); … … 1096 1096 Vector<Int> tmp = (fitid(start, end)).reform(IPosition(1,shp[3])); 1097 1097 1098 const Table& t = table_.keywordSet().asTable("FITS");1099 1098 Vector<Double> parms; 1100 1099 Vector<Bool> parmask; … … 1107 1106 ROArrayColumn<String> funcsCol(t, "FUNCTIONS"); 1108 1107 ROArrayColumn<String> finfoCol(t, "FRAMEINFO"); 1109 if (t.nrow() == 0) return SDFitTable();1110 1108 SDFitTable sdft; 1111 1109 Int k=-1; -
trunk/src/SDMemTable.h
r504 r527 98 98 int nStokes() const; 99 99 100 // Get specific Stokes at cursor location. One of either I,Q,U,V or I,P,PA,V (doPol=True)101 // (determined by the polSel cursor location 0->3)102 // If the latter, you can add a PA offset (degrees)100 // Get specific Stokes at cursor location. One of either I,Q,U,V or 101 // I,P,PA,V (doPol=True) (determined by the polSel cursor location 102 // 0->3) If the latter, you can add a PA offset (degrees) 103 103 virtual std::vector<float> getStokesSpectrum(casa::Int whichRow=0, 104 104 casa::Bool doPol=casa::False) const; 105 105 106 // Returns Label for polarization selected by polSel_ (or over-ridden 107 // with arg. polIdx). If doStokes is False, 108 // returns label for raw correlations (linear or circular). If True returns label for 109 // Stokes. If doPol=False, I,Q,U,V else I,P,PA,V 110 std::string getPolarizationLabel (casa::Bool linear, casa::Bool stokes, 111 casa::Bool linPol, casa::Int polIdx=-1) const; 112 113 // Convert Stokes to linear or circular polarizations (specified by polIdx=0:3). 114 // Presently, only conversion to RR or LL is supported. 115 virtual std::vector<float> stokesToPolSpectrum (casa::Int whichRow, casa::Bool toLinear, 116 casa::uInt polIdx) const; 106 // Returns Label for polarization selected by polSel_ (or 107 // over-ridden with arg. polIdx). If doStokes is False, returns 108 // label for raw correlations (linear or circular). If True returns 109 // label for Stokes. If doPol=False, I,Q,U,V else I,P,PA,V 110 std::string getPolarizationLabel(casa::Bool linear, casa::Bool stokes, 111 casa::Bool linPol, 112 casa::Int polIdx=-1) const; 113 114 // Convert Stokes to linear or circular polarizations (specified by 115 // polIdx=0:3). Presently, only conversion to RR or LL is 116 // supported. 117 virtual std::vector<float> stokesToPolSpectrum(casa::Int whichRow, 118 casa::Bool toLinear, 119 casa::uInt polIdx) const; 117 120 118 121 // Get all Stokes at the specified Beam/IF cursor location (ignoring -
trunk/src/SDMemTableWrapper.h
r505 r527 85 85 return table_->getSpectrum(whichRow); 86 86 } 87 // 88 std::vector<float> getStokesSpectrum(int whichRow=0, bool linPol=false) const { 87 88 std::vector<float> getStokesSpectrum(int whichRow=0, 89 bool linPol=false) const { 89 90 return table_->getStokesSpectrum(whichRow, linPol); 90 91 } 91 92 92 std::vector<float> stokesToPolSpectrum 93 93 std::vector<float> stokesToPolSpectrum(int whichRow, bool linear, 94 int polIdx) const { 94 95 return table_->stokesToPolSpectrum(whichRow, linear, polIdx); 95 96 } 96 97 97 // std::string getPolarizationLabel (bool linear, bool stokes, bool linPol, int polIdx) const { 98 // Boost fails with 4 arguments. 99 std::string getPolarizationLabel (bool linear, bool stokes, bool linPol) const { 100 int polIdx = -1; 101 return table_->getPolarizationLabel (linear, stokes, linPol, polIdx); 102 } 103 // 98 // std::string getPolarizationLabel(bool linear, bool stokes, bool linPol, int polIdx) const { 99 // Boost fails with 4 arguments. 100 std::string getPolarizationLabel(bool linear, bool stokes, 101 bool linPol) const { 102 int polIdx = -1; 103 return table_->getPolarizationLabel(linear, stokes, linPol, polIdx); 104 } 105 104 106 std::vector<double> getAbcissa(int whichRow=0) const { 105 107 return table_->getAbcissa(whichRow);
Note:
See TracChangeset
for help on using the changeset viewer.