Changeset 2615 for trunk/src/GenericEdgeDetector.cpp
- Timestamp:
- 08/01/12 15:32:08 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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 }
Note: See TracChangeset
for help on using the changeset viewer.