Changeset 1931 for trunk/src


Ignore:
Timestamp:
09/17/10 18:00:47 (14 years ago)
Author:
WataruKawasaki
Message:

New Development: No

JIRA Issue:

Ready for Test: Yes

Interface Changes: No

What Interface Changed:

Test Programs:

Put in Release Notes: No

Module(s): sdbaseline

Description: a new version of poly_baseline() by Malte


Location:
trunk/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/Scantable.cpp

    r1929 r1931  
    543543    // take the first POLNO,IFNO,CYCLENO as nbeam shouldn't vary with these
    544544    Table t = table_(table_.col("SCANNO") == scanno);
    545     if ( t.nrow() == 0 ) return 0 ;
    546545    ROTableRow row(t);
    547546    const TableRecord& rec = row.get(0);
     
    564563    // take the first POLNO,BEAMNO,CYCLENO as nbeam shouldn't vary with these
    565564    Table t = table_(table_.col("SCANNO") == scanno);
    566     if ( t.nrow() == 0 ) return 0 ;
    567565    ROTableRow row(t);
    568566    const TableRecord& rec = row.get(0);
     
    586584    // take the first POLNO,IFNO,CYCLENO as nbeam shouldn't vary with these
    587585    Table t = table_(table_.col("SCANNO") == scanno);
    588     if ( t.nrow() == 0 ) return 0 ;
    589586    ROTableRow row(t);
    590587    const TableRecord& rec = row.get(0);
     
    614611  } else {
    615612    Table t = table_(table_.col("SCANNO") == scanno);
    616     if ( t.nrow() == 0 ) return 0 ;
    617613    ROTableRow row(t);
    618614    const TableRecord& rec = row.get(0);
     
    17541750}
    17551751
    1756 void Scantable::polyBaselineBatch(const std::vector<bool>& mask, int order, int rowno)
     1752void Scantable::polyBaselineBatch(const std::vector<bool>& mask, int order)
     1753{
     1754  Fitter fitter = Fitter();
     1755  for (uInt rowno=0; rowno < nrow(); ++rowno) {
     1756    doPolyBaseline(mask, order, rowno, fitter);
     1757    setSpectrum(fitter.getResidual(), rowno);
     1758  }
     1759}
     1760
     1761STFitEntry Scantable::polyBaseline(const std::vector<bool>& mask, int order, int rowno)
    17571762{
    17581763  Fitter fitter = Fitter();
    17591764  doPolyBaseline(mask, order, rowno, fitter);
    17601765  setSpectrum(fitter.getResidual(), rowno);
    1761 }
    1762 
    1763 void Scantable::polyBaseline(const std::vector<bool>& mask, int order, int rowno, long pars_ptr, long pars_size, long errs_ptr, long errs_size, long fmask_ptr, long fmask_size)
    1764 {
    1765   Fitter fitter = Fitter();
    1766   doPolyBaseline(mask, order, rowno, fitter);
    1767   setSpectrum(fitter.getResidual(), rowno);
    1768 
    1769   std::vector<float> pars = fitter.getParameters();
    1770   if (pars_size != pars.size()) {
    1771     throw(AipsError("wrong pars size"));
    1772   }
    1773   float *ppars = reinterpret_cast<float*>(pars_ptr);
    1774   for (int i = 0; i < pars_size; i++) {
    1775     ppars[i] = pars[i];
    1776   }
    1777 
    1778   std::vector<float> errs = fitter.getErrors();
    1779   if (errs_size != errs.size()) {
    1780     throw(AipsError("wrong errors size"));
    1781   }
    1782   float *perrs = reinterpret_cast<float*>(errs_ptr);
    1783   for (int i = 0; i < errs_size; i++) {
    1784     perrs[i] = errs[i];
    1785   }
    1786 
    1787   std::vector<bool> fmask = getMask(rowno);
    1788   if (fmask_size != fmask.size()) {
    1789     throw(AipsError("wrong fmask size"));
    1790   }
    1791   int *pfmask = reinterpret_cast<int*>(fmask_ptr);
    1792   for (int i = 0; i < fmask_size; i++) {
    1793     pfmask[i] = ((fmask[i] && mask[i]) ? 1 : 0);
    1794   }
     1766  return fitter.getFitEntry();
    17951767}
    17961768
  • trunk/src/Scantable.h

    r1919 r1931  
    1818// AIPS++
    1919#include <casa/aips.h>
     20#include <casa/Containers/Record.h>
    2021#include <casa/Arrays/MaskedArray.h>
    2122#include <casa/BasicSL/String.h>
     
    489490  bool getFlagtraFast(int whichrow);
    490491
    491   void polyBaselineBatch(const std::vector<bool>& mask, int order, int rowno);
    492   void polyBaseline(const std::vector<bool>& mask, int order, int rowno, long pars_ptr, long pars_size, long errs_ptr, long errs_size, long fmask_ptr, long fmask_size);
    493 
     492  void polyBaselineBatch(const std::vector<bool>& mask, int order);
     493  STFitEntry polyBaseline(const std::vector<bool>& mask, int order, int rowno);
    494494
    495495private:
  • trunk/src/ScantableWrapper.h

    r1919 r1931  
    1919#include "MathUtils.h"
    2020#include "STFit.h"
     21#include "STFitEntry.h"
    2122#include "Scantable.h"
    2223#include "STCoordinate.h"
     
    250251  { table_->reshapeSpectrum( nmin, nmax ); }
    251252
    252   void polyBaseline(const std::vector<bool>& mask, int order, int rowno, long pars_ptr, long pars_size, long errs_ptr, long errs_size, long fmask_ptr, long fmask_size)
    253   { table_->polyBaseline(mask, order, rowno, pars_ptr, pars_size, errs_ptr, errs_size, fmask_ptr, fmask_size); }
    254 
    255   void polyBaselineBatch(const std::vector<bool>& mask, int order, int rowno)
    256   { table_->polyBaselineBatch(mask, order, rowno); }
     253  STFitEntry polyBaseline(const std::vector<bool>& mask, int order, int rowno)
     254  { return table_->polyBaseline(mask, order, rowno); }
     255
     256  void polyBaselineBatch(const std::vector<bool>& mask, int order)
     257  { table_->polyBaselineBatch(mask, order); }
    257258
    258259  bool getFlagtraFast(int whichrow=0) const
Note: See TracChangeset for help on using the changeset viewer.