Changeset 2756 for trunk


Ignore:
Timestamp:
01/31/13 18:55:29 (12 years ago)
Author:
Takeshi Nakazato
Message:

New Development: No

JIRA Issue: Yes CAS-4770

Ready for Test: Yes

Interface Changes: No

What Interface Changed: Please list interface changes

Test Programs: test_sdcal2

Put in Release Notes: No

Module(s): Module Names change impacts.

Description: Describe your changes here...

Replace assert with casa::assert_ to avoid aborting casapy session.


Location:
trunk/src
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/BufferedLinearInterpolator1D.tcc

    r2733 r2756  
    1111//
    1212#include <assert.h>
     13
     14#include <casa/Exceptions/Error.h>
     15#include <casa/Utilities/Assert.h>
    1316
    1417#include "BufferedLinearInterpolator1D.h"
     
    4346U BufferedLinearInterpolator1D<T, U>::interpolate(T x)
    4447{
    45   assert(this->isready());
     48  //assert(this->isready());
     49  assert_<casa::AipsError>(this->isready(), "object is not ready to process.");
    4650  if (this->n_ == 1)
    4751    return this->y_[0];
  • trunk/src/CalibrationManager.cpp

    r2750 r2756  
    1414#include <casa/Arrays/Vector.h>
    1515#include <casa/Exceptions/Error.h>
     16#include <casa/Utilities/Assert.h>
    1617#include <casa/Utilities/Regex.h>
    1718#include <casa/BasicSL/String.h>
     
    150151  os_.origin(LogOrigin("CalibrationManager","calibrate",WHERE));
    151152  os_ << LogIO::DEBUGGING << "start calibration with mode " << calmode_ << "." << LogIO::POST;
    152   assert(!target_.null());
     153  //assert(!target_.null());
     154  assert_<AipsError>(!target_.null(), "You have to set target scantable first.");
    153155  if (calmode_ == "TSYS") {
    154     assert(spwlist_.size() > 0);
     156    //assert(spwlist_.size() > 0);
     157    assert_<AipsError>(spwlist_.size() > 0, "You have to set list of IFNOs for ATM calibration.");
    155158    STCalTsys cal(target_, spwlist_);
    156159    cal.calibrate();
     
    198201  os_.origin(LogOrigin("CalibrationManager","saveCaltable",WHERE));
    199202  if (calmode_ == "TSYS") {
    200     assert(tsystables_.size() > 0);
     203    //assert(tsystables_.size() > 0);
     204    assert_<AipsError>(tsystables_.size() > 0, "Tsys table list is empty.");
    201205    os_ << LogIO::DEBUGGING << "save latest STCalTsysTable as " << name << "." << LogIO::POST;
    202206    tsystables_[tsystables_.size()-1]->save(name);
    203207  }
    204208  else {
    205     assert(skytables_.size() > 0);
     209    //assert(skytables_.size() > 0);
     210    assert_<AipsError>(skytables_.size() > 0, "Sky table list is empty.");
    206211    os_ << LogIO::DEBUGGING << "save latest STCalSkyTable as " << name << "." << LogIO::POST;
    207212    skytables_[skytables_.size()-1]->save(name);
  • trunk/src/Calibrator.cpp

    r2720 r2756  
    1414#include <casa/Arrays/Vector.h>
    1515#include <casa/Exceptions/Error.h>
     16#include <casa/Utilities/Assert.h>
    1617
    1718#include "Calibrator.h"
     
    7172void Calibrator::setReference(Vector<Float> &v)
    7273{
    73   assert(v.nelements() == nchan_);
     74  //assert(v.nelements() == nchan_);
     75  assert_<AipsError>(v.nelements() == nchan_, "Reference spectrum shape mismatch.");
    7476  set(ref_, v);
    7577}
     
    7779void Calibrator::setReference2(Vector<Float> &v)
    7880{
    79   assert(v.nelements() == nchan_);
     81  //assert(v.nelements() == nchan_);
     82  assert_<AipsError>(v.nelements() == nchan_, "Second reference spectrum shape mismatch.");
    8083  if (!ref2_)
    8184    ref2_ = new Float[nchan_];
     
    8588void Calibrator::setScaler(Vector<Float> &v)
    8689{
    87   assert(v.nelements() == nchan_ || v.nelements() == 1);
     90  //assert(v.nelements() == nchan_ || v.nelements() == 1);
     91  assert_<AipsError>(v.nelements() == nchan_ || v.nelements() == 1,
     92         "Scaling factor shape mismatch.");
    8893  if (nchanS_ == 0) {
    8994    nchanS_ = v.nelements();
  • trunk/src/CubicSplineInterpolator1D.tcc

    r2736 r2756  
    1111//
    1212#include <assert.h>
     13
     14#include <casa/Exceptions/Error.h>
     15#include <casa/Utilities/Assert.h>
    1316
    1417#include <iostream>
     
    5861U CubicSplineInterpolator1D<T, U>::interpolate(T x)
    5962{
    60   assert(this->isready());
     63  //assert(this->isready());
     64  assert_<casa::AipsError>(this->isready(), "object is not ready to process.");
    6165  if (this->n_ == 1)
    6266    return this->y_[0];
  • trunk/src/Interpolator1D.tcc

    r2733 r2756  
    1414#include <casa/Arrays/Vector.h>
    1515#include <casa/Exceptions/Error.h>
     16#include <casa/Utilities/Assert.h>
    1617
    1718#include "Interpolator1D.h"
     
    5253void Interpolator1D<T, U>::setX(T *x, unsigned int n)
    5354{
    54   assert(n_ == 0 || n_ == n);
     55  //assert(n_ == 0 || n_ == n);
     56  casa::assert_<casa::AipsError>(n_ == 0 || n_ == n, "length mismatch in data.");
    5557  x_ = x;
    5658  n_ = n;
     
    6264void Interpolator1D<T, U>::setY(U *y, unsigned int n)
    6365{
    64   assert(n_ == 0 || n_ == n);
     66  //assert(n_ == 0 || n_ == n);
     67  casa::assert_<casa::AipsError>(n_ == 0 || n_ == n, "length mismatch in data.");
    6568  y_ = y;
    6669  n_ = n;
  • trunk/src/LinearInterpolator1D.tcc

    r2733 r2756  
    1111//
    1212#include <assert.h>
     13
     14#include <casa/Exceptions/Error.h>
     15#include <casa/Utilities/Assert.h>
    1316
    1417#include "LinearInterpolator1D.h"
     
    2730template <class T, class U> U LinearInterpolator1D<T, U>::interpolate(T x)
    2831{
    29   assert(this->isready());
     32  //assert(this->isready());
     33  assert_<AipsError>(this->isready(),"object is not ready to process.");
    3034  if (this->n_ == 1)
    3135    return this->y_[0];
  • trunk/src/NearestInterpolator1D.tcc

    r2733 r2756  
    1111//
    1212#include <assert.h>
     13
     14#include <casa/Exceptions/Error.h>
     15#include <casa/Utilities/Assert.h>
    1316
    1417#include "NearestInterpolator1D.h"
     
    2932template <class T, class U> U NearestInterpolator1D<T, U>::interpolate(T x)
    3033{
    31   assert(this->isready());
     34  //assert(this->isready());
     35  casa::assert_<casa::AipsError>(this->isready(),"object is not ready to process.");
    3236  if (this->n_ == 1)
    3337    return this->y_[0];
  • trunk/src/PSAlmaCalibrator.cpp

    r2720 r2756  
    1111//
    1212#include <assert.h>
     13
     14#include <casa/Exceptions/Error.h>
     15#include <casa/Utilities/Assert.h>
    1316
    1417#include "PSAlmaCalibrator.h"
     
    2831void PSAlmaCalibrator::calibrate()
    2932{
    30   assert(source_);
    31   assert(ref_);
    32   assert(scaler_);
    33   assert(calibrated_);
     33  //assert(source_);
     34  //assert(ref_);
     35  //assert(scaler_);
     36  //assert(calibrated_);
     37  assert_<AipsError>(source_, "Source spectrum is null.");
     38  assert_<AipsError>(ref_, "Reference spectrum is null.");
     39  assert_<AipsError>(scaler_, "Scaling factor is null.");
     40  assert_<AipsError>(calibrated_, "Calibrated spectrum is null.");
    3441
    3542  Float *p_s = source_;
  • trunk/src/PolynomialInterpolator1D.tcc

    r2733 r2756  
    1616
    1717#include <casa/Exceptions/Error.h>
     18#include <casa/Utilities/Assert.h>
    1819
    1920#include "PolynomialInterpolator1D.h"
     
    3334U PolynomialInterpolator1D<T, U>::interpolate(T x)
    3435{
    35   assert(this->isready());
     36  //casa::AlwaysAssert((this->isready()),(casa::AipsError));
     37  casa::assert_<casa::AipsError>(this->isready(), "object is not ready to process.");
    3638  if (this->n_ == 1)
    3739    return this->y_[0];
  • trunk/src/STApplyCal.cpp

    r2750 r2756  
    2222#include <casa/Utilities/CountedPtr.h>
    2323#include <casa/Utilities/Sort.h>
     24#include <casa/Utilities/Assert.h>
    2425#include <tables/Tables/Table.h>
    2526
     
    169170  os_.origin(LogOrigin("STApplyCal","apply",WHERE));
    170171 
    171   assert(!target_.null());
     172  //assert(!target_.null());
     173  assert_<AipsError>(!target_.null(),"You have to set target scantable first.");
    172174
    173175  // calibrator
     
    458460void STApplyCal::save(const String &name)
    459461{
    460   assert(!work_.null());
     462  //assert(!work_.null());
     463  assert_<AipsError>(!work_.null(),"You have to execute apply method first.");
    461464
    462465  work_->setSelection(sel_);
     
    467470Vector<Double> STApplyCal::getBaseFrequency(uInt whichrow)
    468471{
    469   assert(whichrow <= (uInt)work_->nrow());
     472  //assert(whichrow <= (uInt)work_->nrow());
     473  assert_<AipsError>(whichrow <= (uInt)work_->nrow(),"row index out of range.");
    470474  ROTableColumn col(work_->table(), "IFNO");
    471475  uInt ifno = col.asuInt(whichrow);
  • trunk/src/STApplyCal.h

    r2750 r2756  
    2828#include "STApplyTable.h"
    2929#include "STCalEnum.h"
    30 #include "Calibrator.h"
    31 #include "Interpolator1D.h"
     30//#include "Calibrator.h"
     31//#include "Interpolator1D.h"
    3232#include "STCalSkyTable.h"
    3333#include "STCalTsysTable.h"
    3434
    3535namespace asap {
     36
     37template<class T, class U> class Interpolator1D;
     38class Calibrator;
    3639
    3740/**
  • trunk/src/STCalTsysTable.cpp

    r2724 r2756  
    1313
    1414#include <casa/Exceptions/Error.h>
     15#include <casa/Utilities/Assert.h>
    1516#include <tables/Tables/TableDesc.h>
    1617#include <tables/Tables/SetupNewTab.h>
     
    107108Vector<Double> STCalTsysTable::getBaseFrequency(uInt whichrow)
    108109{
    109   assert(whichrow < nrow());
     110  //assert(whichrow < nrow());
     111  assert_<AipsError>(whichrow < nrow(), "row index out of range.");
    110112  uInt freqid = freqidCol_(whichrow);
    111113  uInt nc = tsysCol_(whichrow).nelements();
Note: See TracChangeset for help on using the changeset viewer.