Changeset 2742


Ignore:
Timestamp:
01/22/13 19:01:34 (11 years ago)
Author:
Takeshi Nakazato
Message:

New Development: No

JIRA Issue: Yes CAS-4770

Ready for Test: Yes

Interface Changes: Yes/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...

Defined python interface for calibration that supports both
on-the-fly and interferometry-style (generate caltable and apply)
calibration.

Location:
trunk/src
Files:
3 added
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/CMakeLists.txt

    r2739 r2742  
    8080     ${SRCDIR}/Calibrator.cpp
    8181     ${SRCDIR}/PSAlmaCalibrator.cpp
    82      ${SRCDIR}/STBaselineTable.cpp )
     82     ${SRCDIR}/STBaselineTable.cpp
     83     ${SRCDIR}/CalibrationManager.cpp )
    8384
    8485set( ASAP_PYSRCS
     
    105106     ${SRCDIR}/python_PlotHelper.cpp
    106107     ${SRCDIR}/python_STSideBandSep.cpp
     108     ${SRCDIR}/python_CalibrationManager.cpp
    107109     ${SRCDIR}/python_asap.cpp )
    108110
  • trunk/src/STApplyCal.cpp

    r2735 r2742  
    6565  caltype_ = STCalEnum::NoType;
    6666  doTsys_ = False;
     67  iTime_ = STCalEnum::DefaultInterpolation;
     68  iFreq_ = STCalEnum::DefaultInterpolation;
    6769}
    6870
    6971void STApplyCal::reset()
    7072{
     73  // call init
     74  init();
     75
     76  // clear apply tables
     77  // do not delete object here
     78  skytable_.resize(0);
     79  tsystable_.resize(0);
     80
     81  // clear mapping for Tsys transfer
     82  spwmap_.clear();
     83
     84  // reset selector
     85  sel_.reset();
     86 
     87  // delete interpolators
     88  interpolatorT_ = 0;
     89  interpolatorS_ = 0;
     90  interpolatorF_ = 0;
     91
     92  // clear working scantable
     93  work_ = 0;
     94 
     95  // clear calibrator
     96  calibrator_ = 0;
    7197}
    7298
     
    139165}
    140166
    141 void STApplyCal::apply(Bool insitu)
     167void STApplyCal::apply(Bool insitu, Bool filltsys)
    142168{
    143169  os_.origin(LogOrigin("STApplyCal","apply",WHERE));
     
    202228void STApplyCal::doapply(uInt beamno, uInt ifno, uInt polno,
    203229                         Vector<uInt> &rows,
    204                          Vector<uInt> &skylist)
     230                         Vector<uInt> &skylist,
     231                         Bool filltsys)
    205232{
    206233  os_.origin(LogOrigin("STApplyCal","doapply",WHERE));
     
    379406    //os_ << "calibrated=" << calibrator_->getCalibrated() << LogIO::POST;
    380407    spCol.put(irow, calibrator_->getCalibrated());
    381     tsysCol.put(irow, iTsys);
     408    if (filltsys)
     409      tsysCol.put(irow, iTsys);
    382410  }
    383411 
     
    421449void STApplyCal::save(const String &name)
    422450{
    423   if (work_.null())
    424     return;
     451  assert(!work_.null());
    425452
    426453  work_->setSelection(sel_);
  • trunk/src/STApplyCal.h

    r2735 r2742  
    1717#include <vector>
    1818
    19 #include <casa/Containers/Block.h>
     19#include <casa/Utilities/CountedPtr.h>
    2020#include <casa/Arrays/Vector.h>
    2121#include <casa/Logging/LogIO.h>
     
    6666
    6767  // apply tables
    68   void apply(casa::Bool insitu=true);
     68  void apply(casa::Bool insitu=true, casa::Bool filltsys=false);
    6969
    7070  // split target data and store it to disk
     
    8787  void doapply(casa::uInt beamno, casa::uInt ifno, casa::uInt polno,
    8888               casa::Vector<casa::uInt> &rows,
    89                casa::Vector<casa::uInt> &skylist);
     89               casa::Vector<casa::uInt> &skylist,
     90               casa::Bool filltsys=false);
    9091
    9192  // get frequency information from FREQUENCIES subtable
  • trunk/src/STCalEnum.h

    r2727 r2742  
    3030class STCalEnum  {
    3131public:
    32   enum InterpolationType {NearestInterpolation = 0,
     32  enum InterpolationType {DefaultInterpolation = 0,
     33                          NearestInterpolation,
    3334                          LinearInterpolation,
    3435                          PolynomialInterpolation,
  • trunk/src/STCalSkyPSAlma.cpp

    r2720 r2742  
    2929}
    3030
    31 void STCalSkyPSAlma::calibrate()
     31void STCalSkyPSAlma::setupSelector()
    3232{
     33  sel_.reset();
    3334  vector<int> types(1,SrcType::PSOFF);
    34   STSelector selOrg = scantable_->getSelection();
    35   STSelector sel;
    36   sel.setTypes(types);
    37   scantable_->setSelection(sel);
    38  
    39   fillCalTable();
    40 
    41   scantable_->setSelection(selOrg);
     35  sel_.setTypes(types);
    4236}
    4337
  • trunk/src/STCalSkyPSAlma.h

    r2703 r2742  
    2929#include "STCalSkyTable.h"
    3030
     31class CalibrationManager;
    3132
    3233namespace asap {
     
    3738 */
    3839class STCalSkyPSAlma : public STCalibration {
     40
     41  friend class CalibrationManager;
     42
    3943public:
    4044  STCalSkyPSAlma(casa::CountedPtr<Scantable> &s);
    4145
    42   virtual void calibrate();
    43 
    4446  ~STCalSkyPSAlma() {;}
     47 
    4548private:
     49  void setupSelector();
    4650  void fillCalTable();
    4751};
  • trunk/src/STCalSkyTable.h

    r2720 r2742  
    5858
    5959  //casa::Vector<casa::Double> getBaseFrequency(casa::uInt whichrow);
     60
    6061private:
    6162  static const casa::String name_;
  • trunk/src/STCalTsys.cpp

    r2720 r2742  
    3232}
    3333
    34 void STCalTsys::calibrate()
     34void STCalTsys::setupSelector()
    3535{
    36   STSelector selOrg = scantable_->getSelection();
    37   STSelector sel;
    38   sel.setIFs(iflist_);
    39   scantable_->setSelection(sel);
    40  
    41   fillCalTable();
    42 
    43   scantable_->setSelection(selOrg);
     36  sel_.reset();
     37  sel_.setIFs(iflist_);
    4438}
    4539
  • trunk/src/STCalTsys.h

    r2703 r2742  
    3030#include "STCalTsysTable.h"
    3131
     32class CalibrationManager;
    3233
    3334namespace asap {
     
    3839 */
    3940class STCalTsys : public STCalibration {
     41
     42  friend class CalibrationManager;
     43
    4044public:
    4145  STCalTsys(casa::CountedPtr<Scantable> &s, vector<int> &iflist);
    4246
    43   virtual void calibrate();
    44 
    4547  ~STCalTsys() {;}
     48 
    4649private:
     50  void setupSelector();
    4751  void fillCalTable();
    4852
  • trunk/src/STCalibration.cpp

    r2703 r2742  
    2222}
    2323
     24void STCalibration::calibrate()
     25{
     26  STSelector selOrg = scantable_->getSelection();
     27  setupSelector();
     28  scantable_->setSelection(sel_);
     29 
     30  fillCalTable();
     31
     32  scantable_->setSelection(selOrg);
    2433}
     34
     35}
  • trunk/src/STCalibration.h

    r2703 r2742  
    2626#include "STApplyTable.h"
    2727
     28class CalibrationManager;
    2829
    2930namespace asap {
     
    3435 */
    3536class STCalibration {
     37
     38  friend class CalibrationManager;
     39
    3640public:
    3741  STCalibration(casa::CountedPtr<Scantable> &s);
    3842
    39   virtual void calibrate() = 0;
     43  void calibrate();
    4044
    4145  virtual ~STCalibration() {;}
    4246
    4347  void save(casa::String name) {applytable_->save(name);}
     48  const STApplyTable &applytable() {return *applytable_;}
    4449protected:
     50  virtual void setupSelector() = 0;
     51  virtual void fillCalTable() = 0;
     52
     53  STSelector sel_;
    4554  casa::CountedPtr<Scantable> scantable_;
    4655  casa::CountedPtr<STApplyTable> applytable_;
  • trunk/src/python_asap.cpp

    r2707 r2742  
    9090  asap::python::python_PlotHelper();
    9191  asap::python::python_STSideBandSep();
     92  asap::python::python_CalibrationManager();
    9293
    9394#ifndef HAVE_LIBPYRAP
  • trunk/src/python_asap.h

    r2707 r2742  
    5757    void python_PlotHelper();
    5858    void python_STSideBandSep();
     59    void python_CalibrationManager();
    5960
    6061  } // python
Note: See TracChangeset for help on using the changeset viewer.