Changeset 797 for branches/Release12/src
- Timestamp:
- 12/19/05 15:32:36 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/Release12/src/SDMath.cc
r779 r797 1384 1384 } 1385 1385 1386 void SDMath::invertPhase(SDMemTable& in, Bool doAll) 1387 // 1388 // Takes complex conjugate of complex correlation 1389 // should work ok for linear and circular polarisation 1390 // 1391 { 1392 if (in.nPol() != 4) { 1393 throw(AipsError("You must have 4 polarizations to run this function")); 1394 } 1395 1396 //SDHeader sh = in.getSDHeader(); 1397 //Instrument inst = SDAttr::convertInstrument(sh.antennaname, False); 1398 // SDAttr sdAtt; 1399 // if (sdAtt.feedPolType(inst) != LINEAR) { 1400 // throw(AipsError("Only linear polarizations are supported")); 1401 //} 1402 // 1403 const Table& tabIn = in.table(); 1404 ArrayColumn<Float> specCol(tabIn,"SPECTRA"); 1405 IPosition start(asap::nAxes,0); 1406 IPosition end(asap::nAxes); 1407 1408 // Set cursor slice. Assumes shape the same for all rows 1409 1410 setCursorSlice (start, end, doAll, in); 1411 1412 IPosition start4(start); 1413 start4(asap::PolAxis) = 3; // Imag (XY) 1414 IPosition end4(end); 1415 end4(asap::PolAxis) = 3; 1416 // 1417 uInt nRow = in.nRow(); 1418 Array<Float> data; 1419 for (uInt i=0; i<nRow;++i) { 1420 specCol.get(i,data); 1421 IPosition shape = data.shape(); 1422 1423 // Get polarization slice references 1424 Array<Float> C4 = data(start4,end4); 1425 1426 // Invert 1427 C4 = -C4 1428 1429 // Put 1430 specCol.put(i,data); 1431 } 1432 } 1433 1434 void SDMath::swapPol(SDMemTable& in, Bool doAll) 1435 // 1436 // phase in degrees 1437 // assumes linear correlations 1438 // 1439 { 1440 if (in.nPol() != 4 && in.nPol() != 2) { 1441 throw(AipsError("You must have 2 or 4 polarizations to run this function")); 1442 } 1443 // 1444 // SDHeader sh = in.getSDHeader(); 1445 // Instrument inst = SDAttr::convertInstrument(sh.antennaname, False); 1446 // SDAttr sdAtt; 1447 // if (sdAtt.feedPolType(inst) != LINEAR) { 1448 // throw(AipsError("Only linear polarizations are supported")); 1449 // } 1450 // 1451 const Table& tabIn = in.table(); 1452 ArrayColumn<Float> specCol(tabIn,"SPECTRA"); 1453 ROArrayColumn<Float> stokesCol(tabIn,"STOKES"); 1454 IPosition start(asap::nAxes,0); 1455 IPosition end(asap::nAxes); 1456 1457 // Set cursor slice. Assumes shape the same for all rows 1458 1459 setCursorSlice (start, end, doAll, in); 1460 // 1461 IPosition start1(start); 1462 start1(asap::PolAxis) = 0; // C1 (XX) 1463 IPosition end1(end); 1464 end1(asap::PolAxis) = 0; 1465 // 1466 IPosition start2(start); 1467 start2(asap::PolAxis) = 1; // C2 (YY) 1468 IPosition end2(end); 1469 end2(asap::PolAxis) = 1; 1470 // 1471 uInt nRow = in.nRow(); 1472 Array<Float> data, stokes; 1473 for (uInt i=0; i<nRow;++i) { 1474 specCol.get(i,data); 1475 stokesCol.get(i,stokes); 1476 IPosition shape = data.shape(); 1477 1478 // Get linear polarization slice references 1479 1480 Array<Float> C1 = data(start1,end1); 1481 Array<Float> C2 = data(start2,end2); 1482 1483 // Swap 1484 1485 Array<Float> tmp = C1; 1486 C1 = C2; 1487 C2 = C1; 1488 1489 // Put 1490 1491 specCol.put(i,data); 1492 } 1493 } 1494 1386 1495 // 'private' functions 1387 1496
Note:
See TracChangeset
for help on using the changeset viewer.