Changeset 1815 for branches/newfiller/src
- Timestamp:
- 08/02/10 14:18:33 (14 years ago)
- Location:
- branches/newfiller/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/newfiller/src/PKSFiller.cpp
r1805 r1815 48 48 PKSFiller::PKSFiller( CountedPtr< Scantable > stbl ) : 49 49 FillerBase(stbl), 50 reader_(0), 51 header_(0) 50 reader_(0) 52 51 { 53 52 setReferenceRegex(".*(e|w|_R)$"); … … 66 65 } 67 66 */ 68 if (reader_) { delete reader_; reader_ = 0; } 67 69 68 Bool haveBase, haveSpectra; 70 69 … … 82 81 83 82 String antenna(""); 84 if ( (reader_ = getPKSreader(inName, antenna, 0, 0, format, beams, ifs, 85 nchans, npols, haveXPol_,haveBase, haveSpectra 86 )) == 0 ) { 83 84 reader_ = getPKSreader(inName, antenna, 0, 0, format, beams, ifs, 85 nchans, npols, haveXPol_, haveBase, haveSpectra); 86 if (reader_.null() == True) { 87 87 return False; 88 88 } 89 89 90 90 if (!haveSpectra) { 91 delete reader_;92 91 reader_ = 0; 93 92 throw(AipsError("No spectral data in file.")); … … 103 102 } 104 103 } 105 if (header_) delete header_; 106 header_ = new STHeader(); 107 header_->nchan = max(nchans); 108 header_->npol = max(npols); 109 header_->nbeam = nBeam_; 110 111 Int status = reader_->getHeader(header_->observer, header_->project, 112 header_->antennaname, header_->antennaposition, 113 header_->obstype, 114 header_->fluxunit, 115 header_->equinox, 116 header_->freqref, 117 header_->utc, header_->reffreq, 118 header_->bandwidth); 104 STHeader header; 105 header.nchan = max(nchans); 106 header.npol = max(npols); 107 header.nbeam = nBeam_; 108 109 Int status = reader_->getHeader(header.observer, header.project, 110 header.antennaname, header.antennaposition, 111 header.obstype, 112 header.fluxunit, 113 header.equinox, 114 header.freqref, 115 header.utc, header.reffreq, 116 header.bandwidth); 119 117 120 118 if (status) { 121 delete reader_;122 119 reader_ = 0; 123 delete header_;124 header_ = 0;125 120 throw(AipsError("Failed to get header.")); 126 121 } 127 if ((header _->obstype).matches("*SW*")) {122 if ((header.obstype).matches("*SW*")) { 128 123 // need robust way here - probably read ahead of next timestamp 129 124 os << "Header indicates frequency switched observation.\n" … … 131 126 132 127 nIF_ = 1; 133 header _->obstype = String("fswitch");128 header.obstype = String("fswitch"); 134 129 } 135 130 // Determine Telescope and set brightness unit 136 131 137 132 Bool throwIt = False; 138 Instrument inst = STAttr::convertInstrument(header _->antennaname, throwIt);133 Instrument inst = STAttr::convertInstrument(header.antennaname, throwIt); 139 134 140 135 if (inst==ATMOPRA || inst==TIDBINBILLA) { 141 header _->fluxunit = "K";136 header.fluxunit = "K"; 142 137 } else { 143 138 // downcase for use with Quanta 144 if (header _->fluxunit == "JY") {145 header _->fluxunit = "Jy";139 if (header.fluxunit == "JY") { 140 header.fluxunit = "Jy"; 146 141 } 147 142 } 148 143 STAttr stattr; 149 header _->poltype = stattr.feedPolType(inst);150 header _->nif = nIF_;151 header _->epoch = "UTC";152 // *** header _->frequnit = "Hz"144 header.poltype = stattr.feedPolType(inst); 145 header.nif = nIF_; 146 header.epoch = "UTC"; 147 // *** header.frequnit = "Hz" 153 148 // Apply selection criteria. 154 149 Vector<Int> ref; … … 158 153 Bool getPt = False; 159 154 reader_->select(beams, ifs, start, end, ref, True, haveXPol_[0], False, getPt); 160 setHeader( *header_);155 setHeader(header); 161 156 //For MS, add the location of POINTING of the input MS so one get 162 157 //pointing data from there, if necessary. … … 170 165 ptTabPath.append("/POINTING"); 171 166 table_->table().rwKeywordSet().define("POINTING", ptTabPath); 172 if ( (header_->antennaname).matches("GBT")) {167 if (header.antennaname.matches("GBT")) { 173 168 String GOTabPath = datapath.absoluteName(); 174 169 GOTabPath.append("/GBT_GO"); … … 176 171 } 177 172 } 178 String freqFrame = header _->freqref;173 String freqFrame = header.freqref; 179 174 //translate frequency reference frame back to 180 175 //MS style (as PKSMS2reader converts the original frame … … 197 192 // set both "FRAME" and "BASEFRAME" 198 193 table_->frequencies().setFrame(freqFrame, false); 199 table_->frequencies().setFrame(freqFrame, true);200 //table_->focus().setParallactify(true);194 table_->frequencies().setFrame(freqFrame, true); 195 table_->focus().setParallactify(true); 201 196 202 197 return true; … … 205 200 void PKSFiller::close( ) 206 201 { 207 if (reader_ != 0) { 208 delete reader_; 209 reader_=0; 210 } 211 212 if (header_ != 0) { 213 delete header_; 214 header_=0; 202 if (reader_.null() != False) { 203 reader_ = 0; 215 204 } 216 205 table_ = 0; … … 245 234 int n = 0; 246 235 bool isGBTFITS = false ; 247 if (( header_->antennaname.find( "GBT" ) != String::npos)236 if ((table_->getAntennaName().find( "GBT" ) != String::npos) 248 237 && File(filename_).isRegular()) { 249 238 FILE *fp = fopen( filename_.c_str(), "r" ) ; … … 265 254 Regex filterrx(".*[SL|PA]$"); 266 255 Regex obsrx("^AT.+"); 267 if ( header_->antennaname.matches(obsrx) &&256 if ( table_->getAntennaName().matches(obsrx) && 268 257 pksrec.obsType.matches(filterrx)) { 269 258 //cerr << "ignoring paddle scan" << endl; -
branches/newfiller/src/PKSFiller.h
r1811 r1815 46 46 PKSFiller& operator=(const PKSFiller&); 47 47 48 PKSreader* reader_; 49 STHeader* header_; 48 casa::CountedPtr<PKSreader> reader_; 50 49 casa::String filename_; 51 50 casa::Int nIF_, nBeam_, nPol_, nChan_, nInDataRow;
Note:
See TracChangeset
for help on using the changeset viewer.