Ignore:
Timestamp:
01/09/13 19:27:23 (11 years ago)
Author:
Takeshi Nakazato
Message:

New Development: Yes

JIRA Issue: Yes CAS-4770 and its sub-tickets

Ready for Test: Yes

Interface Changes: No

What Interface Changed: Please list interface changes

Test Programs: List test programs

Put in Release Notes: Yes/No?

Module(s): Module Names change impacts.

Description: Describe your changes here...

First version of applycal for single dish calibration.
Added new classes for the operation (STApplyCal, Calibrator, PSAlmaCalibrator,
Locator, BisectionLocator?, Interpolator1D, NearestInterpolator1D).
Also, modified existing classes to fit with implementation of applycal.


File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/STApplyTable.cpp

    r2703 r2720  
    1515#include <tables/Tables/ScaColDesc.h>
    1616#include <tables/Tables/TableRecord.h>
     17#include <tables/Tables/Table.h>
     18#include <tables/Tables/ExprNode.h>
    1719#include <measures/TableMeasures/TableMeasDesc.h>
    1820#include <measures/TableMeasures/TableMeasRefDesc.h>
     
    3537  td.addColumn(ScalarColumnDesc<uInt>("IFNO"));
    3638  td.addColumn(ScalarColumnDesc<uInt>("POLNO"));
     39  td.addColumn(ScalarColumnDesc<uInt>("FREQ_ID"));
    3740  td.addColumn(ScalarColumnDesc<Double>("TIME"));
    3841  TableMeasRefDesc measRef(MEpoch::UTC); // UTC as default
     
    5356  table_.tableInfo().setType("ApplyTable");
    5457
     58  originaltable_ = table_;
     59}
     60
     61STApplyTable::STApplyTable(const String &name)
     62{
     63  table_ = Table(name, Table::Update);
     64  attachBaseColumns();
    5565  originaltable_ = table_;
    5666}
     
    7686  timeCol_.attach(table_, "TIME");
    7787  timeMeasCol_.attach(table_, "TIME");
     88  freqidCol_.attach(table_, "FREQ_ID");
    7889}
    7990
    80 void STApplyTable::setSelection(STSelector &sel)
     91void STApplyTable::setSelection(STSelector &sel, bool sortByTime)
    8192{
    8293  table_ = sel.apply(originaltable_);
     94  if (sortByTime)
     95    table_.sort("TIME", Sort::Descending);
    8396  attach();
    8497  sel_ = sel;
     
    94107void STApplyTable::setbasedata(uInt irow, uInt scanno, uInt cycleno,
    95108                               uInt beamno, uInt ifno, uInt polno,
    96                                Double time)
     109                               uInt freqid, Double time)
    97110{
    98111  scanCol_.put(irow, scanno);
     
    102115  polCol_.put(irow, polno);
    103116  timeCol_.put(irow, time);
     117  freqidCol_.put(irow, freqid);
    104118}
    105119
     
    109123}
    110124
     125String STApplyTable::caltype()
     126{
     127  if (table_.keywordSet().isDefined("ApplyType")) {
     128    return table_.keywordSet().asString("ApplyType");
     129  }
     130  else
     131    return "NONE";
    111132}
     133
     134STCalEnum::CalType  STApplyTable::getCalType(const String &name)
     135{
     136  Table t(name, Table::Old);
     137  return stringToType(t.keywordSet().asString("ApplyType"));
     138}
     139
     140STCalEnum::CalType STApplyTable::getCalType(CountedPtr<STApplyTable> tab)
     141{
     142  return stringToType(tab->caltype());
     143}
     144
     145STCalEnum::CalType STApplyTable::getCalType(STApplyTable *tab)
     146{
     147  return stringToType(tab->caltype());
     148}
     149
     150STCalEnum::CalType STApplyTable::stringToType(const String &caltype)
     151{
     152  if (caltype == "CALSKY_PSALMA")
     153    return STCalEnum::CalPSAlma;
     154  else if (caltype == "CALTSYS")
     155    return STCalEnum::CalTsys;
     156  else
     157    return STCalEnum::NoType;
     158}
     159
     160Block<Double> STApplyTable::getFrequenciesRow(uInt id)
     161{
     162  const TableRecord &rec = table_.keywordSet();
     163  rec.print(os_.output());
     164  os_ << LogIO::POST;
     165  Table ftab = rec.asTable("FREQUENCIES");
     166  Table t = ftab(ftab.col("ID") == id);
     167  ROTableColumn col(t, "REFPIX");
     168  Block<Double> r(3);
     169  r[0] = col.asdouble(0);
     170  col.attach(t, "REFVAL");
     171  r[1] = col.asdouble(0);
     172  col.attach(t, "INCREMENT");
     173  r[2] = col.asdouble(0);
     174  return r;
     175}
     176}
Note: See TracChangeset for help on using the changeset viewer.