Changeset 34


Ignore:
Timestamp:
07/07/04 18:37:16 (20 years ago)
Author:
mmarquar
Message:

Added frequency information handling.

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/SDContainer.cc

    r27 r34  
    6565    spectrum_(IPosition(4,nBeam,nIF,nPol,nChan)),
    6666    flags_(IPosition(4,nBeam,nIF,nPol,nChan)),
    67     tsys_(IPosition(4,nBeam,nIF,nPol,nChan)) {
     67    tsys_(IPosition(4,nBeam,nIF,nPol,nChan)),
     68    freqidx_(nIF) {
    6869  uChar x = 0;
    6970  flags_ = ~x;
     
    7778    spectrum_(shp),
    7879    flags_(shp),
    79     tsys_(shp) {
     80    tsys_(shp),
     81    freqidx_(shp(1)){
    8082  uChar x = 0;
    8183  flags_ = ~x;
     
    174176}
    175177
    176 Array<Float> SDContainer::getSpectrum(uInt whichBeam, uInt whichIF) const
    177 {
     178const Array<Float>& SDContainer::getSpectrum(uInt whichBeam, uInt whichIF) const {
    178179  Matrix<Float> spectra(nChan_, nPol_);
    179180
     
    209210}
    210211
    211 Array<uChar> SDContainer::getFlags(uInt whichBeam, uInt whichIF) const
     212const Array<uChar>& SDContainer::getFlags(uInt whichBeam, uInt whichIF) const
    212213{
    213214  Matrix<uChar> flagtra(nChan_, nPol_);
     
    244245}
    245246
    246 Array<Float> SDContainer::getTsys(uInt whichBeam, uInt whichIF) const
     247const Array<Float>& SDContainer::getTsys(uInt whichBeam, uInt whichIF) const
    247248{
    248249  Vector<Float> tsys(nPol_);
     
    269270    o0++;
    270271  }
    271 
    272272  return tsys;
    273273}
     274
     275Bool SDContainer::setFrequencyMap(uInt freqslot, uInt whichIF) {
     276  freqidx_[whichIF] = freqslot;
     277  return True;
     278}
     279
     280Bool SDContainer::putFreqMap(const Vector<uInt>& freqs) {
     281  freqidx_.resize();
     282  freqidx_ = freqs;
     283  return True;
     284}
     285
     286Int SDFrequencyTable::addFrequency(Int refPix, Double refVal, Double inc) {
     287  Int idx = -1;
     288  Bool addit = False;
     289  if (length() > 0) {
     290    for (uInt i=0; i< length();++i) {
     291      if ( refVal == refVal_[i] ) { // probably check with tolerance
     292        if ( refPix == refPix_[i] )
     293          if ( inc == increment_[i] )
     294            idx = Int(i);
     295      }
     296    }
     297    if (idx >= 0) {
     298      return idx;
     299    }
     300  }
     301  nFreq_ += 1;
     302  refPix_.resize(nFreq_,True);
     303  refVal_.resize(nFreq_,True);
     304  increment_.resize(nFreq_,True);
     305  refPix_[nFreq_-1] = refPix;
     306  refVal_[nFreq_-1] = refVal;
     307  increment_[nFreq_-1] = inc;
     308  idx = nFreq_-1;
     309  return idx;
     310}
     311
  • trunk/src/SDContainer.h

    r27 r34  
    6666public:
    6767
    68   SDFrequencyTable() {;}
     68  SDFrequencyTable() : nFreq_(0) {;}
     69  virtual ~SDFrequencyTable() {;}
     70 
     71  Int length() const { return nFreq_;};// # of stored Frequencies
     72
     73  Double referencePixel(uInt which) const { return refPix_[which];}
     74  Double referenceValue(uInt which) const { return refVal_[which];}
     75  Double increment(uInt which) const { return increment_[which];}
     76  Float equinox() const { return equinox_; }
     77  String refFrame() const { return refFrame_; }
     78
    6979  // returns the index into the table
    7080  // this creates a new one or returns an existing one
    71   Int addFrequency(Double refPix, Double refVal, Double inc) {;}
    72  
    73   Int length() const { return nFreq_;};// # of stored Frequencies
    74   // returns a Table with nRows == nFreq, and three cols
     81  Int addFrequency(Int refPix, Double refVal, Double inc);
     82  void setEquinox(Float eq) { equinox_ = eq; }
     83  void setRefFrame(const String& reff) { refFrame_ = reff; }
    7584 
    7685private:
    7786  Int nFreq_;
    78   std::vector<double> refPix_;
    79   std::vector<double> revVal_;
    80   std::vector<double> increment_;
     87  Vector<Double> refPix_;
     88  Vector<Double> refVal_;
     89  Vector<Double> increment_;
     90  Float equinox_;
     91  String refFrame_;
    8192};
    8293
     
    104115  Bool setPointing(const Vector<Double>& point, uInt whichBeam) {;}
    105116
    106   Bool setFrequencyMap(uInt freqslot, uInt whichIF) {;}
     117  Bool setFrequencyMap(uInt freqslot, uInt whichIF);
     118  Bool putFreqMap(const Vector<uInt>& freqs);
    107119 
     120  const Array<Float>& getSpectrum(uInt whichBeam, uInt whichIF) const;
     121  const Array<uChar>& getFlags(uInt whichBeam, uInt whichIF) const;
     122  const Array<Float>& getTsys(uInt whichBeam, uInt whichIF) const;
     123
    108124  const Array<Float>& getSpectrum() const { return spectrum_; }
    109125  const Array<uChar>& getFlags() const { return flags_; }
    110126  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;
     127
     128  const Vector<uInt>& getFreqMap() const { return freqidx_; }
    115129
    116130  Double timestamp;
Note: See TracChangeset for help on using the changeset viewer.