- Timestamp:
- 11/29/05 14:15:44 (19 years ago)
- Location:
- trunk/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/SDContainer.h
r483 r754 75 75 // Add a new entry or match an existing one. Returns the index into 76 76 // the table 77 casa::uInt addFrequency(casa::Double refPix, casa::Double refVal, 78 77 casa::uInt addFrequency(casa::Double refPix, casa::Double refVal, 78 casa::Double inc); 79 79 80 80 casa::Int length() const { return nFreq_;} // # of stored Frequencies … … 87 87 casa::Float equinox() const { return equinox_; } 88 88 casa::String refFrame() const { return refFrame_; } 89 90 void restFrequencies(casa::Vector<casa::Double>& rfs, 91 casa::String& rfunit ) const ; 89 casa::String baseRefFrame() const { return baseRefFrame_; } 90 casa::String unit() const { return unit_; } 91 92 void restFrequencies(casa::Vector<casa::Double>& rfs, 93 casa::String& rfunit ) const ; 92 94 93 95 // Set attributes 94 96 void setEquinox(casa::Float eq) { equinox_ = eq; } 95 97 void setRefFrame(const casa::String& reff) { refFrame_ = reff; } 98 void setBaseRefFrame(const casa::String& reff) { baseRefFrame_ = reff; } 99 void setUnit(const casa::String& un) { unit_= un; } 96 100 97 101 void deleteRestFrequencies() {restFreqs_.resize(0);} 98 102 casa::uInt addRestFrequency(casa::Double); 99 void setRestFrequencyUnit(const casa::String& theunit) 103 void setRestFrequencyUnit(const casa::String& theunit) 100 104 { restFreqUnit_ = theunit;} 101 105 … … 106 110 casa::Vector<casa::Double> increment_; // Hz 107 111 casa::Float equinox_; 112 casa::String unit_; 108 113 casa::String refFrame_; 114 casa::String baseRefFrame_; 109 115 casa::Vector<casa::Double> restFreqs_; // Hz 110 116 casa::String restFreqUnit_; … … 115 121 116 122 public: 117 SDContainer(casa::uInt nBeam, casa::uInt nIF, casa::uInt nPol, 118 123 SDContainer(casa::uInt nBeam, casa::uInt nIF, casa::uInt nPol, 124 casa::uInt nChan); 119 125 SDContainer(casa::IPosition shp); 120 126 … … 124 130 125 131 casa::Bool setSpectrum(const casa::Matrix<casa::Float>& spec, 126 132 casa::uInt whichBeam, casa::uInt whichIF); 127 133 casa::Bool setSpectrum(const casa::Matrix<casa::Float>& spec, 128 134 const casa::Vector<casa::Complex>& cSpec, 129 135 casa::uInt whichBeam, casa::uInt whichIF); 130 136 casa::Bool putSpectrum(const casa::Array<casa::Float>& spec); 131 137 132 138 casa::Bool setFlags(const casa::Matrix<casa::uChar>& flgs, 133 139 casa::uInt whichBeam, casa::uInt whichIF, 134 140 casa::Bool hasXPol=casa::False); 135 141 casa::Bool putFlags(const casa::Array<casa::uChar>& spec); 136 142 137 casa::Bool setTsys(const casa::Vector<casa::Float>& ts, 138 143 casa::Bool setTsys(const casa::Vector<casa::Float>& ts, 144 casa::uInt whichBeam, casa::uInt whichIF, 139 145 casa::Bool hasXpol); 140 146 casa::Bool putTsys(const casa::Array<casa::Float>& spec); 141 147 142 casa::Bool setDirection(const casa::Vector<casa::Double>& point, 143 148 casa::Bool setDirection(const casa::Vector<casa::Double>& point, 149 casa::uInt whichBeam); 144 150 casa::Bool putDirection(const casa::Array<casa::Double>& dir); 145 151 … … 149 155 casa::Bool setRestFrequencyMap(casa::uInt freqslot, casa::uInt whichIF); 150 156 casa::Bool putRestFreqMap(const casa::Vector<casa::uInt>& freqs); 151 152 casa::Array<casa::Float> getSpectrum(casa::uInt whichBeam, 153 154 casa::Array<casa::uChar> getFlags(casa::uInt whichBeam, 155 156 casa::Array<casa::Float> getTsys(casa::uInt whichBeam, 157 157 158 casa::Array<casa::Float> getSpectrum(casa::uInt whichBeam, 159 casa::uInt whichIF); 160 casa::Array<casa::uChar> getFlags(casa::uInt whichBeam, 161 casa::uInt whichIF); 162 casa::Array<casa::Float> getTsys(casa::uInt whichBeam, 163 casa::uInt whichIF); 158 164 casa::Array<casa::Double> getDirection(casa::uInt whichBeam) const; 159 165 … … 164 170 165 171 const casa::Vector<casa::uInt>& getFreqMap() const { return freqidx_; } 166 const casa::Vector<casa::uInt>& getRestFreqMap() const 172 const casa::Vector<casa::uInt>& getRestFreqMap() const 167 173 { return restfreqidx_; } 168 174 169 175 casa::Bool putFitMap(const casa::Array<casa::Int>& arr); 170 176 … … 189 195 190 196 // (nBeam,nIF,nPol,nChannel) 191 casa::Array<casa::Float> spectrum_; 197 casa::Array<casa::Float> spectrum_; 192 198 casa::Array<casa::uChar> flags_; 193 199 … … 209 215 210 216 void setSlice(casa::IPosition& start, casa::IPosition& end, 211 212 213 217 const casa::IPosition& shpIn, const casa::IPosition& shpOut, 218 casa::uInt whichBeam, casa::uInt whichIF, casa::Bool checkPol, 219 casa::Bool xPol) const; 214 220 void setSlice(casa::IPosition& start, casa::IPosition& end, 215 const casa::IPosition& shape, 216 221 const casa::IPosition& shape, 222 casa::uInt whichBeam, casa::uInt whichIF) const; 217 223 }; 218 224 … … 232 238 // with the the primary entries 233 239 casa::uInt addEntry(const casa::String& source, casa::uInt ID, 234 240 const casa::MDirection& secDir, casa::uInt secID); 235 241 236 242 // Number of entries 237 243 casa::Int length() const { return n_;} 238 244 239 245 // Get attributes 240 246 casa::String source(casa::uInt which) const {return source_[which];} … … 242 248 casa::uInt secID(casa::uInt which) const {return secID_[which];} 243 249 casa::MDirection secDir(casa::uInt which) const {return secDir_[which];} 244 250 245 251 // Summary 246 252 void summary() const; -
trunk/src/SDMemTable.cc
r745 r754 533 533 dpl = theinfo[2]; // Doppler 534 534 brfrm = theinfo[3]; // Base frame 535 536 535 Table t = table_.rwKeywordSet().asTable("FREQUENCIES"); 537 536 … … 977 976 String rf = sdft.refFrame(); 978 977 if (rf.contains("TOPO")) rf = "TOPO"; 979 980 aTable.rwKeywordSet().define("BASEREFFRAME", rf); 978 String brf = sdft.baseRefFrame(); 979 if (brf.contains("TOPO")) brf = "TOPO"; 980 981 aTable.rwKeywordSet().define("BASEREFFRAME", brf); 981 982 aTable.rwKeywordSet().define("REFFRAME", rf); 982 983 aTable.rwKeywordSet().define("EQUINOX", sdft.equinox()); 983 aTable.rwKeywordSet().define("UNIT", String(""));984 aTable.rwKeywordSet().define("UNIT", sdft.unit()); 984 985 aTable.rwKeywordSet().define("DOPPLER", String("RADIO")); 985 986 Vector<Double> rfvec; … … 1181 1182 // is the correct frame. It might be 'REFFRAME' 1182 1183 // rather than 'BASEREFFRAME' ? 1183 String baseFrame; 1184 t.keywordSet().get("BASEREFFRAME",baseFrame); 1185 sdft.setRefFrame(baseFrame); 1184 String frame; 1185 t.keywordSet().get("REFFRAME",frame); 1186 sdft.setRefFrame(frame); 1187 t.keywordSet().get("BASEREFFRAME",frame); 1188 sdft.setBaseRefFrame(frame); 1186 1189 1187 1190 // Equinox … … 1189 1192 t.keywordSet().get("EQUINOX", equinox); 1190 1193 sdft.setEquinox(equinox); 1194 1195 String unit; 1196 t.keywordSet().get("UNIT", unit); 1197 sdft.setUnit(unit); 1191 1198 1192 1199 // Rest Frequency -
trunk/src/SDReader.cc
r717 r754 54 54 cursor_ = 0; 55 55 } 56 SDReader::SDReader(const std::string& filename, 56 SDReader::SDReader(const std::string& filename, 57 57 int whichIF, int whichBeam) : 58 58 reader_(0), … … 77 77 SDReader::~SDReader() { 78 78 if (reader_) delete reader_; 79 if (header_) delete header_; 79 if (header_) delete header_; 80 80 if (frequencies_) delete frequencies_; 81 81 } … … 92 92 } 93 93 94 void SDReader::open(const std::string& filename, 94 void SDReader::open(const std::string& filename, 95 95 int whichIF, int whichBeam) { 96 96 if (reader_) delete reader_; reader_ = 0; … … 151 151 // need robust way here - probably read ahead of next timestamp 152 152 pushLog("Header indicates frequency switched observation.\n" 153 153 "setting # of IFs = 1 "); 154 154 nIF_ = 1; 155 155 } … … 206 206 frequencies_ = new SDFrequencyTable(); 207 207 frequencies_->setRefFrame(header_->freqref); 208 frequencies_->setBaseRefFrame(header_->freqref); 208 209 frequencies_->setRestFrequencyUnit("Hz"); 209 210 frequencies_->setEquinox(header_->equinox); … … 252 253 // Make sure beam/IF numbers are 0-relative - dealing with 253 254 // possible IF or Beam selection 254 beamNo = beamNo - beamOffset_ - 1; 255 beamNo = beamNo - beamOffset_ - 1; 255 256 IFno = IFno - ifOffset_ - 1; 256 257 … … 258 259 if (status == -1) { 259 260 // EOF. 260 if (row > 0 && row < stepsize-1) 261 262 263 261 if (row > 0 && row < stepsize-1) 262 pushLog("incomplete scan data.\n Probably means not all Beams/IFs/Pols within a scan are present."); 263 264 // flush frequency table 264 265 table_->putSDFreqTable(*frequencies_); 265 266 return status; … … 277 278 sc.interval = interval; 278 279 sc.sourcename = srcName; 279 280 281 280 sc.fieldname = fieldName; 281 sc.azimuth = azimuth; 282 sc.elevation = elevation; 282 283 } 283 284 // add specific info … … 285 286 Int refPix = header_->nchan/2; // 0-rel 286 287 uInt freqID = frequencies_->addFrequency(refPix, refFreq, freqInc); 287 288 uInt restFreqID = frequencies_->addRestFrequency(restFreq); 288 289 289 290 sc.setFrequencyMap(freqID, IFno); 290 291 sc.setRestFrequencyMap(restFreqID, IFno); 291 292 292 293 294 295 296 297 298 299 293 sc.tcal[0] = tcal[0];sc.tcal[1] = tcal[1]; 294 sc.tcaltime = tcalTime; 295 sc.parangle = parAngle; 296 sc.refbeam = -1; //nbeams == 1 297 if (nBeam_ > 1) // circumvent a bug "asap0000" in read which 298 // returns a random refbema number on multiple 299 // reads 300 sc.refbeam = refBeam-1;//make it 0-based; 300 301 sc.scanid = scanNo-1;//make it 0-based 301 302 if (haveXPol_) {
Note:
See TracChangeset
for help on using the changeset viewer.