Changeset 3026


Ignore:
Timestamp:
02/09/15 17:27:27 (10 years ago)
Author:
Kana Sugimoto
Message:

New Development: No

JIRA Issue: No

Ready for Test: Yes

Interface Changes: No

What Interface Changed:

Test Programs:

Put in Release Notes: No

Module(s): scantable, sdbaseline

Description: Added waring for skipped baseline operation in *Baseline functions.


File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/Scantable.cpp

    r3025 r3026  
    1212#include <map>
    1313#include <sys/time.h>
    14 #include <assert.h>
    1514
    1615#include <atnf/PKSIO/SrcType.h>
     
    3736#include <casa/Quanta/MVTime.h>
    3837#include <casa/Utilities/GenSort.h>
     38#include <casa/Utilities/Assert.h>
    3939
    4040#include <coordinates/Coordinates/CoordinateUtil.h>
     
    25672567{
    25682568  std::size_t nvalid=0;
    2569   assert(static_cast<std::size_t>(true)==1);
    2570   assert(static_cast<std::size_t>(false)==0);
     2569  // the assertion lines had better be replaced with static_assert when c++11 is supported
     2570  AlwaysAssert(static_cast<std::size_t>(true)==1, AipsError);
     2571  AlwaysAssert(static_cast<std::size_t>(false)==0, AipsError);
    25712572  for (uInt i = 1; i < mask.size(); ++i) {
    25722573    nvalid += static_cast<std::size_t>(mask[i]);
     
    30463047    STBaselineTable bt = STBaselineTable(*this);
    30473048    Vector<Double> timeSecCol;
     3049    size_t flagged=0;
    30483050
    30493051    initialiseBaselining(blfile, ofs, outLogger, outTextFile, csvFormat,
     
    30893091        // no valid channels to fit (flag the row)
    30903092        flagrowCol_.put(whichrow, 1);
     3093        ++flagged;
    30913094        if (outBaselineTable) {
    30923095          params.resize(nModel);
     
    31063109
    31073110    finaliseBaselining(outBaselineTable, &bt, bltable, outTextFile, ofs);
    3108 
     3111    if (flagged > 0) {
     3112      LogIO os( LogOrigin( "Scantable", "polyBaseline()") ) ;
     3113      os << LogIO::WARN << "Baseline subtraction is skipped for " << flagged << " spectra due to too few valid channels to operate fit. The spectra will be flagged in output data." << LogIO::POST;
     3114    }
    31093115  } catch (...) {
    31103116    throw;
     
    31393145    Vector<Double> timeSecCol;
    31403146    STLineFinder lineFinder = STLineFinder();
     3147    size_t flagged=0;
    31413148
    31423149    initialiseBaselining(blfile, ofs, outLogger, outTextFile, csvFormat,
     
    31853192        // no valid channels to fit (flag the row)
    31863193        flagrowCol_.put(whichrow, 1);
     3194        ++flagged;
    31873195        if (outBaselineTable) {
    31883196          params.resize(nModel);
     
    32023210
    32033211    finaliseBaselining(outBaselineTable, &bt, bltable, outTextFile, ofs);
    3204 
     3212    if (flagged > 0) {
     3213      LogIO os( LogOrigin( "Scantable", "autoPolyBaseline()") ) ;
     3214      os << LogIO::WARN << "Baseline subtraction is skipped for " << flagged << " spectra due to too few valid channels to operate fit. The spectra will be flagged in output data." << LogIO::POST;
     3215    }
    32053216  } catch (...) {
    32063217    throw;
     
    32303241    STBaselineTable bt = STBaselineTable(*this);
    32313242    Vector<Double> timeSecCol;
     3243    size_t flagged=0;
    32323244
    32333245    initialiseBaselining(blfile, ofs, outLogger, outTextFile, csvFormat,
     
    32733285        // no valid channels to fit (flag the row)
    32743286        flagrowCol_.put(whichrow, 1);
     3287        ++flagged;
    32753288        if (outBaselineTable) {
    32763289          params.resize(nModel);
     
    32913304    finaliseBaselining(outBaselineTable, &bt, bltable, outTextFile, ofs);
    32923305
     3306    if (flagged > 0) {
     3307      LogIO os( LogOrigin( "Scantable", "chebyshevBaseline()") ) ;
     3308      os << LogIO::WARN << "Baseline subtraction is skipped for " << flagged << " spectra due to too few valid channels to operate fit. The spectra will be flagged in output data." << LogIO::POST;
     3309    }
    32933310  } catch (...) {
    32943311    throw;
     
    33233340    Vector<Double> timeSecCol;
    33243341    STLineFinder lineFinder = STLineFinder();
     3342    size_t flagged=0;
    33253343
    33263344    initialiseBaselining(blfile, ofs, outLogger, outTextFile, csvFormat,
     
    33693387        // no valid channels to fit (flag the row)
    33703388        flagrowCol_.put(whichrow, 1);
     3389        ++flagged;
    33713390        if (outBaselineTable) {
    33723391          params.resize(nModel);
     
    33873406    finaliseBaselining(outBaselineTable, &bt, bltable, outTextFile, ofs);
    33883407
     3408    if (flagged > 0) {
     3409      LogIO os( LogOrigin( "Scantable", "autoChebyshevBaseline()") ) ;
     3410      os << LogIO::WARN << "Baseline subtraction is skipped for " << flagged << " spectra due to too few valid channels to operate fit. The spectra will be flagged in output data." << LogIO::POST;
     3411    }
    33893412  } catch (...) {
    33903413    throw;
     
    39173940    STBaselineTable bt = STBaselineTable(*this);
    39183941    Vector<Double> timeSecCol;
     3942    size_t flagged=0;
    39193943
    39203944    initialiseBaselining(blfile, ofs, outLogger, outTextFile, csvFormat,
     
    39613985        // no valid channels to fit (flag the row)
    39623986        flagrowCol_.put(whichrow, 1);
     3987        ++flagged;
    39633988        if (outBaselineTable) {
    39643989          pieceEdges.resize(nPiece+1);
     
    39834008    finaliseBaselining(outBaselineTable, &bt, bltable, outTextFile, ofs);
    39844009
     4010    if (flagged > 0) {
     4011      LogIO os( LogOrigin( "Scantable", "cubicSplineBaseline()") ) ;
     4012      os << LogIO::WARN << "Baseline subtraction is skipped for " << flagged << " spectra due to too few valid channels to operate fit. The spectra will be flagged in output data." << LogIO::POST;
     4013    }
    39854014  } catch (...) {
    39864015    throw;
     
    40154044    Vector<Double> timeSecCol;
    40164045    STLineFinder lineFinder = STLineFinder();
     4046    size_t flagged=0;
    40174047
    40184048    initialiseBaselining(blfile, ofs, outLogger, outTextFile, csvFormat,
     
    40624092        // no valid channels to fit (flag the row)
    40634093        flagrowCol_.put(whichrow, 1);
     4094        ++flagged;
    40644095        if (outBaselineTable) {
    40654096          pieceEdges.resize(nPiece+1);
     
    40844115    finaliseBaselining(outBaselineTable, &bt, bltable, outTextFile, ofs);
    40854116
     4117    if (flagged > 0) {
     4118      LogIO os( LogOrigin( "Scantable", "autoCubicSplineBaseline()") ) ;
     4119      os << LogIO::WARN << "Baseline subtraction is skipped for " << flagged << " spectra due to too few valid channels to operate fit. The spectra will be flagged in output data." << LogIO::POST;
     4120    }
    40864121  } catch (...) {
    40874122    throw;
     
    46884723    STBaselineTable bt = STBaselineTable(*this);
    46894724    Vector<Double> timeSecCol;
     4725    size_t flagged=0;
    46904726
    46914727    initialiseBaselining(blfile, ofs, outLogger, outTextFile, csvFormat,
     
    47454781        // no valid channels to fit (flag the row)
    47464782        flagrowCol_.put(whichrow, 1);
     4783        ++flagged;
    47474784        if (outBaselineTable) {
    47484785          params.resize(nModel);
     
    47634800    finaliseBaselining(outBaselineTable, &bt, bltable, outTextFile, ofs);
    47644801
     4802    if (flagged > 0) {
     4803      LogIO os( LogOrigin( "Scantable", "sinusoidBaseline()") ) ;
     4804      os << LogIO::WARN << "Baseline subtraction is skipped for " << flagged << " spectra due to too few valid channels to operate fit. The spectra will be flagged in output data." << LogIO::POST;
     4805    }
    47654806  } catch (...) {
    47664807    throw;
     
    47974838    Vector<Double> timeSecCol;
    47984839    STLineFinder lineFinder = STLineFinder();
     4840    size_t flagged=0;
    47994841
    48004842    initialiseBaselining(blfile, ofs, outLogger, outTextFile, csvFormat,
     
    48574899        // no valid channels to fit (flag the row)
    48584900        flagrowCol_.put(whichrow, 1);
     4901        ++flagged;
    48594902        if (outBaselineTable) {
    48604903          params.resize(nModel);
     
    48754918    finaliseBaselining(outBaselineTable, &bt, bltable, outTextFile, ofs);
    48764919
     4920    if (flagged > 0) {
     4921      LogIO os( LogOrigin( "Scantable", "autoSinusoidBaseline()") ) ;
     4922      os << LogIO::WARN << "Baseline subtraction is skipped for " << flagged << " spectra due to too few valid channels to operate fit. The spectra will be flagged in output data." << LogIO::POST;
     4923    }
    48774924  } catch (...) {
    48784925    throw;
Note: See TracChangeset for help on using the changeset viewer.