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,13 +321,6 @@ void ctfindvar::run(void) | ||
| 321 | for (int k = 0; k < m_counts.nmaps(); k++) { | 321 | for (int k = 0; k < m_counts.nmaps(); k++) { |
| 322 | total_counts += m_counts(pix_number, k); | 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 | //Getting the variability significance for the pixel | 325 | //Getting the variability significance for the pixel |
| 333 | get_variability_sig(pix_number,nbins, pixSig); | 326 | get_variability_sig(pix_number,nbins, pixSig); |
| @@ -342,10 +335,6 @@ void ctfindvar::run(void) | @@ -342,10 +335,6 @@ void ctfindvar::run(void) | ||
| 342 | for (int i = 0; i < nbins; i++) { | 335 | for (int i = 0; i < nbins; i++) { |
| 343 | m_pixsigsrc(src,i) = pixSig(i); | 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 | #ifdef G_DEBUG | 339 | #ifdef G_DEBUG |
| 351 | std::cout << "checking pixel number of the source of interest" << pix_number << std::endl; | 340 | std::cout << "checking pixel number of the source of interest" << pix_number << std::endl; |
| @@ -357,12 +346,6 @@ void ctfindvar::run(void) | @@ -357,12 +346,6 @@ void ctfindvar::run(void) | ||
| 357 | #endif | 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 | // Getting the evolution for the pix with highest significance | 350 | // Getting the evolution for the pix with highest significance |
| 368 | #pragma omp critical(ctfind_run) | 351 | #pragma omp critical(ctfind_run) |
| @@ -380,8 +363,8 @@ void ctfindvar::run(void) | @@ -380,8 +363,8 @@ void ctfindvar::run(void) | ||
| 380 | //If the significance is greater than sig threshold, the position | 363 | //If the significance is greater than sig threshold, the position |
| 381 | //is stored in a model | 364 | //is stored in a model |
| 382 | if (max(pixSig) > m_sig_threshold) { | 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,60 +412,58 @@ void ctfindvar::get_variability_sig(const int& pix_number, | ||
| 429 | 412 | ||
| 430 | // The GTI is discared from bckg calculation and not checked again. | 413 | // The GTI is discared from bckg calculation and not checked again. |
| 431 | if (!accepted_bin_bckg_vector[i]) { | 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 | else if (m_counts(pix_number, i) < m_minoff || alpha_vector[i] == 0) { | 418 | else if (m_counts(pix_number, i) < m_minoff || alpha_vector[i] == 0) { |
| 436 | accepted_bin_bckg_vector[i] = false; | 419 | accepted_bin_bckg_vector[i] = false; |
| 437 | - continue; | ||
| 438 | - } | 420 | + continue; |
| 421 | + } | ||
| 439 | 422 | ||
| 440 | - noff = 0.0; | 423 | + noff = 0.0; |
| 441 | alpha = 0.0; | 424 | alpha = 0.0; |
| 442 | // Gor one GTI selected (i), looping over all the others (j). | 425 | // Gor one GTI selected (i), looping over all the others (j). |
| 443 | for (int j = 0; j < nbins; j++) { | 426 | for (int j = 0; j < nbins; j++) { |
| 444 | if (j != i && accepted_bin_bckg_vector[j] == 1) { | 427 | if (j != i && accepted_bin_bckg_vector[j] == 1) { |
| 445 | noff += m_counts(pix_number, j); | 428 | noff += m_counts(pix_number, j); |
| 446 | alpha += alpha_vector[j]; | 429 | alpha += alpha_vector[j]; |
| 447 | - } | ||
| 448 | - } | 430 | + } |
| 431 | + } | ||
| 449 | 432 | ||
| 450 | // The background is averaged on the number of bins -1 | 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 | // Compute sensitivity in Gaussian sigma using Li & Ma | 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 | // Update the significance | 459 | // Update the significance |
| 477 | sig_histogram(i) = sig; | 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 | // If the bin is significant, it is removed from the bckg and we loop again. | 462 | // If the bin is significant, it is removed from the bckg and we loop again. |
| 482 | if (sig > m_sig_threshold) { | 463 | if (sig > m_sig_threshold) { |
| 483 | accepted_bin_bckg_vector[i] = false; | 464 | accepted_bin_bckg_vector[i] = false; |
| 484 | background_validated = false; | 465 | background_validated = false; |
| 485 | - } | 466 | + } |
| 486 | } | 467 | } |
| 487 | 468 | ||
| 488 | } | 469 | } |
| @@ -668,7 +649,7 @@ void ctfindvar::save(void) | @@ -668,7 +649,7 @@ void ctfindvar::save(void) | ||
| 668 | //Save the model file with position with significance | 649 | //Save the model file with position with significance |
| 669 | if (m_model_above_thr.size() > 2) { | 650 | if (m_model_above_thr.size() > 2) { |
| 670 | GFilename model_filename = prefix + "model_significant_directions.xml"; | 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 | // Return | 655 | // Return |