- Timestamp:
- 06/30/04 16:34:24 (20 years ago)
- Location:
- trunk/src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/SDContainer.cc
r16 r18 33 33 #include <aips/Arrays/ArrayAccessor.h> 34 34 #include <aips/Arrays/Matrix.h> 35 #include <aips/Quanta/MVTime.h> 35 36 36 37 #include "SDContainer.h" 37 38 38 39 using namespace atnf_sd; 40 41 void SDHeader::print() const { 42 MVTime mvt(this->utc); 43 44 cout << "Observer: " << this->observer << endl 45 << "Project: " << this->project << endl 46 << "Obstype: " << this->obstype << endl 47 << "Antenna: " << this->antennaname << endl 48 << "Ant. Position: " << this->antennaposition << endl 49 << "Equinox: " << this->equinox << endl 50 << "Freq. ref.: " << this->freqref << endl 51 << "Ref. frequency: " << this->reffreq << endl 52 << "Bandwidth: " << this->bandwidth << endl 53 << "Time (utc): " 54 << mvt.string() 55 << endl; 56 //setprecision(10) << this->utc << endl; 57 } 58 39 59 40 60 SDContainer::SDContainer(uInt nBeam, uInt nIF, uInt nPol, uInt nChan) -
trunk/src/SDContainer.h
r16 r18 32 32 #define _SDCONTAINER_H_ 33 33 34 #include <vector> 35 34 36 #include <aips/aips.h> 35 37 #include <aips/Utilities/String.h> … … 41 43 namespace atnf_sd { 42 44 45 46 struct SDHeader { 47 Int nchan; 48 Int npol; 49 Int nif; 50 Int nbeam; 51 String observer; 52 String project; 53 String obstype; 54 String antennaname; 55 Vector<Double> antennaposition; 56 Float equinox; 57 String freqref; 58 Double reffreq; 59 Double bandwidth; 60 Double utc; 61 void print() const ; 62 }; 63 43 64 class SDFrequencyTable { 44 65 45 66 public: 46 67 47 SDFrequencyTable( Double refPix, Double refVal, Double inc) {;}68 SDFrequencyTable() {;} 48 69 // returns the index into the table 49 70 // this creates a new one or returns an existing one … … 52 73 Int length() const { return nFreq_;};// # of stored Frequencies 53 74 // returns a Table with nRows == nFreq, and three cols 54 75 55 76 private: 56 77 Int nFreq_; 57 Vector<Double> refPix_;58 Vector<Double> revVal_;59 Vector<Double> increment_;78 std::vector<double> refPix_; 79 std::vector<double> revVal_; 80 std::vector<double> increment_; 60 81 }; 61 82 -
trunk/src/SDMemTable.cc
r16 r18 47 47 #include <aips/Tables/ScalarColumn.h> 48 48 #include <aips/Tables/ArrayColumn.h> 49 #include <aips/Tables/TableRecord.h> 50 49 51 50 52 #include "SDMemTable.h" … … 53 55 using namespace atnf_sd; 54 56 57 SDMemTable::SDMemTable() : 58 IFSel_(0), 59 beamSel_(0), 60 polSel_(0) { 61 setup(); 62 } 55 63 SDMemTable::SDMemTable(const std::string& name) : 56 64 IFSel_(0), … … 58 66 polSel_(0) { 59 67 name_ = String(name); 60 setup(); 68 Table tab(name_); 69 table_ = tab.copyToMemoryTable(name_); 61 70 } 62 71 … … 101 110 TableDesc td("", "1", TableDesc::Scratch); 102 111 td.comment() = "A SDMemTable"; 103 //td.rwKeywordSet().define("VERSION",Float(0.1));104 112 td.addColumn(ScalarColumnDesc<Double>("TIME")); 105 113 td.addColumn(ScalarColumnDesc<String>("SRCNAME")); … … 110 118 td.addColumn(ScalarColumnDesc<Double>("INTERVAL")); 111 119 // Now create a new table from the description. 120 112 121 SetupNewTable aNewTab(name_, td, Table::New); 113 122 table_ = Table(aNewTab, Table::Memory, 0); … … 293 302 return true; 294 303 } 304 305 bool SDMemTable::putSDHeader(const SDHeader& sdh) { 306 table_.lock(); 307 table_.rwKeywordSet().define("nIF", sdh.nif); 308 table_.rwKeywordSet().define("nBeam", sdh.nbeam); 309 table_.rwKeywordSet().define("nPol", sdh.npol); 310 table_.rwKeywordSet().define("nChan", sdh.nchan); 311 table_.rwKeywordSet().define("Observer", sdh.observer); 312 table_.rwKeywordSet().define("Project", sdh.project); 313 table_.rwKeywordSet().define("Obstype", sdh.obstype); 314 table_.rwKeywordSet().define("AntennaName", sdh.antennaname); 315 table_.rwKeywordSet().define("AntennaPosition", sdh.antennaposition); 316 table_.rwKeywordSet().define("Equinox", sdh.equinox); 317 table_.rwKeywordSet().define("FreqRefFrame", sdh.freqref); 318 table_.rwKeywordSet().define("FreqRefVal", sdh.reffreq); 319 table_.rwKeywordSet().define("Bandwidth", sdh.bandwidth); 320 table_.rwKeywordSet().define("UTC", sdh.utc); 321 table_.unlock(); 322 cerr << "Table Header set" << endl; 323 return true; 324 } 325 295 326 void SDMemTable::makePersistent(const std::string& filename) { 296 327 table_.deepCopy(filename,Table::New); … … 298 329 299 330 void SDMemTable::summary() const { 300 cerr << "SDMemTable::summary()" << endl;301 331 ROScalarColumn<Int> scans(table_, "SCANID"); 302 332 ROScalarColumn<String> srcs(table_, "SRCNAME"); 333 cout << "*************** Header ***************" << endl; 334 cout << "nBeam = " << nBeam() << "\t" 335 << "nIF = " << nIF() << endl 336 << "nPol = " << nPol() << "\t" 337 << "nChan = " << nChan() << "\t" << endl; 338 cout << "*************** Header ***************" << endl; 303 339 uInt count = 0; 304 340 String name; … … 316 352 } 317 353 } 318 cout << "Table contains " << table_.nrow() << "integrations." << endl; 319 cout << "in " << count << "scans." << endl; 320 } 354 cout << "Table contains " << table_.nrow() << " integration(s)." << endl; 355 cout << "in " << count << " scan(s)." << endl; 356 } 357 358 Int SDMemTable::nBeam() const { 359 Int n; 360 table_.keywordSet().get("nBeam",n); 361 return n; 362 } 363 Int SDMemTable::nIF() const { 364 Int n; 365 table_.keywordSet().get("nIF",n); 366 return n; 367 } 368 Int SDMemTable::nPol() const { 369 Int n; 370 table_.keywordSet().get("nPol",n); 371 return n; 372 } 373 Int SDMemTable::nChan() const { 374 Int n; 375 table_.keywordSet().get("nChan",n); 376 return n; 377 } 378 321 379 /* 322 void maskChannels(const std::vector<Int>& whichChans ) {380 void SDMemTable::maskChannels(const std::vector<Int>& whichChans ) { 323 381 324 382 std::vector<int>::iterator it; -
trunk/src/SDMemTable.h
r16 r18 50 50 class SDMemTable { 51 51 public: 52 SDMemTable(const std::string& name= "SDInputTable.tbl"); 52 SDMemTable(); 53 SDMemTable(const std::string& name); 53 54 SDMemTable(const SDMemTable& other, Bool clear=False); 54 55 … … 56 57 virtual ~SDMemTable(); 57 58 virtual bool putSDContainer(const SDContainer& sdc); 58 virtual bool putSDHeader(const SDHeader& sdh) {;}59 virtual bool putSDHeader(const SDHeader& sdh); 59 60 virtual bool putSDFreqTable(const SDFrequencyTable& sdft) {;} 60 61 … … 72 73 virtual bool setBeam(Int whichBeam=0); 73 74 virtual bool setPol(Int whichPol=0); 75 //sets the user mask 76 virtual bool setMask(const std::vector<int>& whichChans); 77 74 78 75 79 virtual Int getIF() { return IFSel_; } 76 80 virtual Int getBeam() { return beamSel_; } 77 81 virtual Int getPol() { return polSel_; } 78 79 //sets the mask 80 virtual bool setMask(const std::vector<int>& whichChans); 81 82 82 83 virtual void summary() const; 83 84 … … 85 86 void makePersistent(const std::string& filename); 86 87 SDMemTable getScan(Int scanID); 88 89 const TableRecord& getHeader() const {;} 87 90 const Table& table() { return table_; } 91 92 Int nBeam() const; 93 Int nIF() const; 94 Int nPol() const; 95 Int nChan() const; 88 96 89 97 private: 90 98 void setup(); 91 //Int nBeam_,nIF_,nChan_,nPol_; 99 92 100 Int IFSel_,beamSel_,polSel_; 93 101 std::vector<bool> chanMask_; -
trunk/src/SDMemTableWrapper.h
r16 r18 44 44 45 45 public: 46 SDMemTableWrapper(const std::string& name = "SDinput.tbl") :46 SDMemTableWrapper(const std::string& name) : 47 47 table_(new SDMemTable(name)) {;} 48 SDMemTableWrapper() : 49 table_(new SDMemTable()) {;} 50 48 51 SDMemTableWrapper(CountedPtr<SDMemTable> cp) : table_(cp) {;} 49 52 SDMemTableWrapper(SDMemTable* sdmt) : table_(sdmt) {;} … … 80 83 int getPol() {return table_->getPol();} 81 84 85 int nIF() {return table_->nIF();} 86 int nBeam() {return table_->nBeam();} 87 int nPol() {return table_->nPol();} 88 int nChan() {return table_->nChan();} 82 89 83 90 //sets the mask -
trunk/src/SDReader.cc
r17 r18 30 30 //#--------------------------------------------------------------------------- 31 31 #include <atnf/PKSIO/PKSreader.h> 32 #include <aips/Quanta/MVTime.h> 33 #include "SDContainer.h" 32 34 33 #include "SDReader.h" 35 34 36 35 using namespace atnf_sd; 37 38 void SDHeader::print() const {39 MVTime mvt(this->utc);40 41 cout << "Observer: " << this->observer << endl42 << "Project: " << this->project << endl43 << "Obstype: " << this->obstype << endl44 << "Antenna: " << this->antennaname << endl45 << "Ant. Position: " << this->antennaposition << endl46 << "Equinox: " << this->equinox << endl47 << "Freq. ref.: " << this->freqref << endl48 << "Ref. frequency: " << this->reffreq << endl49 << "Bandwidth: " << this->bandwidth << endl50 << "Time (utc): "51 << mvt.string()52 << endl;53 //setprecision(10) << this->utc << endl;54 }55 56 36 57 37 SDReader::SDReader() : … … 98 78 } 99 79 nBeam_ = beams.nelements(); 100 cout << "Reading " + format + " format from " + inName << endl;101 cout << "nChannels = " << nChan_ << ", " << "nPol = " << nPol_ << endl102 << "nIF = " << nIF_ << endl103 << "nBeams = " << nBeam_ << endl;80 //cout << "Reading " + format + " format from " + inName << endl; 81 //cout << "nChannels = " << nChan_ << ", " << "nPol = " << nPol_ << endl 82 // << "nIF = " << nIF_ << endl 83 // << "nBeams = " << nBeam_ << endl; 104 84 105 85 // Get basic parameters. … … 131 111 header_.nif = nIF_; 132 112 // Apply selection criteria. 133 cerr << "applying selection criteria..." << endl;134 113 Vector<Int> start(nIF_, 1); 135 114 Vector<Int> end(nIF_, 0); … … 138 117 Vector<Bool> IFsel(nIF_,True); 139 118 reader_->select(beamSel, IFsel, start, end, ref, True, haveXPol); 140 cerr << "open finished" << endl;119 table_->putSDHeader(header_); 141 120 } 142 121 143 122 int SDReader::read(const std::vector<int>& seq) { 144 cerr << "SDReader::read" << endl;145 123 int status = 0; 146 124 … … 159 137 mjd = 0; 160 138 uInt n = seq.size(); 161 cerr << header_.nif << ", " << header_.nbeam << endl;139 //cerr << header_.nif << ", " << header_.nbeam << endl; 162 140 uInt stepsize = header_.nif*header_.nbeam; 163 141 cerr << "SDReader stepsize = " << stepsize << endl; … … 174 152 // iterate over one correlator integration cycle = nBeam*nIF 175 153 for (uInt row=0; row < stepsize; row++) { 176 // add scanid from GROUP field -- this will remove the need for177 154 // stepsize as well 178 155 // spectra(nChan,nPol)!!! … … 213 190 //uInt frqslot = sdft.addFrequency(refPix, refFreq, freqInc); 214 191 215 //if ( srcName != prevName ) {//temp216 //scanid++;//temp217 // prevName = srcName;//temp218 //}//temp219 192 sc.scanid = scanNo; 220 193 //sc.setFrequencyMap(frqslot,IFno-1); -
trunk/src/SDReader.h
r16 r18 43 43 44 44 #include "SDMemTable.h" 45 #include "SDContainer.h" 45 46 46 47 class PKSreader; 47 48 48 49 namespace atnf_sd { 49 50 struct SDHeader {51 Int nchan;52 Int npol;53 Int nif;54 Int nbeam;55 String observer;56 String project;57 String obstype;58 String antennaname;59 Vector<Double> antennaposition;60 Float equinox;61 String freqref;62 Double reffreq;63 Double bandwidth;64 Double utc;65 void print() const ;66 };67 50 68 51 class SDReader { … … 90 73 private: 91 74 Int nBeam_,nIF_,nPol_,nChan_; 92 Bool getHeader();93 75 PKSreader* reader_; 94 76 SDHeader header_; … … 101 83 }// namespace 102 84 #endif 103 -
trunk/src/python_SDMemTable.cc
r16 r18 42 42 void python_SDMemTable() { 43 43 class_<SDMemTableWrapper>("sdtable") 44 .def( init <> () ) 44 45 .def( init < std::string > () ) 45 46 .def( init < SDMemTableWrapper, int > () ) … … 53 54 .def("getbeam", &SDMemTableWrapper::getBeam) 54 55 .def("getpol", &SDMemTableWrapper::getPol) 56 .def("nif", &SDMemTableWrapper::nIF) 57 .def("nbeam", &SDMemTableWrapper::nBeam) 58 .def("npol", &SDMemTableWrapper::nPol) 59 .def("nchan", &SDMemTableWrapper::nChan) 60 55 61 .def("setif", &SDMemTableWrapper::setIF, 56 62 (boost::python::arg("whichIF")=0) )
Note:
See TracChangeset
for help on using the changeset viewer.