- Timestamp:
- 02/16/05 12:40:39 (20 years ago)
- Location:
- trunk/src
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/SDMath.cc
r448 r457 83 83 84 84 #include "SDMath.h" 85 #include "SDPol.h" 85 86 86 87 using namespace casa; … … 1214 1215 1215 1216 1217 void 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 1216 1267 1217 1268 -
trunk/src/SDMath.h
r434 r457 124 124 SDMemTable* averagePol(const SDMemTable& in, const casa::Vector<casa::Bool>& mask, 125 125 const casa::String& wtStr) const; 126 127 // Rotate XY phase 128 void rotateXYPhase (SDMemTable& in, casa::Float value, casa::Bool doAll); 129 126 130 127 131 private: -
trunk/src/SDMathWrapper.cc
r398 r457 82 82 83 83 84 85 84 void SDMathWrapper::addInSitu(SDMemTableWrapper& in, float offset, bool doAll) 86 85 { … … 272 271 } 273 272 273 void 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 274 283 void SDMathWrapper::opacityInSitu(SDMemTableWrapper& in, float tau, bool doAll) 275 284 { -
trunk/src/SDMathWrapper.h
r398 r457 94 94 const std::string& method, bool perFreqID); 95 95 96 // XY Phase rotation 97 void rotateXYPhaseInSitu(SDMemTableWrapper& in, float angle, bool doAll); 98 96 99 // Apply opacity correction 97 100 void opacityInSitu (SDMemTableWrapper& in, float tau, bool doAll); -
trunk/src/SDMemTable.cc
r455 r457 64 64 #include "MathUtils.h" 65 65 #include "SDPol.h" 66 66 67 67 68 … … 1671 1672 1672 1673 1673 void SDMemTable::rotateXYPhase (Float value, Bool doAll)1674 // phase in degrees1675 // Applies to all Beams and IFs1676 // Might want to optionally select on Beam/IF1677 {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 slice1692 if (!doAll) {1693 setCursorSlice (start, end, shape);1694 } else {1695 end = shape-1;1696 }1697 1698 // Get polarization slice references1699 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 // Rotate1708 SDPolUtil::rotateXYPhase(C3, C4, value);1709 1710 // Put1711 specCol_.put(i,data);1712 }1713 }1714 1715 1674 void SDMemTable::setCursorSlice(IPosition& start, IPosition& end, 1716 1675 const IPosition& shape) const -
trunk/src/SDMemTable.h
r455 r457 236 236 // Get global antenna position 237 237 casa::MPosition getAntennaPosition() const; 238 239 // Rotate phase of XY correlation by specified value (degrees)240 void rotateXYPhase (casa::Float angle, casa::Bool doAll);241 238 242 239 // Helper function to check instrument (antenna) name and give enum -
trunk/src/SDMemTableWrapper.h
r455 r457 205 205 } 206 206 207 void rotateXYPhase (float value, bool doAll) {208 table_->rotateXYPhase(value, doAll);209 }210 211 207 private: 212 208 casa::CountedPtr<SDMemTable> table_; -
trunk/src/python_SDMath.cc
r311 r457 101 101 // 102 102 def("stats", &SDMathWrapper::statistic); 103 // 104 def ("rotate_xyphase", &SDMathWrapper::rotateXYPhaseInSitu); 103 105 }; 104 106 -
trunk/src/python_SDMemTable.cc
r456 r457 62 62 .def("setbeam", &SDMemTableWrapper::setBeam) 63 63 .def("setpol", &SDMemTableWrapper::setPol) 64 .def("_rotate_xyphase", &SDMemTableWrapper::rotateXYPhase)65 64 .def("_setmask", &SDMemTableWrapper::setMask) 66 65 .def("get_fluxunit", &SDMemTableWrapper::getFluxUnit)
Note:
See TracChangeset
for help on using the changeset viewer.