Changeset 502


Ignore:
Timestamp:
02/23/05 14:00:16 (19 years ago)
Author:
kil064
Message:

add function rotateLinPolPhase

Location:
trunk/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/SDMath.cc

    r488 r502  
    12711271// Rotate
    12721272 
    1273       SDPolUtil::rotateXYPhase(C3, C4, value);
     1273      SDPolUtil::rotatePhase(C3, C4, value);
     1274   
     1275// Put
     1276   
     1277      specCol.put(i,data);
     1278   }
     1279}     
     1280
     1281
     1282
     1283void SDMath::rotateLinPolPhase(SDMemTable& in, Float value, Bool doAll)
     1284//
     1285// phase in degrees
     1286// Applies to all Beams and IFs
     1287// Might want to optionally select on Beam/IF
     1288//
     1289{
     1290   if (in.nPol() != 4) {
     1291      throw(AipsError("You must have 4 polarizations to run this function"));
     1292   }
     1293//   
     1294   const Table& tabIn = in.table();
     1295   ArrayColumn<Float> specCol(tabIn,"SPECTRA"); 
     1296   ROArrayColumn<Float> stokesCol(tabIn,"STOKES"); 
     1297   IPosition start(asap::nAxes,0);
     1298   IPosition end(asap::nAxes);
     1299
     1300// Set cursor slice. Assumes shape the same for all rows
     1301 
     1302   setCursorSlice (start, end, doAll, in);
     1303//
     1304   IPosition start1(start);
     1305   start1(asap::PolAxis) = 0;                // C1 (XX)
     1306   IPosition end1(end);
     1307   end1(asap::PolAxis) = 0;   
     1308//
     1309   IPosition start2(start);
     1310   start2(asap::PolAxis) = 1;                 // C2 (YY)
     1311   IPosition end2(end);
     1312   end2(asap::PolAxis) = 1;   
     1313//
     1314   IPosition start3(start);
     1315   start3(asap::PolAxis) = 2;                 // C3 ( Real(XY) )
     1316   IPosition end3(end);
     1317   end3(asap::PolAxis) = 2;   
     1318//
     1319   IPosition startI(start);
     1320   startI(asap::PolAxis) = 0;                 // I
     1321   IPosition endI(end);
     1322   endI(asap::PolAxis) = 0;   
     1323//
     1324   IPosition startQ(start);
     1325   startQ(asap::PolAxis) = 1;                 // Q
     1326   IPosition endQ(end);
     1327   endQ(asap::PolAxis) = 1;   
     1328//
     1329   IPosition startU(start);
     1330   startU(asap::PolAxis) = 2;                 // U
     1331   IPosition endU(end);
     1332   endU(asap::PolAxis) = 2;   
     1333
     1334//
     1335   uInt nRow = in.nRow();
     1336   Array<Float> data, stokes;
     1337   for (uInt i=0; i<nRow;++i) {
     1338      specCol.get(i,data);
     1339      stokesCol.get(i,stokes);
     1340      IPosition shape = data.shape();
     1341 
     1342// Get linear polarization slice references
     1343 
     1344      Array<Float> C1 = data(start1,end1);
     1345      Array<Float> C2 = data(start2,end2);
     1346      Array<Float> C3 = data(start3,end3);
     1347
     1348// Get STokes slice references
     1349
     1350      Array<Float> I = stokes(startI,endI);
     1351      Array<Float> Q = stokes(startQ,endQ);
     1352      Array<Float> U = stokes(startU,endU);
     1353   
     1354// Rotate
     1355 
     1356      SDPolUtil::rotateLinPolPhase(C1, C2, C3, I, Q, U, value);
    12741357   
    12751358// Put
  • trunk/src/SDMath.h

    r480 r502  
    125125                          const casa::String& wtStr) const;
    126126
    127 // Rotate XY phase
     127// Rotate XY phase. Value in degrees.
    128128   void rotateXYPhase (SDMemTable& in, casa::Float value, casa::Bool doAll);
     129
     130// Rotate Q & U by operating on the raw correlations.Value in degrees.
     131   void rotateLinPolPhase (SDMemTable& in, casa::Float value, casa::Bool doAll);
    129132
    130133
  • trunk/src/SDMathWrapper.cc

    r457 r502  
    279279
    280280
     281void SDMathWrapper::rotateLinPolPhaseInSitu(SDMemTableWrapper& in, float angle, bool doAll)
     282{
     283  SDMemTable* pIn = in.getPtr();
     284  SDMath sdm;
     285  sdm.rotateLinPolPhase(*pIn, Float(angle), Bool(doAll));
     286}
     287
     288
    281289
    282290
  • trunk/src/python_SDMath.cc

    r457 r502  
    102102      def("stats", &SDMathWrapper::statistic);
    103103//
    104       def ("rotate_xyphase", &SDMathWrapper::rotateXYPhaseInSitu);
     104      def ("_rotate_xyphase", &SDMathWrapper::rotateXYPhaseInSitu);
     105      def ("_rotate_linpolphase", &SDMathWrapper::rotateLinPolPhaseInSitu);
    105106    };
    106107
Note: See TracChangeset for help on using the changeset viewer.