Changeset 204
- Timestamp:
- 01/18/05 17:22:47 (20 years ago)
- Location:
- trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/SDContainer.cc
r125 r204 37 37 #include <casa/Quanta/MVTime.h> 38 38 39 #include "Definitions.h" 39 40 #include "SDContainer.h" 40 41 … … 121 122 uInt whichBeam, uInt whichIF) { 122 123 123 ArrayAccessor<Float, Axis< 0> > aa0(spectrum_);124 ArrayAccessor<Float, Axis<asap::BeamAxis> > aa0(spectrum_); 124 125 aa0.reset(aa0.begin(whichBeam)); 125 ArrayAccessor<Float, Axis< 1> > aa1(aa0);126 ArrayAccessor<Float, Axis<asap::IFAxis> > aa1(aa0); 126 127 aa1.reset(aa1.begin(whichIF)); 127 128 128 129 //Vector<Float> pols(nPol); 129 ArrayAccessor<Float, Axis< 1> > j(spec);130 ArrayAccessor<Float, Axis<asap::IFAxis> > j(spec); 130 131 IPosition shp0 = spectrum_.shape(); 131 132 IPosition shp1 = spec.shape(); … … 135 136 } 136 137 // assert dimensions are the same.... 137 for (ArrayAccessor<Float, Axis< 2> > i(aa1);i != i.end(); ++i) {138 ArrayAccessor<Float, Axis< 0> > jj(j);139 for (ArrayAccessor<Float, Axis< 3> > ii(i);ii != ii.end(); ++ii) {138 for (ArrayAccessor<Float, Axis<asap::PolAxis> > i(aa1);i != i.end(); ++i) { 139 ArrayAccessor<Float, Axis<asap::BeamAxis> > jj(j); 140 for (ArrayAccessor<Float, Axis<asap::ChanAxis> > ii(i);ii != ii.end(); ++ii) { 140 141 (*ii) = (*jj); 141 142 jj++; … … 156 157 uInt whichBeam, uInt whichIF) { 157 158 158 ArrayAccessor<uChar, Axis< 0> > aa0(flags_);159 ArrayAccessor<uChar, Axis<asap::BeamAxis> > aa0(flags_); 159 160 aa0.reset(aa0.begin(whichBeam)); 160 ArrayAccessor<uChar, Axis< 1> > aa1(aa0);161 ArrayAccessor<uChar, Axis<asap::IFAxis> > aa1(aa0); 161 162 aa1.reset(aa1.begin(whichIF)); 162 163 163 ArrayAccessor<uChar, Axis< 1> > j(flag);164 ArrayAccessor<uChar, Axis<asap::IFAxis> > j(flag); 164 165 IPosition shp0 = flags_.shape(); 165 166 IPosition shp1 = flag.shape(); … … 170 171 171 172 // assert dimensions are the same.... 172 for (ArrayAccessor<uChar, Axis< 2> > i(aa1);i != i.end(); ++i) {173 ArrayAccessor<uChar, Axis< 0> > jj(j);174 for (ArrayAccessor<uChar, Axis< 3> > ii(i);ii != ii.end(); ++ii) {173 for (ArrayAccessor<uChar, Axis<asap::PolAxis> > i(aa1);i != i.end(); ++i) { 174 ArrayAccessor<uChar, Axis<asap::BeamAxis> > jj(j); 175 for (ArrayAccessor<uChar, Axis<asap::ChanAxis> > ii(i);ii != ii.end(); ++ii) { 175 176 (*ii) = (*jj); 176 177 jj++; … … 183 184 Bool SDContainer::setTsys(const Vector<Float>& tsys, 184 185 uInt whichBeam, uInt whichIF) { 185 ArrayAccessor<Float, Axis< 0> > aa0(tsys_);186 ArrayAccessor<Float, Axis<asap::BeamAxis> > aa0(tsys_); 186 187 aa0.reset(aa0.begin(whichBeam)); 187 ArrayAccessor<Float, Axis< 1> > aa1(aa0);188 ArrayAccessor<Float, Axis<asap::IFAxis> > aa1(aa0); 188 189 aa1.reset(aa1.begin(whichIF)); 189 190 // assert dimensions are the same.... 190 for (ArrayAccessor<Float, Axis< 3> > i(aa1);i != i.end(); ++i) {191 ArrayAccessor<Float, Axis< 0> > j(tsys);192 for (ArrayAccessor<Float, Axis< 2> > ii(i);ii != ii.end(); ++ii) {191 for (ArrayAccessor<Float, Axis<asap::ChanAxis> > i(aa1);i != i.end(); ++i) { 192 ArrayAccessor<Float, Axis<asap::BeamAxis> > j(tsys); 193 for (ArrayAccessor<Float, Axis<asap::PolAxis> > ii(i);ii != ii.end(); ++ii) { 193 194 (*ii) = (*j); 194 195 j++; … … 202 203 203 204 // Beam. 204 ArrayAccessor<Float, Axis< 0> > i0(spectrum_);205 ArrayAccessor<Float, Axis<asap::BeamAxis> > i0(spectrum_); 205 206 i0.reset(i0.begin(whichBeam)); 206 207 207 208 // IF. 208 ArrayAccessor<Float, Axis< 1> > i1(i0);209 ArrayAccessor<Float, Axis<asap::IFAxis> > i1(i0); 209 210 i1.reset(i1.begin(whichIF)); 210 211 211 212 // Polarization. 212 ArrayAccessor<Float, Axis< 2> > i2(i1);213 ArrayAccessor<Float, Axis< 1> > o1(spectra);213 ArrayAccessor<Float, Axis<asap::PolAxis> > i2(i1); 214 ArrayAccessor<Float, Axis<asap::IFAxis> > o1(spectra); 214 215 215 216 while (i2 != i2.end()) { 216 217 // Channel. 217 ArrayAccessor<Float, Axis< 3> > i3(i2);218 ArrayAccessor<Float, Axis< 0> > o0(o1);218 ArrayAccessor<Float, Axis<asap::ChanAxis> > i3(i2); 219 ArrayAccessor<Float, Axis<asap::BeamAxis> > o0(o1); 219 220 220 221 while (i3 != i3.end()) { … … 238 239 239 240 // Beam. 240 ArrayAccessor<uChar, Axis< 0> > i0(flags_);241 ArrayAccessor<uChar, Axis<asap::BeamAxis> > i0(flags_); 241 242 i0.reset(i0.begin(whichBeam)); 242 243 243 244 // IF. 244 ArrayAccessor<uChar, Axis< 1> > i1(i0);245 ArrayAccessor<uChar, Axis<asap::IFAxis> > i1(i0); 245 246 i1.reset(i1.begin(whichIF)); 246 247 247 248 // Polarization. 248 ArrayAccessor<uChar, Axis< 2> > i2(i1);249 ArrayAccessor<uChar, Axis< 1> > o1(flagtra);249 ArrayAccessor<uChar, Axis<asap::PolAxis> > i2(i1); 250 ArrayAccessor<uChar, Axis<asap::IFAxis> > o1(flagtra); 250 251 251 252 while (i2 != i2.end()) { 252 253 // Channel. 253 ArrayAccessor<uChar, Axis< 3> > i3(i2);254 ArrayAccessor<uChar, Axis< 0> > o0(o1);254 ArrayAccessor<uChar, Axis<asap::ChanAxis> > i3(i2); 255 ArrayAccessor<uChar, Axis<asap::BeamAxis> > o0(o1); 255 256 256 257 while (i3 != i3.end()) { … … 273 274 274 275 // Beam. 275 ArrayAccessor<Float, Axis< 0> > i0(tsys_);276 ArrayAccessor<Float, Axis<asap::BeamAxis> > i0(tsys_); 276 277 i0.reset(i0.begin(whichBeam)); 277 278 278 279 // IF. 279 ArrayAccessor<Float, Axis< 1> > i1(i0);280 ArrayAccessor<Float, Axis<asap::IFAxis> > i1(i0); 280 281 i1.reset(i1.begin(whichIF)); 281 282 282 283 // Channel. 283 ArrayAccessor<Float, Axis< 3> > i3(i1);284 ArrayAccessor<Float, Axis<asap::ChanAxis> > i3(i1); 284 285 285 286 // Polarization. 286 ArrayAccessor<Float, Axis< 2> > i2(i3);287 ArrayAccessor<Float, Axis< 0> > o0(tsys);287 ArrayAccessor<Float, Axis<asap::PolAxis> > i2(i3); 288 ArrayAccessor<Float, Axis<asap::BeamAxis> > o0(tsys); 288 289 289 290 while (i2 != i2.end()) { … … 298 299 Array<Double> SDContainer::getDirection(uInt whichBeam) const { 299 300 Vector<Double> direct(2); 300 ArrayAccessor<Double, Axis< 0> > i0(direction_);301 ArrayAccessor<Double, Axis<asap::BeamAxis> > i0(direction_); 301 302 i0.reset(i0.begin(whichBeam)); 302 ArrayAccessor<Double, Axis< 0> > o0(direct);303 ArrayAccessor<Double, Axis< 1> > i1(i0);303 ArrayAccessor<Double, Axis<asap::BeamAxis> > o0(direct); 304 ArrayAccessor<Double, Axis<asap::IFAxis> > i1(i0); 304 305 while (i1 != i1.end()) { 305 306 *o0 = *i1; … … 324 325 Bool SDContainer::setDirection(const Vector<Double>& point, uInt whichBeam) { 325 326 if (point.nelements() != 2) return False; 326 ArrayAccessor<Double, Axis< 0> > aa0(direction_);327 ArrayAccessor<Double, Axis<asap::BeamAxis> > aa0(direction_); 327 328 aa0.reset(aa0.begin(whichBeam)); 328 ArrayAccessor<Double, Axis< 0> > jj(point);329 for (ArrayAccessor<Double, Axis< 1> > i(aa0);i != i.end(); ++i) {329 ArrayAccessor<Double, Axis<asap::BeamAxis> > jj(point); 330 for (ArrayAccessor<Double, Axis<asap::IFAxis> > i(aa0);i != i.end(); ++i) { 330 331 331 332 (*i) = (*jj); … … 338 339 direction_.resize(); 339 340 direction_ = dir; 341 return True; 342 } 343 344 Bool SDContainer::appendHistory(const String& hist) 345 { 346 history_.resize(history_.nelements()+1,True); 347 history_[history_.nelements()-1] = hist; 348 return True; 349 } 350 Bool SDContainer::putHistory(const Vector<String>& hist) 351 { 352 history_.resize(); 353 history_ = hist; 340 354 return True; 341 355 } … … 367 381 } 368 382 383 void SDFrequencyTable::addRestFrequency(Double val) 384 { 385 if (restFreqs_.nelements() == 0) { 386 restFreqs_.resize(1); 387 restFreqs_[0] = val; 388 } else { 389 Bool found = False; 390 for (uInt i=0;i<restFreqs_.nelements();++i) { 391 if (restFreqs_[i] == val) { 392 found = True; 393 return; 394 } 395 } 396 if (!found) { 397 restFreqs_.resize(restFreqs_.nelements()+1,True); 398 restFreqs_[restFreqs_.nelements()-1] = val; 399 } 400 } 401 } 402 void SDFrequencyTable::restFrequencies(Vector<Double>& rfs, 403 String& rfunit ) const 404 { 405 rfs.resize(restFreqs_.nelements()); 406 rfs = restFreqs_; 407 rfunit = restFreqUnit_; 408 } -
trunk/src/SDContainer.h
r125 r204 59 59 casa::Double bandwidth; 60 60 casa::Double utc; 61 casa::String fluxunit; 62 casa::String epoch; 61 63 void print() const ; 62 64 }; … … 76 78 casa::Float equinox() const { return equinox_; } 77 79 casa::String refFrame() const { return refFrame_; } 80 void restFrequencies(casa::Vector<casa::Double>& rfs, 81 casa::String& rfunit ) const ; 78 82 79 83 // returns the index into the table … … 83 87 void setEquinox(casa::Float eq) { equinox_ = eq; } 84 88 void setRefFrame(const casa::String& reff) { refFrame_ = reff; } 85 89 void addRestFrequency(casa::Double); 90 void setRestFrequencyUnit(const casa::String& theunit) { 91 restFreqUnit_ = theunit; 92 }; 93 86 94 private: 87 95 casa::Int nFreq_; … … 91 99 casa::Float equinox_; 92 100 casa::String refFrame_; 101 casa::Vector<casa::Double> restFreqs_; 102 casa::String restFreqUnit_; 93 103 }; 94 104 … … 139 149 const casa::Vector<casa::uInt>& getFreqMap() const { return freqidx_; } 140 150 151 const casa::Vector<casa::String>& getHistory() const { return history_; } 152 casa::Bool putHistory(const casa::Vector<casa::String>& hist); 153 casa::Bool appendHistory(const casa::String& hist); 154 141 155 casa::Double timestamp; 142 156 //Double bandwidth; … … 168 182 //(nBeam,2) maybe use Measures here... 169 183 casa::Array<casa::Double> direction_; 184 casa::Vector<casa::String> history_; 170 185 171 186 };
Note:
See TracChangeset
for help on using the changeset viewer.