Changeset 1586
- Timestamp:
- 06/30/09 15:46:14 (15 years ago)
- Location:
- trunk
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/python/__init__.py
r1560 r1586 116 116 'scantable.storage' : ['memory', str], 117 117 'scantable.history' : [True, _validate_bool], 118 'scantable.reference' : ['.*(e|w|_R)$', str] 118 'scantable.reference' : ['.*(e|w|_R)$', str], 119 'scantable.parallactify' : [False, _validate_bool] 119 120 # fitter 120 121 } -
trunk/python/scantable.py
r1584 r1586 12 12 """ 13 13 14 def __init__(self, filename, average=None, unit=None ):14 def __init__(self, filename, average=None, unit=None, parallactify=None): 15 15 """ 16 16 Create a scantable from a saved one or make a reference … … 30 30 (input rpfits/sdfits/ms) or replaces the value 31 31 in existing scantables 32 parallactify: Indcicate that the data had been parallatified. 33 Default is taken form rc file. 32 34 """ 33 35 if average is None: 34 36 average = rcParams['scantable.autoaverage'] 37 if parallactify is None: 38 parallactify = rcParams['scantable.parallactify'] 35 39 varlist = vars() 36 40 from asap._asap import stmath … … 74 78 and isinstance(filename[-1], str): 75 79 self._fill(filename, unit, average) 80 self.parallactify(parallactify) 76 81 self._add_history("scantable", varlist) 77 82 print_log() … … 1224 1229 return s 1225 1230 1231 def parallactify(self, pflag): 1232 varlist = vars() 1233 self._parallactify(pflag) 1234 self._add_history("parallactify", varlist) 1235 1226 1236 def convert_pol(self, poltype=None): 1227 1237 """ -
trunk/src/STFiller.cpp
r1504 r1586 216 216 } 217 217 } 218 218 //table_->focus().setParallactify(true); 219 219 } 220 220 … … 300 300 /// @todo this has to change when nchan isn't global anymore 301 301 id = table_->frequencies().addEntry(Double(header_->nchan/2), 302 302 pksrec.refFreq, pksrec.freqInc); 303 303 RecordFieldPtr<uInt> mfreqidCol(rec, "FREQ_ID"); 304 304 *mfreqidCol = id; … … 316 316 RecordFieldPtr<uInt> mweatheridCol(rec, "WEATHER_ID"); 317 317 *mweatheridCol = id; 318 318 319 RecordFieldPtr<uInt> mfocusidCol(rec, "FOCUS_ID"); 319 id = table_->focus().addEntry(pksrec. focusAxi, pksrec.focusTan,320 pksrec.focus Rot);320 id = table_->focus().addEntry(pksrec.parAngle, pksrec.focusAxi, 321 pksrec.focusTan, pksrec.focusRot); 321 322 *mfocusidCol = id; 322 323 RecordFieldPtr<Array<Double> > dirCol(rec, "DIRECTION"); … … 326 327 RecordFieldPtr<Float> elCol(rec, "ELEVATION"); 327 328 *elCol = pksrec.elevation; 328 329 RecordFieldPtr<Float> parCol(rec, "PARANGLE");330 *parCol = pksrec.parAngle;331 329 332 330 RecordFieldPtr< Array<Float> > specCol(rec, "SPECTRA"); -
trunk/src/STFocus.cpp
r957 r1586 34 34 } 35 35 36 asap::STFocus::STFocus( casa::Table tab ) : STSubTable(tab, name_) 36 STFocus::STFocus( casa::Table tab ) : 37 STSubTable(tab, name_) 37 38 { 39 parangleCol_.attach(table_,"PARANGLE"); 38 40 rotationCol_.attach(table_,"ROTATION"); 39 41 axisCol_.attach(table_,"AXIS"); … … 50 52 } 51 53 52 STFocus& asap::STFocus::operator =( const STFocus & other )54 STFocus& STFocus::operator =( const STFocus & other ) 53 55 { 54 56 if (this != &other) { 55 57 static_cast<STSubTable&>(*this) = other; 58 parangleCol_.attach(table_,"PARANGLE"); 56 59 rotationCol_.attach(table_,"ROTATION"); 57 60 axisCol_.attach(table_,"AXIS"); … … 65 68 return *this; 66 69 } 67 void asap::STFocus::setup( )70 void STFocus::setup( ) 68 71 { 69 72 // add to base class table 73 table_.addColumn(ScalarColumnDesc<Float>("PARANGLE")); 70 74 table_.addColumn(ScalarColumnDesc<Float>("ROTATION")); 71 75 table_.addColumn(ScalarColumnDesc<Float>("AXIS")); … … 76 80 table_.addColumn(ScalarColumnDesc<Float>("XYPHASE")); 77 81 table_.addColumn(ScalarColumnDesc<Float>("XYPHASEOFFSET")); 82 table_.rwKeywordSet().define("PARALLACTIFY", False); 78 83 79 84 // new cached columns 85 parangleCol_.attach(table_,"PARANGLE"); 80 86 rotationCol_.attach(table_,"ROTATION"); 81 87 axisCol_.attach(table_,"AXIS"); … … 88 94 } 89 95 90 uInt STFocus::addEntry(Float fax, Float ftan, Float frot, Float hand,91 Float user, Float mount,92 Float xyphase, Float xyphaseoffset)96 uInt STFocus::addEntry( Float pa, Float fax, Float ftan, Float frot, Float hand, 97 Float user, Float mount, 98 Float xyphase, Float xyphaseoffset) 93 99 { 94 Table result = table_( near(table_.col("ROTATION"), frot) 95 && near(table_.col("AXIS"), fax) 96 && near(table_.col("TAN"), ftan) 97 && near(table_.col("HAND"), hand) 98 && near(table_.col("USERPHASE"), user) 99 && near(table_.col("MOUNT"), mount) 100 && near(table_.col("XYPHASE"), xyphase) 101 && near(table_.col("XYPHASEOFFSET"), xyphaseoffset) 102 ); 100 Table result = table_( near(table_.col("PARANGLE"), pa) 101 && near(table_.col("ROTATION"), frot) 102 && near(table_.col("AXIS"), fax) 103 && near(table_.col("TAN"), ftan) 104 && near(table_.col("HAND"), hand) 105 && near(table_.col("USERPHASE"), user) 106 && near(table_.col("MOUNT"), mount) 107 && near(table_.col("XYPHASE"), xyphase) 108 && near(table_.col("XYPHASEOFFSET"), xyphaseoffset) 109 ); 103 110 uInt resultid = 0; 104 111 if ( result.nrow() > 0) { … … 113 120 resultid++; 114 121 } 122 parangleCol_.put(rno, pa); 115 123 rotationCol_.put(rno, frot); 116 124 axisCol_.put(rno, fax); … … 126 134 } 127 135 128 void asap::STFocus::getEntry(Float& rotation, Float& angle, Float& ftan,129 Float& hand, Float& user, Float& mount,130 Float& xyphase, Float& xyphaseoffset,131 uInt id) const136 void STFocus::getEntry( Float& pa, Float& rotation, Float& angle, Float& ftan, 137 Float& hand, Float& user, Float& mount, 138 Float& xyphase, Float& xyphaseoffset, 139 uInt id) const 132 140 { 133 141 Table t = table_(table_.col("ID") == Int(id) ); … … 138 146 // get first row - there should only be one matching id 139 147 const TableRecord& rec = row.get(0); 148 pa = rec.asFloat("PARANGLE"); 140 149 rotation = rec.asFloat("ROTATION"); 141 150 angle = rec.asFloat("AXIS"); … … 149 158 150 159 151 casa::Float asap::STFocus::getTotalFeedAngle( casa::uInt id ) const160 casa::Float STFocus::getTotalAngle( casa::uInt id ) const 152 161 { 153 162 Float total = 0.0f; 154 163 Table t = table_(table_.col("ID") == Int(id) ); 155 164 if (t.nrow() == 0 ) { 156 throw(AipsError("STFocus::getEntry - id out of range")); 165 throw(AipsError("STFocus::getTotalAngle - id out of range")); 166 } 167 if (table_.keywordSet().asBool("PARALLACTIFY")) { 168 return 0.0f; 157 169 } 158 170 ROTableRow row(t); 159 171 // get first row - there should only be one matching id 160 172 const TableRecord& rec = row.get(0); 173 total += rec.asFloat("PARANGLE"); 161 174 total += rec.asFloat("ROTATION"); 162 175 total += rec.asFloat("USERPHASE"); … … 164 177 return total; 165 178 } 166 }167 179 168 casa::Float asap::STFocus::getFeedHand( casa::uInt id ) const 180 181 casa::Float STFocus::getFeedHand( casa::uInt id ) const 169 182 { 170 183 Table t = table_(table_.col("ID") == Int(id) ); … … 177 190 } 178 191 192 void STFocus::setParallactify(bool istrue) { 193 cout << "called setPara" << endl; 194 table_.rwKeywordSet().define("PARALLACTIFY", Bool(istrue)); 195 } 196 197 } -
trunk/src/STFocus.h
r1353 r1586 37 37 STFocus& operator=(const STFocus& other); 38 38 39 casa::uInt addEntry( casa::Float faxis, casa::Float ftan,39 casa::uInt addEntry( casa::Float pa, casa::Float faxis, casa::Float ftan, 40 40 casa::Float frot, casa::Float hand=1.0f, 41 41 casa::Float mount=0.0f, casa::Float user=0.0f, 42 casa::Float xyphase=0.0f, casa::Float xyphaseoffset=0.0f); 42 casa::Float xyphase=0.0f, 43 casa::Float xyphaseoffset=0.0f); 43 44 44 void getEntry( casa::Float& fax, casa::Float& ftan,45 void getEntry( casa::Float& pa, casa::Float& fax, casa::Float& ftan, 45 46 casa::Float& frot, casa::Float& hand, 46 47 casa::Float& mount, casa::Float& user, … … 48 49 casa::uInt id) const; 49 50 50 casa::Float getTotalFeedAngle(casa::uInt id) const; 51 casa::Float getTotalAngle(casa::uInt id) const; 52 53 casa::Float getParAngle(casa::uInt id) const { 54 return parangleCol_(id); 55 } 51 56 casa::Float getFeedHand(casa::uInt id) const; 57 58 void setParallactify(bool istrue=false); 52 59 53 60 const casa::String& name() const { return name_; } … … 57 64 static const casa::String name_; 58 65 casa::ScalarColumn<casa::Float> rotationCol_, axisCol_, 59 tanCol_,handCol_, 60 mountCol_,userCol_, 61 xyphCol_,xyphoffCol_; 66 tanCol_,handCol_, parangleCol_, 67 mountCol_,userCol_, xyphCol_,xyphoffCol_,; 62 68 }; 63 69 -
trunk/src/STMath.cpp
r1579 r1586 1576 1576 id = out->molecules().addEntry(rf, name, fname); 1577 1577 molidcol.put(k, id); 1578 Float f rot,fax,ftan,fhand,fmount,fuser, fxy, fxyp;1579 (*it)->focus().getEntry(f ax, ftan, frot, fhand,1578 Float fpa,frot,fax,ftan,fhand,fmount,fuser, fxy, fxyp; 1579 (*it)->focus().getEntry(fpa, fax, ftan, frot, fhand, 1580 1580 fmount,fuser, fxy, fxyp, 1581 1581 rec.asuInt("FOCUS_ID")); 1582 id = out->focus().addEntry(f ax, ftan, frot, fhand,1582 id = out->focus().addEntry(fpa, fax, ftan, frot, fhand, 1583 1583 fmount,fuser, fxy, fxyp); 1584 1584 focusidcol.put(k, id); … … 1630 1630 ArrayColumn<Float> speccol(t, "SPECTRA"); 1631 1631 ScalarColumn<uInt> focidcol(t, "FOCUS_ID"); 1632 ScalarColumn<Float> parancol(t, "PARANGLE");1633 1632 Matrix<Float> pols(speccol.getColumn()); 1634 1633 try { 1635 1634 stpol->setSpectra(pols); 1636 Float fang,fhand ,parang;1637 fang = in->focusTable_.getTotal FeedAngle(focidcol(0));1635 Float fang,fhand; 1636 fang = in->focusTable_.getTotalAngle(focidcol(0)); 1638 1637 fhand = in->focusTable_.getFeedHand(focidcol(0)); 1639 parang = parancol(0); 1640 /// @todo re-enable this 1641 // disable total feed angle to support paralactifying Caswell style 1642 stpol->setPhaseCorrections(parang, -parang, fhand); 1638 stpol->setPhaseCorrections(fang, fhand); 1643 1639 // use a member function pointer in STPol. This only works on 1644 1640 // the STPol pointer itself, not the Counted Pointer so … … 1906 1902 uInt row = tab.rowNumbers()[0]; 1907 1903 stpol->setSpectra(in->getPolMatrix(row)); 1908 Float fang,fhand ,parang;1909 fang = in->focusTable_.getTotal FeedAngle(in->mfocusidCol_(row));1904 Float fang,fhand; 1905 fang = in->focusTable_.getTotalAngle(in->mfocusidCol_(row)); 1910 1906 fhand = in->focusTable_.getFeedHand(in->mfocusidCol_(row)); 1911 parang = in->paraCol_(row); 1912 /// @todo re-enable this 1913 // disable total feed angle to support paralactifying Caswell style 1914 stpol->setPhaseCorrections(parang, -parang, fhand); 1907 stpol->setPhaseCorrections(fang, fhand); 1915 1908 Int npolout = 0; 1916 1909 for (uInt i=0; i<tab.nrow(); ++i) { -
trunk/src/STPol.h
r1015 r1586 35 35 36 36 typedef void (STPol::*polOperation)( casa::Float phase ); 37 STPol(): total feed_(0.0),parangle_(0.0),feedhand_(1.0) {}37 STPol(): totalangle_(0.0),feedhand_(1.0) {} 38 38 virtual ~STPol() {} 39 39 … … 83 83 84 84 85 void setPhaseCorrections(casa::Float parangle=0.0, casa::Float totalfeed=0.0, 86 casa::Float feedhand=1.0) 87 { totalfeed_=totalfeed;parangle_=parangle;feedhand_=feedhand;} 85 void setPhaseCorrections(casa::Float totalang=0.0, casa::Float feedhand=1.0) 86 { totalangle_=totalang;feedhand_=feedhand;} 88 87 89 casa::Float getTotalPhase() const { return total feed_+parangle_; }88 casa::Float getTotalPhase() const { return totalangle_; } 90 89 casa::Float getFeedHand() const { return feedhand_; } 91 90 … … 99 98 static std::map<std::string, std::map<int, std::string> > labelmap_; 100 99 101 casa::Float total feed_,parangle_,feedhand_;100 casa::Float totalangle_,feedhand_; 102 101 std::string mode_; 103 102 casa::Matrix<casa::Float> basespectra_; -
trunk/src/STWriter.cpp
r1575 r1586 214 214 inst->frequencies().getEntry(crpix,crval, pksrec.freqInc, 215 215 rec.asuInt("FREQ_ID")); 216 inst->focus().getEntry(pksrec. focusAxi, pksrec.focusTan,217 pksrec.focusRot, tmp0,tmp1,tmp2,tmp3,tmp4,218 rec.asuInt("FOCUS_ID"));216 inst->focus().getEntry(pksrec.parAngle, pksrec.focusAxi, pksrec.focusTan, 217 pksrec.focusRot, tmp0,tmp1,tmp2,tmp3,tmp4, 218 rec.asuInt("FOCUS_ID")); 219 219 inst->molecules().getEntry(pksrec.restFreq,stmp0,stmp1, 220 220 rec.asuInt("MOLECULE_ID")); … … 240 240 pksrec.azimuth = rec.asFloat("AZIMUTH"); 241 241 pksrec.elevation = rec.asFloat("ELEVATION"); 242 pksrec.parAngle = rec.asFloat("PARANGLE");243 242 pksrec.refBeam = rec.asInt("REFBEAMNO") + 1; 244 243 pksrec.sigma.resize(npol); -
trunk/src/Scantable.cpp
r1567 r1586 234 234 td.addColumn(ScalarColumnDesc<Float>("AZIMUTH")); 235 235 td.addColumn(ScalarColumnDesc<Float>("ELEVATION")); 236 td.addColumn(ScalarColumnDesc<Float>("PARANGLE"));237 236 td.addColumn(ScalarColumnDesc<Float>("OPACITY")); 238 237 … … 277 276 elCol_.attach(table_, "ELEVATION"); 278 277 dirCol_.attach(table_, "DIRECTION"); 279 paraCol_.attach(table_, "PARANGLE");280 278 fldnCol_.attach(table_, "FIELDNAME"); 281 279 rbeamCol_.attach(table_, "REFBEAMNO"); … … 693 691 specCol_.get(whichrow, arr); 694 692 } else { 695 CountedPtr<STPol> stpol(STPol::getPolClass(Scantable::factories_, basetype)); 693 CountedPtr<STPol> stpol(STPol::getPolClass(Scantable::factories_, 694 basetype)); 696 695 uInt row = uInt(whichrow); 697 696 stpol->setSpectra(getPolMatrix(row)); 698 697 Float fang,fhand,parang; 699 fang = focusTable_.getTotal FeedAngle(mfocusidCol_(row));698 fang = focusTable_.getTotalAngle(mfocusidCol_(row)); 700 699 fhand = focusTable_.getFeedHand(mfocusidCol_(row)); 701 parang = paraCol_(row); 702 /// @todo re-enable this 703 // disable total feed angle to support paralactifying Caswell style 704 stpol->setPhaseCorrections(parang, -parang, fhand); 700 stpol->setPhaseCorrections(fang, fhand); 705 701 arr = stpol->getSpectrum(requestedpol, ptype); 706 702 } -
trunk/src/Scantable.h
r1441 r1586 298 298 { return azCol_(whichrow); } 299 299 float getParAngle(int whichrow) const 300 { return paraCol_(whichrow); }300 { return focus().getParAngle(mfocusidCol_(whichrow)); } 301 301 302 302 std::string getSourceName(int whichrow) const … … 402 402 std::vector<double> getDirectionVector(int whichrow) const; 403 403 404 /** 405 * Set a flag indicating whether the data was parallactified 406 * @param[in] flag true or false 407 */ 408 void parallactify(bool flag) 409 {focus().setParallactify(flag);} 404 410 private: 405 411 … … 451 457 std::vector<uint> getNumbers(casa::ScalarColumn<casa::uInt>& col); 452 458 453 static const casa::uInt version_ = 2;459 static const casa::uInt version_ = 3; 454 460 455 461 STSelector selector_; … … 475 481 casa::ScalarColumn<casa::Float> azCol_; 476 482 casa::ScalarColumn<casa::Float> elCol_; 477 casa::ScalarColumn<casa::Float> paraCol_;478 483 casa::ScalarColumn<casa::String> srcnCol_, fldnCol_; 479 484 casa::ScalarColumn<casa::uInt> scanCol_, beamCol_, ifCol_, polCol_, cycleCol_; -
trunk/src/ScantableWrapper.h
r1430 r1586 212 212 { return table_->getDirectionVector(whichrow); } 213 213 214 void parallactify(bool flag) 215 { table_->parallactify(flag); } 216 214 217 private: 215 218 casa::CountedPtr<Scantable> table_; -
trunk/src/python_Scantable.cpp
r1440 r1586 124 124 .def("_setsourcetype", &ScantableWrapper::setSourceType) 125 125 .def("_getdirectionvec", &ScantableWrapper::getDirectionVector) 126 .def("_parallactify", &ScantableWrapper::parallactify) 126 127 ; 127 128 };
Note:
See TracChangeset
for help on using the changeset viewer.