Ignore:
Timestamp:
02/08/13 22:23:22 (11 years ago)
Author:
WataruKawasaki
Message:

New Development: Yes

JIRA Issue: Yes CAS-4794

Ready for Test: Yes

Interface Changes: No

What Interface Changed:

Test Programs:

Put in Release Notes: No

Module(s): sd

Description: functions to apply/write STBaselineTable in which baseline parameters stored.


File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/STBaselineTable.cpp

    r2740 r2767  
    5151void STBaselineTable::setup()
    5252{
    53   table_.addColumn(ScalarColumnDesc<uInt>("NCHAN"));
     53  table_.addColumn(ScalarColumnDesc<Bool>("APPLY"));
    5454  table_.addColumn(ScalarColumnDesc<uInt>("FUNC_TYPE"));
    55   table_.addColumn(ArrayColumnDesc<uInt>("FUNC_PARAM"));
     55  table_.addColumn(ArrayColumnDesc<Int>("FUNC_PARAM"));
    5656  table_.addColumn(ArrayColumnDesc<Float>("FUNC_FPARAM"));
    57   table_.addColumn(ScalarColumnDesc<uInt>("CLIP_ITERATION"));
    58   table_.addColumn(ScalarColumnDesc<Float>("CLIP_THRESHOLD"));
    5957  table_.addColumn(ArrayColumnDesc<uInt>("MASKLIST"));
    6058  table_.addColumn(ArrayColumnDesc<Float>("RESULT"));
    6159  table_.addColumn(ScalarColumnDesc<Float>("RMS"));
     60  table_.addColumn(ScalarColumnDesc<uInt>("NCHAN"));
     61  table_.addColumn(ScalarColumnDesc<Float>("CLIP_THRESHOLD"));
     62  table_.addColumn(ScalarColumnDesc<uInt>("CLIP_ITERATION"));
     63  table_.addColumn(ScalarColumnDesc<Float>("LF_THRESHOLD"));
     64  table_.addColumn(ScalarColumnDesc<uInt>("LF_AVERAGE"));
     65  table_.addColumn(ArrayColumnDesc<uInt>("LF_EDGE"));
    6266
    6367  table_.rwKeywordSet().define("ApplyType", "BASELINE");
     
    6872void STBaselineTable::attachOptionalColumns()
    6973{
    70   nchanCol_.attach(table_, "NCHAN");
     74  applyCol_.attach(table_, "APPLY");
    7175  ftypeCol_.attach(table_, "FUNC_TYPE");
    7276  fparCol_.attach(table_, "FUNC_PARAM");
    7377  ffparCol_.attach(table_, "FUNC_FPARAM");
    74   citerCol_.attach(table_, "CLIP_ITERATION");
    75   cthresCol_.attach(table_, "CLIP_THRESHOLD");
    7678  maskCol_.attach(table_, "MASKLIST");
    7779  resCol_.attach(table_, "RESULT");
    7880  rmsCol_.attach(table_, "RMS");
     81  nchanCol_.attach(table_, "NCHAN");
     82  cthresCol_.attach(table_, "CLIP_THRESHOLD");
     83  citerCol_.attach(table_, "CLIP_ITERATION");
     84  lfthresCol_.attach(table_, "LF_THRESHOLD");
     85  lfavgCol_.attach(table_, "LF_AVERAGE");
     86  lfedgeCol_.attach(table_, "LF_EDGE");
    7987}
    8088
     
    9098                              uInt beamno, uInt ifno, uInt polno,
    9199                              uInt freqid, Double time,
    92                               uInt nchan,
     100                              Bool apply,
    93101                              STBaselineFunc::FuncName ftype,
    94                               Vector<uInt> fpar,
     102                              Vector<Int> fpar,
    95103                              Vector<Float> ffpar,
    96                               uInt citer,
    97                               Float cthres,
    98104                              Vector<uInt> mask,
    99105                              Vector<Float> res,
    100                               Float rms)
     106                              Float rms,
     107                              uInt nchan,
     108                              Float cthres,
     109                              uInt citer,
     110                              Float lfthres,
     111                              uInt lfavg,
     112                              Vector<uInt> lfedge)
    101113{
    102114  if (irow >= (uInt)nrow()) {
     
    110122
    111123  setbasedata(irow, scanno, cycleno, beamno, ifno, polno, freqid, time);
    112   nchanCol_.put(irow, nchan);
     124  applyCol_.put(irow, apply);
    113125  ftypeCol_.put(irow, uInt(ftype));
    114126  fparCol_.put(irow, fpar);
    115127  ffparCol_.put(irow, ffpar);
    116   citerCol_.put(irow, citer);
    117   cthresCol_.put(irow, cthres);
    118128  maskCol_.put(irow, mask);
    119129  resCol_.put(irow, res);
    120130  rmsCol_.put(irow, rms);
     131  nchanCol_.put(irow, nchan);
     132  cthresCol_.put(irow, cthres);
     133  citerCol_.put(irow, citer);
     134  lfthresCol_.put(irow, lfthres);
     135  lfavgCol_.put(irow, lfavg);
     136  lfedgeCol_.put(irow, lfedge);
    121137}
    122138
     
    124140                                 uInt beamno, uInt ifno, uInt polno,
    125141                                 uInt freqid, Double time,
    126                                  uInt nchan,
     142                                 Bool apply,
    127143                                 STBaselineFunc::FuncName ftype,
    128                                  Vector<uInt> fpar,
     144                                 Vector<Int> fpar,
    129145                                 Vector<Float> ffpar,
    130                                  uInt citer,
    131                                  Float cthres,
    132146                                 Vector<uInt> mask,
    133147                                 Vector<Float> res,
    134                                  Float rms)
     148                                 Float rms,
     149                                 uInt nchan,
     150                                 Float cthres,
     151                                 uInt citer,
     152                                 Float lfthres,
     153                                 uInt lfavg,
     154                                 Vector<uInt> lfedge)
    135155{
    136156  uInt irow = nrow();
    137157  table_.addRow(1, True);
    138158  setdata(irow, scanno, cycleno, beamno, ifno, polno, freqid, time,
    139           nchan, ftype, fpar, ffpar, citer, cthres, mask, res, rms);
    140 }
    141 
    142 Vector<STBaselineFunc::FuncName> STBaselineTable::getFunctionAsString()
     159          apply, ftype, fpar, ffpar, mask, res, rms,
     160          nchan, cthres, citer, lfthres, lfavg, lfedge);
     161}
     162
     163void STBaselineTable::appendbasedata(int scanno, int cycleno,
     164                                     int beamno, int ifno, int polno,
     165                                     int freqid, Double time)
     166{
     167  uInt irow = nrow();
     168  table_.addRow(1, True);
     169  setbasedata(irow, uInt(scanno), uInt(cycleno), uInt(beamno), uInt(ifno), uInt(polno), uInt(freqid), time);
     170}
     171
     172void STBaselineTable::setresult(casa::uInt irow,
     173                                casa::Vector<casa::Float> res,
     174                                casa::Float rms)
     175{
     176  resCol_.put(irow, res);
     177  rmsCol_.put(irow, rms);
     178}
     179
     180bool STBaselineTable::getApply(int irow)
     181{
     182  return (bool)applyCol_.get(irow);
     183}
     184
     185void STBaselineTable::setApply(int irow, bool apply)
     186{
     187  applyCol_.put(uInt(irow), Bool(apply));
     188}
     189
     190Vector<STBaselineFunc::FuncName> STBaselineTable::getFunctionNames()
    143191{
    144192  Vector<uInt> rawBlfuncColumn = ftypeCol_.getColumn();
     
    149197  }
    150198  return blfuncColumn;
     199}
     200
     201STBaselineFunc::FuncName STBaselineTable::getFunctionName(int irow)
     202{
     203  return STBaselineFunc::FuncName(ftypeCol_.get(irow));
     204}
     205
     206std::vector<int> STBaselineTable::getFuncParam(int irow)
     207{
     208  Vector<Int> uiparam = fparCol_.get(irow);
     209  std::vector<int> res(uiparam.size());
     210  for (uInt i = 0; i < res.size(); ++i) {
     211    res[i] = (int)uiparam[i];
     212  }
     213  return res;
     214}
     215
     216std::vector<bool> STBaselineTable::getMask(int irow)
     217{
     218  uInt nchan = getNChan(irow);
     219  Vector<uInt> masklist = maskCol_.get(irow);
     220  std::vector<int> masklist1(masklist.size());
     221  for (uInt i = 0; i < masklist1.size(); ++i) {
     222    masklist1[i] = (int)masklist[i];
     223  }
     224  return Scantable::getMaskFromMaskList(nchan, masklist1);
     225}
     226
     227uInt STBaselineTable::getNChan(int irow)
     228{
     229  return nchanCol_.get(irow);
    151230}
    152231
Note: See TracChangeset for help on using the changeset viewer.