Changeset 2615
- Timestamp:
- 08/01/12 15:32:08 (12 years ago)
- Location:
- trunk/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/EdgeMarker.cpp
r2613 r2615 30 30 EdgeMarker::EdgeMarker() 31 31 { 32 detector_ = new GenericEdgeDetector() ;32 EdgeMarker( false ) ; 33 33 } 34 34 35 35 EdgeMarker::EdgeMarker( bool israster ) 36 36 { 37 if ( israster ) 37 os_.origin(LogOrigin( "EdgeMarker", "EdgeMarker", WHERE )) ; 38 39 if ( israster ) { 40 os_ << "edge detection by RasterEdgeDetector" << LogIO::POST ; 38 41 detector_ = new RasterEdgeDetector() ; 39 else 42 } 43 else { 44 os_ << "edge detection by GenericEdgeDetector" << LogIO::POST ; 40 45 detector_ = new GenericEdgeDetector() ; 46 } 41 47 } 42 48 … … 63 69 void EdgeMarker::examine() 64 70 { 71 os_.origin(LogOrigin( "EdgeMarker", "examine", WHERE )) ; 72 65 73 // exclude WVR 66 74 vector<uInt> wvr ; … … 79 87 } 80 88 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 } 83 94 } 84 95 … … 104 115 Vector<uInt> current = iter.current() ; 105 116 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 ; 110 122 // only process ON position and no WVR 111 123 Vector<uInt> rows = iter.getRows( SHARE ) ; … … 129 141 iter.next() ; 130 142 } 143 144 os_ << "detected " << noff_ << " integrations near edge" << LogIO::POST ; 131 145 } 132 146 133 147 void EdgeMarker::mark() 134 148 { 149 os_.origin(LogOrigin( "EdgeMarker", "mark", WHERE )) ; 150 151 os_ << "marked " << noff_ << " points as OFF" << LogIO::POST ; 135 152 ScalarColumn<Int> srcTypeCol( st_->table(), "SRCTYPE" ) ; 136 153 Int psoff = Int(SrcType::PSOFF) ; -
trunk/src/GenericEdgeDetector.cpp
r2614 r2615 34 34 Vector<uInt> GenericEdgeDetector::detect() 35 35 { 36 os_.origin(LogOrigin( "GenericEdgeDetector", "detect", WHERE )) ; 37 36 38 initDetect() ; 37 39 … … 44 46 tuning() ; 45 47 48 os_ << LogIO::DEBUGGING 49 << "Detected " << off_.nelements() << " integrations as OFF" << LogIO::POST ; 50 46 51 return off_ ; 47 52 } … … 91 96 void GenericEdgeDetector::topixel() 92 97 { 93 os_.origin(LogOrigin( "GenericEdgeDetector", "setup", WHERE )) ;98 // os_.origin(LogOrigin( "GenericEdgeDetector", "topixel", WHERE )) ; 94 99 95 100 setup() ; … … 112 117 } 113 118 dir_.freeStorage( dir_p, b ) ; 114 115 os_ << "end topixel" << LogIO::POST ;116 119 } 117 120 … … 141 144 dy_ = dx_ ; 142 145 143 os_ << "dx=" << dx_ << ", dy=" << dy_ << LogIO::POST ;144 145 146 Double xmax, xmin, ymax, ymin ; 146 147 minMax( xmin, xmax, dir_.row( 0 ) ) ; … … 158 159 pceny_ = 0.5 * Double( ny_ - 1 ) ; 159 160 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 ; 166 168 } 167 169 … … 191 193 } 192 194 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 ; 194 197 } 195 198 … … 210 213 uInt n = 1 ; 211 214 uInt niter = 0 ; 212 const uInt maxiter = 10 ;215 const uInt maxiter = 100 ; 213 216 while ( n > 0 && niter < maxiter ) { 214 217 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 ; 216 220 niter++ ; 217 221 } … … 278 282 const uInt n1 = sum( apix_ ) ; 279 283 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 ; 283 287 uInt n = 0 ; 284 288 uInt niter = 0 ; … … 287 291 while ( n < nTrim && niter < maxiter ) { 288 292 uInt m = _trimming( apix_ ) ; 289 os_ << "trimmed " << m << " pixels" << LogIO::POST ; 293 os_ << LogIO::DEBUGGING 294 << "cycle " << niter << ": trimmed " << m << " pixels" << LogIO::POST ; 290 295 n += m ; 291 296 niter++ ; … … 296 301 while ( n < nTrim && niter < maxiter ) { 297 302 uInt m = _trimming1DX( apix_ ) ; 303 os_ << LogIO::DEBUGGING 304 << "cycle " << niter << ": trimmed " << m << " pixels" << LogIO::POST ; 298 305 n += m ; 299 306 niter++ ; … … 304 311 while ( n < nTrim && niter < maxiter ) { 305 312 uInt m = _trimming1DY( apix_ ) ; 313 os_ << LogIO::DEBUGGING 314 << "cycle " << niter << ": trimmed " << m << " pixels" << LogIO::POST ; 306 315 n += m ; 307 316 niter++ ; 308 317 } 309 318 } 310 os_ << "number of pixels actually trimmed: " << n << LogIO::POST ; 319 os_ << LogIO::DEBUGGING 320 << "number of pixels actually trimmed: " << n << LogIO::POST ; 311 321 312 322 if ( niter == maxiter ) { … … 426 436 void GenericEdgeDetector::selection() 427 437 { 428 os_.origin(LogOrigin( "GenericEdgeDetector", "selection", WHERE )) ;438 // os_.origin(LogOrigin( "GenericEdgeDetector", "selection", WHERE )) ; 429 439 430 440 uInt nrow = pdir_.shape()[1] ; 431 os_ << "nrow=" << nrow << LogIO::POST ;432 441 const Double *px_p = pdir_.data() ; 433 442 const Double *py_p = px_p + 1 ; … … 442 451 py_p += 2 ; 443 452 } 444 os_ << "off_.nelements()=" << off_.nelements() << LogIO::POST ;445 453 off_ = vectorFromTempStorage( n ) ; 446 os_ << "off_.nelements()=" << off_.nelements() << LogIO::POST ;447 454 } 448 455 … … 451 458 os_.origin(LogOrigin( "GenericEdgeDetector", "tuning", WHERE )) ; 452 459 453 os_ << "start" << LogIO::POST ;454 460 const uInt len = off_.nelements() ; 455 os_ << "len=" << len << LogIO::POST ;456 461 if ( len == 0 ) 457 462 return ; 458 463 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] ; 462 467 } 463 468 const uInt threshold = 3 ; … … 467 472 } 468 473 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 ; 471 477 uInt u = off_[i] ; 472 478 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 ; 474 481 tempuInt_[n++] = j ; 475 482 } -
trunk/src/RasterEdgeDetector.cpp
r2613 r2615 32 32 Vector<uInt> RasterEdgeDetector::detect() 33 33 { 34 os_.origin(LogOrigin( "RasterEdgeDetector", "detect", WHERE )) ; 35 34 36 initDetect() ; 35 37 … … 37 39 selection() ; 38 40 41 os_ << LogIO::DEBUGGING 42 << "Detected " << off_.nelements() << " integrations as OFF" << LogIO::POST ; 43 39 44 return off_ ; 40 45 } … … 99 104 } 100 105 gaplist_ = vectorFromTempStorage( idx ) ; 106 107 os_ << LogIO::DEBUGGING 108 << "Detected " << gaplist_.nelements() << " time gaps." << LogIO::POST ; 101 109 } 102 110 103 111 void RasterEdgeDetector::selection() 104 112 { 105 os_.origin(LogOrigin( "RasterEdgeDetector", "selection", WHERE )) ;113 // os_.origin(LogOrigin( "RasterEdgeDetector", "selection", WHERE )) ; 106 114 107 115 uInt n = gaplist_.nelements() - 1 ; … … 120 128 const uint &end ) 121 129 { 122 os_.origin(LogOrigin( "RasterEdgeDetector", "selectionPerRow", WHERE )) ;130 // os_.origin(LogOrigin( "RasterEdgeDetector", "selectionPerRow", WHERE )) ; 123 131 124 132 uInt len = end - start ;
Note:
See TracChangeset
for help on using the changeset viewer.