Changeset 2615 for trunk/src


Ignore:
Timestamp:
08/01/12 15:32:08 (12 years ago)
Author:
Takeshi Nakazato
Message:

New Development: No

JIRA Issue: Yes CAS-2825

Ready for Test: Yes

Interface Changes: No

What Interface Changed: Please list interface changes

Test Programs: not available yet

Put in Release Notes: No

Module(s): Module Names change impacts.

Description: Describe your changes here...

Logging updated. Priorities for most of the logs are changed to
DEBUGGING since those are mainly for debug use.


Location:
trunk/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/EdgeMarker.cpp

    r2613 r2615  
    3030EdgeMarker::EdgeMarker()
    3131{
    32   detector_ = new GenericEdgeDetector() ;
     32  EdgeMarker( false ) ;
    3333}
    3434
    3535EdgeMarker::EdgeMarker( bool israster )
    3636{
    37   if ( israster )
     37  os_.origin(LogOrigin( "EdgeMarker", "EdgeMarker", WHERE )) ;
     38
     39  if ( israster ) {
     40    os_ << "edge detection by RasterEdgeDetector" << LogIO::POST ;
    3841    detector_ = new RasterEdgeDetector() ;
    39   else
     42  }
     43  else {
     44    os_ << "edge detection by GenericEdgeDetector" << LogIO::POST ;
    4045    detector_ = new GenericEdgeDetector() ;
     46  }
    4147}
    4248
     
    6369void EdgeMarker::examine()
    6470{
     71  os_.origin(LogOrigin( "EdgeMarker", "examine", WHERE )) ;
     72
    6573  // exclude WVR
    6674  vector<uInt> wvr ;
     
    7987  }
    8088  wvr_ = Vector<uInt>( wvr ) ;
    81   os_.origin(LogOrigin( "EdgeMarker", "examine", WHERE )) ;
    82   os_ << "IFNO for WVR scan: " << wvr_ << LogIO::POST ;
     89
     90  if ( wvr_.nelements() > 0 ) {
     91    os_ << LogIO::DEBUGGING
     92        << "IFNO for WVR scan: " << wvr_ << LogIO::POST ;
     93  }
    8394}
    8495
     
    104115    Vector<uInt> current = iter.current() ;
    105116    Int srcType = iter.getSrcType() ;
    106     os_ << "BEAMNO=" << current[0]
    107         << ",POLNO=" << current[1]
    108         << ",IFNO=" << current[2]
    109         << ",SRCTYPE=" << srcType << LogIO::POST ;
     117    os_ << LogIO::DEBUGGING
     118        << "BEAMNO=" << current[0]
     119        << " POLNO=" << current[1]
     120        << " IFNO=" << current[2]
     121        << " SRCTYPE=" << srcType << LogIO::POST ;
    110122    // only process ON position and no WVR
    111123    Vector<uInt> rows = iter.getRows( SHARE ) ;
     
    129141    iter.next() ;
    130142  }
     143
     144  os_ << "detected " << noff_ << " integrations near edge" << LogIO::POST ;
    131145}
    132146
    133147void EdgeMarker::mark()
    134148{
     149  os_.origin(LogOrigin( "EdgeMarker", "mark", WHERE )) ;
     150
     151  os_ << "marked " << noff_ << " points as OFF" << LogIO::POST ;
    135152  ScalarColumn<Int> srcTypeCol( st_->table(), "SRCTYPE" ) ;
    136153  Int psoff = Int(SrcType::PSOFF) ;
  • trunk/src/GenericEdgeDetector.cpp

    r2614 r2615  
    3434Vector<uInt> GenericEdgeDetector::detect()
    3535{
     36  os_.origin(LogOrigin( "GenericEdgeDetector", "detect", WHERE )) ;
     37
    3638  initDetect() ;
    3739
     
    4446  tuning() ;
    4547
     48  os_ << LogIO::DEBUGGING
     49      << "Detected " << off_.nelements() << " integrations as OFF" << LogIO::POST ; 
     50
    4651  return off_ ;
    4752}
     
    9196void GenericEdgeDetector::topixel()
    9297{
    93   os_.origin(LogOrigin( "GenericEdgeDetector", "setup", WHERE )) ;
     98//   os_.origin(LogOrigin( "GenericEdgeDetector", "topixel", WHERE )) ;
    9499
    95100  setup() ;
     
    112117  }
    113118  dir_.freeStorage( dir_p, b ) ;
    114 
    115   os_ << "end topixel" << LogIO::POST ;
    116119}
    117120
     
    141144  dy_ = dx_ ;
    142145
    143   os_ << "dx=" << dx_ << ", dy=" << dy_ << LogIO::POST ;
    144 
    145146  Double xmax, xmin, ymax, ymin ;
    146147  minMax( xmin, xmax, dir_.row( 0 ) ) ;
     
    158159  pceny_ = 0.5 * Double( ny_ - 1 ) ;
    159160
    160   os_ << "rangex=(" << xmin << "," << xmax << ")" << LogIO::POST ;
    161   os_ << "rangey=(" << ymin << "," << ymax << ")" << LogIO::POST ;
    162   os_ << "median separation between pointings: " << med << LogIO::POST ;
    163   os_ << "dx=" << dx_ << ", dy=" << dy_ << LogIO::POST ;
    164   os_ << "wx=" << wx << ", wy=" << wy << LogIO::POST ;
    165   os_ << "nx=" << nx_ << ", ny=" << ny_ << LogIO::POST ;
     161  os_ << LogIO::DEBUGGING
     162      << "rangex=(" << xmin << "," << xmax << ")" << endl
     163      << "rangey=(" << ymin << "," << ymax << ")" << endl
     164      << "median separation between pointings: " << med << endl
     165      << "dx=" << dx_ << ", dy=" << dy_ << endl
     166      << "wx=" << wx << ", wy=" << wy << endl
     167      << "nx=" << nx_ << ", ny=" << ny_ << LogIO::POST ;
    166168}
    167169
     
    191193  }
    192194
    193   os_ << "a.max()=" << max(apix_) << ",a.min()=" << min(apix_) << LogIO::POST ;
     195  os_ << LogIO::DEBUGGING
     196      << "a.max()=" << max(apix_) << ",a.min()=" << min(apix_) << LogIO::POST ;
    194197}
    195198
     
    210213  uInt n = 1 ;
    211214  uInt niter = 0 ;
    212   const uInt maxiter = 10 ;
     215  const uInt maxiter = 100 ;
    213216  while ( n > 0 && niter < maxiter ) {
    214217    n = _labeling( apix_ ) ;
    215     os_ << "labeled " << n << " pixels in this cycle" << LogIO::POST ;
     218    os_ << LogIO::DEBUGGING
     219        << "cycle " << niter << ": labeled " << n << " pixels" << LogIO::POST ;
    216220    niter++ ;
    217221  }
     
    278282  const uInt n1 = sum( apix_ ) ;
    279283  const uInt nTrim = uInt(ceil( n1 * fraction_ )) ;
    280   os_ << "number of nonzero pixel: " << n1 << LogIO::POST ;
    281   os_ << "fraction: " << fraction_ << LogIO::POST ;
    282   os_ << "number of pixels to be trimmed: " << nTrim << LogIO::POST ;
     284  os_ << LogIO::DEBUGGING
     285      << "number of nonzero pixel: " << n1 << endl
     286      << "number of pixels to be trimmed: " << nTrim << LogIO::POST ;
    283287  uInt n = 0 ;
    284288  uInt niter = 0 ;
     
    287291    while ( n < nTrim && niter < maxiter ) {
    288292      uInt m = _trimming( apix_ ) ;
    289       os_ << "trimmed " << m << " pixels" << LogIO::POST ;
     293      os_ << LogIO::DEBUGGING
     294          << "cycle " << niter << ": trimmed " << m << " pixels" << LogIO::POST ;
    290295      n += m ;
    291296      niter++ ;
     
    296301    while ( n < nTrim && niter < maxiter ) {
    297302      uInt m = _trimming1DX( apix_ ) ;
     303      os_ << LogIO::DEBUGGING
     304          << "cycle " << niter << ": trimmed " << m << " pixels" << LogIO::POST ;
    298305      n += m ;
    299306      niter++ ;
     
    304311    while ( n < nTrim && niter < maxiter ) {
    305312      uInt m = _trimming1DY( apix_ ) ;
     313      os_ << LogIO::DEBUGGING
     314          << "cycle " << niter << ": trimmed " << m << " pixels" << LogIO::POST ;
    306315      n += m ;
    307316      niter++ ;
    308317    }
    309318  }
    310   os_ << "number of pixels actually trimmed: " << n << LogIO::POST ;
     319  os_ << LogIO::DEBUGGING
     320      << "number of pixels actually trimmed: " << n << LogIO::POST ;
    311321
    312322  if ( niter == maxiter ) {
     
    426436void GenericEdgeDetector::selection()
    427437{
    428   os_.origin(LogOrigin( "GenericEdgeDetector", "selection", WHERE )) ;
     438//   os_.origin(LogOrigin( "GenericEdgeDetector", "selection", WHERE )) ;
    429439
    430440  uInt nrow = pdir_.shape()[1] ;
    431   os_ << "nrow=" << nrow << LogIO::POST ;
    432441  const Double *px_p = pdir_.data() ;
    433442  const Double *py_p = px_p + 1 ;
     
    442451    py_p += 2 ;
    443452  }
    444   os_ << "off_.nelements()=" << off_.nelements() << LogIO::POST ;
    445453  off_ = vectorFromTempStorage( n ) ;
    446   os_ << "off_.nelements()=" << off_.nelements() << LogIO::POST ;
    447454}
    448455
     
    451458  os_.origin(LogOrigin( "GenericEdgeDetector", "tuning", WHERE )) ;
    452459
    453   os_ << "start" << LogIO::POST ;
    454460  const uInt len = off_.nelements() ;
    455   os_ << "len=" << len << LogIO::POST ;
    456461  if ( len == 0 )
    457462    return ;
    458463
    459   Vector<uInt> diff = off_.copy() ;
    460   for ( uInt i = len-1 ; i > 0 ; i-- ) {
    461     diff[i] -= diff[i-1] ;
     464  Vector<uInt> diff( len-1 ) ;
     465  for ( uInt i = 0 ; i < len-1 ; i++ ) {
     466    diff[i] = off_[i+1] - off_[i] ;
    462467  }
    463468  const uInt threshold = 3 ;
     
    467472  }
    468473  for ( uInt i = 1 ; i < len ; i++ ) {
    469     if ( diff[i] != 1 && diff[i] < threshold ) {
    470       uInt t = off_[i-1]+1 ;
     474    uInt ii = i - 1 ;
     475    if ( diff[ii] != 1 && diff[ii] < threshold ) {
     476      uInt t = off_[ii]+1 ;
    471477      uInt u = off_[i] ;
    472478      for ( uInt j = t ; j < u ; j++ ) {
    473         os_ << "move " << j << " from ON to OFF" << LogIO::POST ;
     479        os_ << LogIO::DEBUGGING
     480            << "move " << j << " from ON to OFF" << LogIO::POST ;
    474481        tempuInt_[n++] = j ;
    475482      }
  • trunk/src/RasterEdgeDetector.cpp

    r2613 r2615  
    3232Vector<uInt> RasterEdgeDetector::detect()
    3333{
     34  os_.origin(LogOrigin( "RasterEdgeDetector", "detect", WHERE )) ;
     35
    3436  initDetect() ;
    3537
     
    3739  selection() ;
    3840 
     41  os_ << LogIO::DEBUGGING
     42      << "Detected " << off_.nelements() << " integrations as OFF" << LogIO::POST ;
     43
    3944  return off_ ;
    4045}
     
    99104  }
    100105  gaplist_ = vectorFromTempStorage( idx ) ;
     106 
     107  os_ << LogIO::DEBUGGING
     108      << "Detected " << gaplist_.nelements() << " time gaps." << LogIO::POST ;
    101109}
    102110
    103111void RasterEdgeDetector::selection()
    104112{
    105   os_.origin(LogOrigin( "RasterEdgeDetector", "selection", WHERE )) ;
     113//   os_.origin(LogOrigin( "RasterEdgeDetector", "selection", WHERE )) ;
    106114
    107115  uInt n = gaplist_.nelements() - 1 ;
     
    120128                                          const uint &end )
    121129{
    122   os_.origin(LogOrigin( "RasterEdgeDetector", "selectionPerRow", WHERE )) ;
     130//   os_.origin(LogOrigin( "RasterEdgeDetector", "selectionPerRow", WHERE )) ;
    123131
    124132  uInt len = end - start ;
Note: See TracChangeset for help on using the changeset viewer.