Changeset 453 for trunk/src


Ignore:
Timestamp:
02/16/05 12:26:36 (20 years ago)
Author:
mar637
Message:

Added SDFitTable

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/SDContainer.cc

    r449 r453  
    225225
    226226
    227 Bool SDContainer::setFlags (const Matrix<uChar>& flags,
    228                             uInt whichBeam, uInt whichIF,
    229                             Bool hasXPol)
     227Bool SDContainer::setFlags(const Matrix<uChar>& flags,
     228                           uInt whichBeam, uInt whichIF,
     229                           Bool hasXPol)
    230230//
    231231// flags is [nChan,nPol]
     
    478478}
    479479
    480 void SDContainer::setSlice (IPosition& start, IPosition& end,
    481                             const IPosition& shpIn, const IPosition& shpOut,
    482                             uInt whichBeam, uInt whichIF, Bool tSys,
    483                             Bool xPol) const
     480Bool SDContainer::putFitMap(const Array<Int>& arr) {
     481  fitIDMap_.resize();
     482  fitIDMap_ = arr;
     483  return True;
     484}
     485
     486void SDContainer::setSlice(IPosition& start, IPosition& end,
     487                           const IPosition& shpIn, const IPosition& shpOut,
     488                           uInt whichBeam, uInt whichIF, Bool tSys,
     489                           Bool xPol) const
    484490//
    485491// tSYs
     
    502508  }
    503509//
    504   setSlice (start, end, shpOut, whichBeam, whichIF);
    505 }
    506 
    507 
    508 void SDContainer::setSlice (IPosition& start, IPosition& end, const IPosition& shape,
    509                             uInt whichBeam, uInt whichIF) const
     510  setSlice(start, end, shpOut, whichBeam, whichIF);
     511}
     512
     513
     514void SDContainer::setSlice(IPosition& start, IPosition& end,
     515                           const IPosition& shape,
     516                           uInt whichBeam, uInt whichIF) const
    510517{
    511518  AlwaysAssert(asap::nAxes==4,AipsError);
    512 //
     519  //
    513520  start.resize(asap::nAxes);
    514521  start = 0;
     
    575582}
    576583
     584// SDFitTable
     585
     586
     587const Vector<Double>& SDFitTable::getFitParameters(uInt whichRow) const
     588{
     589  if (whichRow <= n_)
     590    return fitParms_[whichRow];
     591}
     592
     593const Vector<Bool>& SDFitTable::getFitParameterMask(uInt whichRow) const
     594{
     595  if (whichRow <= n_)
     596    return parMask_[whichRow];
     597}
     598
     599const Vector<Int>& SDFitTable::getFitComponents(uInt whichRow) const
     600{
     601  if (whichRow <= n_)
     602    return fitComps_[whichRow];
     603}
     604
     605const Vector<String>& SDFitTable::getFitFunctions(uInt whichRow) const
     606{
     607  if (whichRow <= n_)
     608    return fitFuncs_[whichRow];
     609}
     610
     611void SDFitTable::putFitParameters(uInt whichRow, const Vector<Double>& arr)
     612{
     613  if (whichRow <= n_)
     614    fitParms_[whichRow] = arr;
     615}
     616
     617void SDFitTable::putFitParameterMask(uInt whichRow, const Vector<Bool>& arr)
     618{
     619  if (whichRow <= n_)
     620    parMask_[whichRow] = arr;
     621}
     622
     623void SDFitTable::putFitComponents(uInt whichRow, const Vector<Int>& arr)
     624{
     625  if (whichRow <= n_)
     626    fitComps_[whichRow] = arr;
     627}
     628void SDFitTable::putFitFunctions(uInt whichRow, const Vector<String>& arr)
     629{
     630  if (whichRow <= n_)
     631    fitFuncs_[whichRow] = arr;
     632}
    577633
    578634
    579635// SDDataDesc
    580636
    581 uInt SDDataDesc::addEntry (const String& source, uInt ID,
    582                            const MDirection& dir, uInt secID)
     637uInt SDDataDesc::addEntry(const String& source, uInt ID,
     638                          const MDirection& dir, uInt secID)
    583639{
    584640
     
    618674   }
    619675}
     676
  • trunk/src/SDContainer.h

    r449 r453  
    7373  virtual ~SDFrequencyTable() {;}
    7474
    75 // Add a new entry or match an existing one. Returns the index into the table
     75  // Add a new entry or match an existing one. Returns the index into
     76  // the table
    7677  casa::uInt addFrequency(casa::Double refPix, casa::Double refVal,
    77                          casa::Double inc);
    78 // 
    79   casa::Int length() const { return nFreq_;}          // # of stored Frequencies
     78                          casa::Double inc);
     79
     80  casa::Int length() const { return nFreq_;}  // # of stored Frequencies
    8081  void setLength(casa::uInt length) {nFreq_ = length;}
    8182
    82 // Get attributes
     83  // Get attributes
    8384  casa::Double referencePixel(casa::uInt which) const { return refPix_[which];}
    8485  casa::Double referenceValue(casa::uInt which) const { return refVal_[which];}
     
    8687  casa::Float equinox() const { return equinox_; }
    8788  casa::String refFrame() const { return refFrame_; }
    88 //
     89 
    8990  void restFrequencies(casa::Vector<casa::Double>& rfs,
    9091                       casa::String& rfunit ) const ;
    9192
    92 // Set attributes
     93  // Set attributes
    9394  void setEquinox(casa::Float eq) { equinox_ = eq; }
    9495  void setRefFrame(const casa::String& reff) { refFrame_ = reff; }
    95 //
    96   void deleteRestFrequencies () {restFreqs_.resize(0);}
     96
     97  void deleteRestFrequencies() {restFreqs_.resize(0);}
    9798  casa::uInt addRestFrequency(casa::Double);
    98   void setRestFrequencyUnit(const casa::String& theunit) {restFreqUnit_ = theunit;}
     99  void setRestFrequencyUnit(const casa::String& theunit)
     100  { restFreqUnit_ = theunit;}
    99101
    100102private:
     
    162164
    163165  const casa::Vector<casa::uInt>& getFreqMap() const { return freqidx_; }
    164   const casa::Vector<casa::uInt>& getRestFreqMap() const { return restfreqidx_; }
     166  const casa::Vector<casa::uInt>& getRestFreqMap() const
     167  { return restfreqidx_; }
    165168 
    166169  const casa::Vector<casa::String>& getHistory() const { return history_; }
    167170  casa::Bool putHistory(const casa::Vector<casa::String>& hist);
    168171  casa::Bool appendHistory(const casa::String& hist);
     172
     173  casa::Bool putFitMap(const casa::Array<casa::Int>& arr);
     174
     175  const casa::Array<casa::Int>& getFitMap() const { return fitIDMap_; }
     176
    169177
    170178  casa::Double timestamp;
     
    187195  casa::Array<casa::Float>    spectrum_; 
    188196  casa::Array<casa::uChar>    flags_;
     197
    189198  // (nBeam,nIF,nPol,[nChannel]) Tsys is not really a function of
    190199  // channel, but this makes it easier to work with at the expense of
     
    195204  //(nIF) indx into "global" frequency table
    196205  casa::Vector<casa::uInt>    freqidx_;
     206
    197207 // (nIF) indx into "global" rest frequency table
    198208  casa::Vector<casa::uInt>    restfreqidx_;
     209
    199210  //(nBeam,2) maybe use Measures here...
    200211  casa::Array<casa::Double>   direction_;
    201212  casa::Vector<casa::String> history_;
    202   void setSlice (casa::IPosition& start, casa::IPosition& end,
    203                  const casa::IPosition& shpIn, const casa::IPosition& shpOut,
    204                  casa::uInt whichBeam, casa::uInt whichIF, casa::Bool checkPol,
    205                  casa::Bool xPol) const;
    206   void setSlice (casa::IPosition& start, casa::IPosition& end,
    207                  const casa::IPosition& shape,
    208                  casa::uInt whichBeam, casa::uInt whichIF) const;
     213  casa::Array<casa::Int> fitIDMap_;
     214
     215  void setSlice(casa::IPosition& start, casa::IPosition& end,
     216                const casa::IPosition& shpIn, const casa::IPosition& shpOut,
     217                casa::uInt whichBeam, casa::uInt whichIF, casa::Bool checkPol,
     218                casa::Bool xPol) const;
     219  void setSlice(casa::IPosition& start, casa::IPosition& end,
     220                const casa::IPosition& shape,
     221                casa::uInt whichBeam, casa::uInt whichIF) const;
    209222};
    210223
     
    215228public:
    216229
    217 // COnstructor
     230  // Constructor
    218231  SDDataDesc() : n_(0) {;}
    219232  ~SDDataDesc() {;}
    220233
    221 // Add an entry if source name and Integer ID (can be anything you like, such
    222 // as FreqID) are unique.  You can add secondary entries direction
    223 // and another integer index which are just stored along with the
    224 // the primary entries
    225   casa::uInt addEntry (const casa::String& source, casa::uInt ID,
    226                        const casa::MDirection& secDir, casa::uInt secID);
    227 
    228 // Number of entries
     234  // Add an entry if source name and Integer ID (can be anything you
     235  // like, such as FreqID) are unique.  You can add secondary entries
     236  // direction and another integer index which are just stored along
     237  // with the the primary entries
     238  casa::uInt addEntry(const casa::String& source, casa::uInt ID,
     239                      const casa::MDirection& secDir, casa::uInt secID);
     240
     241  // Number of entries
    229242  casa::Int length() const { return n_;}
    230 
    231 // Get attributes
    232   casa::String source (casa::uInt which) const {return source_[which];}
     243 
     244  // Get attributes
     245  casa::String source(casa::uInt which) const {return source_[which];}
    233246  casa::uInt ID(casa::uInt which) const {return ID_[which];}
    234247  casa::uInt secID(casa::uInt which) const {return secID_[which];}
    235   casa::MDirection secDir (casa::uInt which) const {return secDir_[which];}
    236 
    237 // Summary
     248  casa::MDirection secDir(casa::uInt which) const {return secDir_[which];}
     249 
     250  // Summary
    238251  void summary() const;
    239252
     
    243256  casa::Vector<casa::uInt> ID_, secID_;
    244257  casa::Block<casa::MDirection> secDir_;
    245 //
     258
    246259  SDDataDesc(const SDDataDesc& other);
     260
     261};
     262
     263class SDFitTable {
     264public:
     265  // Create a FitTable with "n" rows
     266  SDFitTable(casa::uInt n=0) : n_(n) {;};
     267 
     268  casa::uInt length() const { return n_; };
     269  const casa::Vector<casa::Double>& getFitParameters(casa::uInt which) const;
     270  const casa::Vector<casa::Bool>& getFitParameterMask(casa::uInt which) const;
     271  const casa::Vector<casa::String>& getFitFunctions(casa::uInt which) const;
     272  const casa::Vector<casa::Int>& getFitComponents(casa::uInt which) const;
     273
     274  void putFitParameters(casa::uInt whichRow,
     275                        const casa::Vector<casa::Double>& arr);
     276  void putFitParameterMask(casa::uInt whichRow,
     277                           const casa::Vector<casa::Bool>& arr);
     278  void putFitFunctions(casa::uInt whichRow,
     279                       const casa::Vector<casa::String>& arr);
     280  void putFitComponents(casa::uInt whichRow,
     281                        const casa::Vector<casa::Int>& arr);
     282
     283private:
     284 
     285  casa::uInt n_;
     286  casa::Vector<casa::Vector<casa::Double> > fitParms_;
     287  // (npars,nrows)
     288  casa::Vector<casa::Vector<casa::Bool> > parMask_;
     289  // the fit function names (nnames,nrows)
     290  casa::Vector<casa::Vector<casa::String> > fitFuncs_;
     291  // the number of components of the function (ncomps, nrows)
     292  casa::Vector<casa::Vector<casa::Int> > fitComps_;
    247293
    248294};
Note: See TracChangeset for help on using the changeset viewer.