Changeset 27 for trunk


Ignore:
Timestamp:
07/07/04 11:20:34 (20 years ago)
Author:
mcalabre
Message:

Added new member functions:

Array<Float> getSpectrum(uInt whichBeam, uInt whichIF) const;
Array<uChar> getFlags(uInt whichBeam, uInt whichIF) const;
Array<Float> getTsys(uInt whichBeam, uInt whichIF) const;

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/SDContainer.cc

    r18 r27  
    173173  }
    174174}
     175
     176Array<Float> SDContainer::getSpectrum(uInt whichBeam, uInt whichIF) const
     177{
     178  Matrix<Float> spectra(nChan_, nPol_);
     179
     180  // Beam.
     181  ArrayAccessor<Float, Axis<0> > i0(spectrum_);
     182  i0.reset(i0.begin(whichBeam));
     183
     184  // IF.
     185  ArrayAccessor<Float, Axis<1> > i1(i0);
     186  i1.reset(i1.begin(whichIF));
     187
     188  // Polarization.
     189  ArrayAccessor<Float, Axis<2> > i2(i1);
     190  ArrayAccessor<Float, Axis<1> > o1(spectra);
     191
     192  while (i2 != i2.end()) {
     193    // Channel.
     194    ArrayAccessor<Float, Axis<3> > i3(i2);
     195    ArrayAccessor<Float, Axis<0> > o0(o1);
     196
     197    while (i3 != i3.end()) {
     198      *o0 = *i3;
     199
     200      i3++;
     201      o0++;
     202    }
     203
     204    i2++;
     205    o1++;
     206  }
     207
     208  return spectra;
     209}
     210
     211Array<uChar> SDContainer::getFlags(uInt whichBeam, uInt whichIF) const
     212{
     213  Matrix<uChar> flagtra(nChan_, nPol_);
     214
     215  // Beam.
     216  ArrayAccessor<uChar, Axis<0> > i0(flags_);
     217  i0.reset(i0.begin(whichBeam));
     218
     219  // IF.
     220  ArrayAccessor<uChar, Axis<1> > i1(i0);
     221  i1.reset(i1.begin(whichIF));
     222
     223  // Polarization.
     224  ArrayAccessor<uChar, Axis<2> > i2(i1);
     225  ArrayAccessor<uChar, Axis<1> > o1(flagtra);
     226
     227  while (i2 != i2.end()) {
     228    // Channel.
     229    ArrayAccessor<uChar, Axis<3> > i3(i2);
     230    ArrayAccessor<uChar, Axis<0> > o0(o1);
     231
     232    while (i3 != i3.end()) {
     233      *o0 = *i3;
     234
     235      i3++;
     236      o0++;
     237    }
     238
     239    i2++;
     240    o1++;
     241  }
     242
     243  return flagtra;
     244}
     245
     246Array<Float> SDContainer::getTsys(uInt whichBeam, uInt whichIF) const
     247{
     248  Vector<Float> tsys(nPol_);
     249
     250  // Beam.
     251  ArrayAccessor<Float, Axis<0> > i0(tsys_);
     252  i0.reset(i0.begin(whichBeam));
     253
     254  // IF.
     255  ArrayAccessor<Float, Axis<1> > i1(i0);
     256  i1.reset(i1.begin(whichIF));
     257
     258  // Channel.
     259  ArrayAccessor<Float, Axis<3> > i3(i1);
     260
     261  // Polarization.
     262  ArrayAccessor<Float, Axis<2> > i2(i3);
     263  ArrayAccessor<Float, Axis<0> > o0(tsys);
     264
     265  while (i2 != i2.end()) {
     266    *o0 = *i2;
     267
     268    i2++;
     269    o0++;
     270  }
     271
     272  return tsys;
     273}
  • trunk/src/SDContainer.h

    r26 r27  
    109109  const Array<uChar>& getFlags() const { return flags_; }
    110110  const Array<Float>& getTsys() const { return tsys_; }
     111 
     112  Array<Float> getSpectrum(uInt whichBeam, uInt whichIF) const;
     113  Array<uChar> getFlags(uInt whichBeam, uInt whichIF) const;
     114  Array<Float> getTsys(uInt whichBeam, uInt whichIF) const;
    111115
    112116  Double timestamp;
Note: See TracChangeset for help on using the changeset viewer.