Changeset 527 for trunk/src/SDMemTable.cc
- Timestamp:
- 03/01/05 15:02:15 (19 years ago)
- File:
-
- 1 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;
Note: See TracChangeset
for help on using the changeset viewer.