Commit d697796badec5e2adb75bff412d3a2328e8d3e41
Committed by
Jürgen Knödlseder
1 parent
e8cd0425
Remove debug text (#2713)
Showing
1 changed file
with
35 additions
and
54 deletions
src/ctfindvar/ctfindvar.cpp
| ... | ... | @@ -321,13 +321,6 @@ void ctfindvar::run(void) |
| 321 | 321 | for (int k = 0; k < m_counts.nmaps(); k++) { |
| 322 | 322 | total_counts += m_counts(pix_number, k); |
| 323 | 323 | } |
| 324 | - #ifdef G_DEBUG | |
| 325 | - if(pix_number%20==0) { | |
| 326 | - std::cout << "Pixel number " << pix_number ; | |
| 327 | - std::cout << " has a total number of counts of: "; | |
| 328 | - std::cout << total_counts << std::endl; | |
| 329 | - } | |
| 330 | - #endif | |
| 331 | 324 | |
| 332 | 325 | //Getting the variability significance for the pixel |
| 333 | 326 | get_variability_sig(pix_number,nbins, pixSig); |
| ... | ... | @@ -342,10 +335,6 @@ void ctfindvar::run(void) |
| 342 | 335 | for (int i = 0; i < nbins; i++) { |
| 343 | 336 | m_pixsigsrc(src,i) = pixSig(i); |
| 344 | 337 | } |
| 345 | - #ifdef G_DEBUG | |
| 346 | - std::cout << "checking pixel of the source of interest: " << pix_number ; | |
| 347 | - std::cout << " with total number of counts of: " << total_counts << std::endl; | |
| 348 | - #endif | |
| 349 | 338 | } |
| 350 | 339 | #ifdef G_DEBUG |
| 351 | 340 | std::cout << "checking pixel number of the source of interest" << pix_number << std::endl; |
| ... | ... | @@ -357,12 +346,6 @@ void ctfindvar::run(void) |
| 357 | 346 | #endif |
| 358 | 347 | } |
| 359 | 348 | } |
| 360 | - | |
| 361 | - #ifdef G_DEBUG | |
| 362 | - std::cout << "checking pixel number of the source of interest: " ; | |
| 363 | - std::cout << pix_number << " - with total number of counts of: " ; | |
| 364 | - std::cout << total_counts << std::endl; | |
| 365 | - #endif | |
| 366 | 349 | |
| 367 | 350 | // Getting the evolution for the pix with highest significance |
| 368 | 351 | #pragma omp critical(ctfind_run) |
| ... | ... | @@ -380,8 +363,8 @@ void ctfindvar::run(void) |
| 380 | 363 | //If the significance is greater than sig threshold, the position |
| 381 | 364 | //is stored in a model |
| 382 | 365 | if (max(pixSig) > m_sig_threshold) { |
| 383 | - GSkyDir dir_pix = m_counts.inx2dir(pix_number); | |
| 384 | - fill_model_sig_pos(dir_pix); | |
| 366 | + GSkyDir dir_pix = m_counts.inx2dir(pix_number); | |
| 367 | + fill_model_sig_pos(dir_pix); | |
| 385 | 368 | } |
| 386 | 369 | |
| 387 | 370 | } |
| ... | ... | @@ -429,60 +412,58 @@ void ctfindvar::get_variability_sig(const int& pix_number, |
| 429 | 412 | |
| 430 | 413 | // The GTI is discared from bckg calculation and not checked again. |
| 431 | 414 | if (!accepted_bin_bckg_vector[i]) { |
| 432 | - continue; | |
| 433 | - } | |
| 434 | - // Check if bin fails minoff check or no observations overlap it | |
| 415 | + continue; | |
| 416 | + } | |
| 417 | + // Check if bin fails minoff check or no observations overlap it | |
| 435 | 418 | else if (m_counts(pix_number, i) < m_minoff || alpha_vector[i] == 0) { |
| 436 | 419 | accepted_bin_bckg_vector[i] = false; |
| 437 | - continue; | |
| 438 | - } | |
| 420 | + continue; | |
| 421 | + } | |
| 439 | 422 | |
| 440 | - noff = 0.0; | |
| 423 | + noff = 0.0; | |
| 441 | 424 | alpha = 0.0; |
| 442 | 425 | // Gor one GTI selected (i), looping over all the others (j). |
| 443 | 426 | for (int j = 0; j < nbins; j++) { |
| 444 | 427 | if (j != i && accepted_bin_bckg_vector[j] == 1) { |
| 445 | 428 | noff += m_counts(pix_number, j); |
| 446 | 429 | alpha += alpha_vector[j]; |
| 447 | - } | |
| 448 | - } | |
| 430 | + } | |
| 431 | + } | |
| 449 | 432 | |
| 450 | 433 | // The background is averaged on the number of bins -1 |
| 451 | - non = m_counts(pix_number, i); | |
| 452 | - alpha = alpha_vector[i]/alpha; | |
| 434 | + non = m_counts(pix_number, i); | |
| 435 | + alpha = alpha_vector[i]/alpha; | |
| 453 | 436 | |
| 454 | 437 | // Compute sensitivity in Gaussian sigma using Li & Ma |
| 455 | - double alpha1 = alpha + 1.0; | |
| 456 | - double ntotal = non+noff; | |
| 457 | - double arg1 = non/ntotal; | |
| 458 | - double arg2 = noff/ntotal; | |
| 459 | - if (noff == 0.0) { | |
| 460 | - sig = 0.0; | |
| 461 | - } else if (non > 0.0) { | |
| 462 | - double term1 = non * std::log((alpha1/alpha)*arg1); | |
| 463 | - double term2 = noff * std::log(alpha1*arg2); | |
| 464 | - sig = std::sqrt(2.0 * (term1 + term2)); | |
| 465 | - } else { | |
| 466 | - sig = std::sqrt(2.0 * noff * std::log(alpha1)); | |
| 467 | - } | |
| 468 | - | |
| 469 | - // Specify the sign of the significance | |
| 470 | - sig *= (non < alpha*noff) ? -1.0 : 1.0; | |
| 471 | - | |
| 472 | - if (alpha == 0.0) { | |
| 473 | - sig = 0.0; | |
| 474 | - } | |
| 438 | + double alpha1 = alpha + 1.0; | |
| 439 | + double ntotal = non+noff; | |
| 440 | + double arg1 = non/ntotal; | |
| 441 | + double arg2 = noff/ntotal; | |
| 442 | + if (noff == 0.0) { | |
| 443 | + sig = 0.0; | |
| 444 | + } else if (non > 0.0) { | |
| 445 | + double term1 = non * std::log((alpha1/alpha)*arg1); | |
| 446 | + double term2 = noff * std::log(alpha1*arg2); | |
| 447 | + sig = std::sqrt(2.0 * (term1 + term2)); | |
| 448 | + } else { | |
| 449 | + sig = std::sqrt(2.0 * noff * std::log(alpha1)); | |
| 450 | + } | |
| 451 | + | |
| 452 | + // Specify the sign of the significance | |
| 453 | + sig *= (non < alpha*noff) ? -1.0 : 1.0; | |
| 454 | + | |
| 455 | + if (alpha == 0.0) { | |
| 456 | + sig = 0.0; | |
| 457 | + } | |
| 475 | 458 | |
| 476 | 459 | // Update the significance |
| 477 | 460 | sig_histogram(i) = sig; |
| 478 | - #ifdef G_DEBUG | |
| 479 | - //std::cout << "significance of the bin : " << i << " : " << sig << " - alpha : " << alpha << " - non: " << non << " - noff: " << noff << "- excess: " << non - alpha*noff << std::endl; | |
| 480 | - #endif | |
| 461 | + | |
| 481 | 462 | // If the bin is significant, it is removed from the bckg and we loop again. |
| 482 | 463 | if (sig > m_sig_threshold) { |
| 483 | 464 | accepted_bin_bckg_vector[i] = false; |
| 484 | 465 | background_validated = false; |
| 485 | - } | |
| 466 | + } | |
| 486 | 467 | } |
| 487 | 468 | |
| 488 | 469 | } |
| ... | ... | @@ -668,7 +649,7 @@ void ctfindvar::save(void) |
| 668 | 649 | //Save the model file with position with significance |
| 669 | 650 | if (m_model_above_thr.size() > 2) { |
| 670 | 651 | GFilename model_filename = prefix + "model_significant_directions.xml"; |
| 671 | - m_model_above_thr.save(model_filename); | |
| 652 | + m_model_above_thr.save(model_filename); | |
| 672 | 653 | } |
| 673 | 654 | |
| 674 | 655 | // Return | ... | ... |