Changeset 457


Ignore:
Timestamp:
02/16/05 12:40:39 (19 years ago)
Author:
kil064
Message:

move SDMemTable::rotateXYPhase to SDMath

Location:
trunk/src
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/SDMath.cc

    r448 r457  
    8383
    8484#include "SDMath.h"
     85#include "SDPol.h"
    8586
    8687using namespace casa;
     
    12141215
    12151216
     1217void SDMath::rotateXYPhase (SDMemTable& in, Float value, Bool doAll)
     1218//
     1219// phase in degrees
     1220// Applies to all Beams and IFs
     1221// Might want to optionally select on Beam/IF
     1222//
     1223{
     1224   if (in.nPol() != 4) {
     1225      throw(AipsError("You must have 4 polarizations to run this function"));
     1226   }
     1227//   
     1228   const Table& tabIn = in.table();
     1229   ArrayColumn<Float> specCol(tabIn,"SPECTRA"); 
     1230   IPosition start(asap::nAxes,0);
     1231   IPosition end(asap::nAxes);
     1232
     1233// Set cursor slice. Assumes shape the same for all rows
     1234 
     1235   setCursorSlice (start, end, doAll, in);
     1236   IPosition start3(start);
     1237   start3(asap::PolAxis) = 2;                 // Real(XY)
     1238   IPosition end3(end);
     1239   end3(asap::PolAxis) = 2;   
     1240//
     1241   IPosition start4(start);
     1242   start4(asap::PolAxis) = 3;                 // Imag (XY)
     1243   IPosition end4(end);
     1244   end4(asap::PolAxis) = 3;
     1245// 
     1246   uInt nRow = in.nRow();
     1247   Array<Float> data;
     1248   for (uInt i=0; i<nRow;++i) {
     1249      specCol.get(i,data);
     1250      IPosition shape = data.shape();
     1251 
     1252// Get polarization slice references
     1253 
     1254      Array<Float> C3 = data(start3,end3);
     1255      Array<Float> C4 = data(start4,end4);
     1256   
     1257// Rotate
     1258 
     1259      SDPolUtil::rotateXYPhase(C3, C4, value);
     1260   
     1261// Put
     1262   
     1263      specCol.put(i,data);
     1264   }
     1265}     
     1266
    12161267
    12171268
  • trunk/src/SDMath.h

    r434 r457  
    124124   SDMemTable* averagePol(const SDMemTable& in, const casa::Vector<casa::Bool>& mask,
    125125                          const casa::String& wtStr) const;
     126
     127// Rotate XY phase
     128   void rotateXYPhase (SDMemTable& in, casa::Float value, casa::Bool doAll);
     129
    126130
    127131 private:
  • trunk/src/SDMathWrapper.cc

    r398 r457  
    8282
    8383
    84 
    8584void SDMathWrapper::addInSitu(SDMemTableWrapper& in, float offset, bool doAll)
    8685{
     
    272271}
    273272
     273void SDMathWrapper::rotateXYPhaseInSitu(SDMemTableWrapper& in, float angle, bool doAll)
     274{
     275  SDMemTable* pIn = in.getPtr();
     276  SDMath sdm;
     277  sdm.rotateXYPhase(*pIn, Float(angle), Bool(doAll));
     278}
     279
     280
     281
     282
    274283void SDMathWrapper::opacityInSitu(SDMemTableWrapper& in, float tau, bool doAll)
    275284{
  • trunk/src/SDMathWrapper.h

    r398 r457  
    9494                                       const std::string& method, bool perFreqID);
    9595
     96// XY Phase rotation
     97  void rotateXYPhaseInSitu(SDMemTableWrapper& in, float angle, bool doAll);
     98
    9699// Apply opacity correction
    97100  void opacityInSitu (SDMemTableWrapper& in, float tau, bool doAll);
  • trunk/src/SDMemTable.cc

    r455 r457  
    6464#include "MathUtils.h"
    6565#include "SDPol.h"
     66
    6667
    6768
     
    16711672
    16721673
    1673 void SDMemTable::rotateXYPhase (Float value, Bool doAll)
    1674   // phase in degrees
    1675   // Applies to all Beams and IFs
    1676   // Might want to optionally select on Beam/IF
    1677 {
    1678   if (nPol() != 4) {
    1679     throw(AipsError("You must have 4 polarizations to run this function"));
    1680   }
    1681  
    1682   IPosition start(asap::nAxes,0);
    1683   IPosition end(asap::nAxes);
    1684  
    1685   uInt nRow = specCol_.nrow();
    1686   Array<Float> data;
    1687   for (uInt i=0; i<nRow;++i) {
    1688     specCol_.get(i,data);
    1689     IPosition shape = data.shape();
    1690    
    1691     // Set slice
    1692     if (!doAll) {
    1693       setCursorSlice (start, end, shape);
    1694     } else {
    1695       end = shape-1;
    1696     }
    1697 
    1698     // Get polarization slice references
    1699     start(asap::PolAxis) = 2;
    1700     end(asap::PolAxis) = 2;
    1701     Array<Float> C3 = data(start,end);
    1702    
    1703     start(asap::PolAxis) = 3;
    1704     end(asap::PolAxis) = 3;
    1705     Array<Float> C4 = data(start,end);
    1706    
    1707     // Rotate
    1708     SDPolUtil::rotateXYPhase(C3, C4, value);
    1709    
    1710     // Put
    1711     specCol_.put(i,data);
    1712   }
    1713 }
    1714 
    17151674void SDMemTable::setCursorSlice(IPosition& start, IPosition& end,
    17161675                                const IPosition& shape) const
  • trunk/src/SDMemTable.h

    r455 r457  
    236236// Get global antenna position
    237237  casa::MPosition getAntennaPosition() const;
    238 
    239 // Rotate phase of XY correlation by specified value (degrees)
    240   void rotateXYPhase (casa::Float angle, casa::Bool doAll);
    241238
    242239// Helper function to check instrument (antenna) name and give enum
  • trunk/src/SDMemTableWrapper.h

    r455 r457  
    205205  }
    206206
    207   void rotateXYPhase (float value, bool doAll) {
    208       table_->rotateXYPhase(value, doAll);
    209   }
    210 
    211207private:
    212208  casa::CountedPtr<SDMemTable> table_;
  • trunk/src/python_SDMath.cc

    r311 r457  
    101101//
    102102      def("stats", &SDMathWrapper::statistic);
     103//
     104      def ("rotate_xyphase", &SDMathWrapper::rotateXYPhaseInSitu);
    103105    };
    104106
  • trunk/src/python_SDMemTable.cc

    r456 r457  
    6262    .def("setbeam", &SDMemTableWrapper::setBeam)
    6363    .def("setpol", &SDMemTableWrapper::setPol)
    64     .def("_rotate_xyphase", &SDMemTableWrapper::rotateXYPhase)
    6564    .def("_setmask", &SDMemTableWrapper::setMask)
    6665    .def("get_fluxunit", &SDMemTableWrapper::getFluxUnit)
Note: See TracChangeset for help on using the changeset viewer.