Commit 067e0e8e64bf5342297ff9a1cbccd601b19bcd61
Committed by
Jürgen Knödlseder
1 parent
fee36b49
Simplify algorithm removing redundant variables
Showing
1 changed file
with
6 additions
and
7 deletions
src/ctfindvar/ctfindvar.cpp
| ... | ... | @@ -403,7 +403,6 @@ void ctfindvar::get_variability_sig(const int& pix_number, |
| 403 | 403 | { |
| 404 | 404 | std::vector<bool> accepted_bin_bckg_vector(nbins, true); |
| 405 | 405 | std::vector<double> excess_bin_vector(nbins, 0.0); |
| 406 | - std::vector<int> background_bin_vector(nbins, 0); | |
| 407 | 406 | bool background_validated=false; |
| 408 | 407 | double non, noff; |
| 409 | 408 | double alpha, sig; |
| ... | ... | @@ -418,7 +417,6 @@ void ctfindvar::get_variability_sig(const int& pix_number, |
| 418 | 417 | |
| 419 | 418 | for (int i=0; i< nbins; i++) //looping over all the GTIs of the pixel |
| 420 | 419 | { |
| 421 | - alpha=0; | |
| 422 | 420 | //the GTI is discared from bckg calculation and not checked again. |
| 423 | 421 | if (accepted_bin_bckg_vector[i]==0) { |
| 424 | 422 | continue; |
| ... | ... | @@ -428,19 +426,20 @@ void ctfindvar::get_variability_sig(const int& pix_number, |
| 428 | 426 | accepted_bin_bckg_vector[i]=0; |
| 429 | 427 | continue; |
| 430 | 428 | } |
| 431 | - int background_count=0; | |
| 429 | + | |
| 430 | + noff = 0.0; | |
| 431 | + alpha = 0; | |
| 432 | 432 | for (int j=0;j<nbins;j++) // for one GTI selected (i), looping over all the others (j). |
| 433 | 433 | { |
| 434 | 434 | if (j!=i && accepted_bin_bckg_vector[j]==1) |
| 435 | 435 | { |
| 436 | - background_count+= m_counts(pix_number, j); | |
| 436 | + noff += m_counts(pix_number, j); | |
| 437 | 437 | alpha += alpha_vector[j]; |
| 438 | 438 | } |
| 439 | 439 | } |
| 440 | 440 | |
| 441 | - background_bin_vector[i] = background_count; //The background is averaged on the number of bins -1 | |
| 442 | - non = m_counts(pix_number, i); | |
| 443 | - noff = background_bin_vector[i]; | |
| 441 | + //The background is averaged on the number of bins -1 | |
| 442 | + non = m_counts(pix_number, i); | |
| 444 | 443 | alpha = alpha_vector[i]/alpha; |
| 445 | 444 | |
| 446 | 445 | ///////////////////////////////////////////////////////////////////////////////// | ... | ... |