Commit f349fd81b4ec7d9625aeaaa14f8bd945cfebc838
Committed by
Jürgen Knödlseder
1 parent
93f8b5d8
fix the get_variability_sig in ctfindvar and the src/Makefile.am (#2713)
Showing
2 changed files
with
19 additions
and
7 deletions
src/Makefile.am
| ... | ... | @@ -60,7 +60,6 @@ pkginclude_HEADERS = ctools.hpp |
| 60 | 60 | lib_LTLIBRARIES = libctools.la |
| 61 | 61 | libctools_la_SOURCES = |
| 62 | 62 | libctools_la_LIBADD = support/libsupport.la \ |
| 63 | - ctfindvar/libctfindvar.la \ | |
| 64 | 63 | ctbin/libctbin.la \ |
| 65 | 64 | ctlike/libctlike.la \ |
| 66 | 65 | ctmodel/libctmodel.la \ | ... | ... |
src/ctfindvar/ctfindvar.cpp
| ... | ... | @@ -31,6 +31,7 @@ |
| 31 | 31 | #include "ctfindvar.hpp" |
| 32 | 32 | #include "GammaLib.hpp" |
| 33 | 33 | #include "GCTALib.hpp" |
| 34 | +#include <cmath> | |
| 34 | 35 | |
| 35 | 36 | /* __ OpenMP section _____________________________________________________ */ |
| 36 | 37 | //#ifdef _OPENMP |
| ... | ... | @@ -233,7 +234,7 @@ void ctfindvar::run(void) |
| 233 | 234 | // GNdarray GNdarray_temp(NBINS); |
| 234 | 235 | // for (int i=0, i<number of pixels; i++) |
| 235 | 236 | // { |
| 236 | - // get_variability_sig(pix_number, GNdarray_temp) | |
| 237 | + // get_variability_sig(pix_number,nbins, G Ndarray_temp) | |
| 237 | 238 | // if (position == source position) |
| 238 | 239 | // { |
| 239 | 240 | // GNdarray_source= GNdarray_temp; |
| ... | ... | @@ -254,7 +255,9 @@ void ctfindvar::get_variability_sig(const int& pix_number, const int& nbins, GNd |
| 254 | 255 | { |
| 255 | 256 | //const int nbins = hist->GetNbinsX(); |
| 256 | 257 | //const int nbins = VECTOR.size() |
| 257 | - //const int nbins = GSKYMAP.maps(); | |
| 258 | + //const int nbins = m_counts.maps(); | |
| 259 | + std::vector<bool> accepted_bin_bckg_vector; | |
| 260 | + std::vector<double> excess_bin_vector; | |
| 258 | 261 | int background_bin_array[nbins]; |
| 259 | 262 | bool background_validated=false; |
| 260 | 263 | int non, noff; |
| ... | ... | @@ -283,7 +286,7 @@ void ctfindvar::get_variability_sig(const int& pix_number, const int& nbins, GNd |
| 283 | 286 | { |
| 284 | 287 | //background_count+=hist->GetBinContent(j+1); |
| 285 | 288 | //background_count+=VECTOR(j+1).first(pix_number); |
| 286 | - background_count+=GSKYMAP(pix_number, j); | |
| 289 | + background_count+= m_counts(pix_number, j); | |
| 287 | 290 | alpha++; |
| 288 | 291 | } |
| 289 | 292 | } |
| ... | ... | @@ -291,10 +294,20 @@ void ctfindvar::get_variability_sig(const int& pix_number, const int& nbins, GNd |
| 291 | 294 | background_bin_array[i] = background_count; //The background is averaged on the number of bins -1 |
| 292 | 295 | //non = hist->GetBinContent(i+1); |
| 293 | 296 | //non = VECTOR(i+1).first(pix_number); |
| 294 | - non = GSKYMAP(pix_number, i); | |
| 297 | + non = m_counts(pix_number, i); | |
| 295 | 298 | noff = background_bin_array[i]; |
| 296 | 299 | alpha = (1./alpha); |
| 297 | - sig = Utilities::Statistics::Significance(non,noff,alpha); | |
| 300 | + | |
| 301 | + ///////////////////////////////////////////////////////////////////////////////// | |
| 302 | + // Compute sensitivity in Gaussian sigma | |
| 303 | + double alpha1 = alpha + 1.0; | |
| 304 | + double ntotal = non+noff; | |
| 305 | + double arg1 = non/ntotal; | |
| 306 | + double arg2 = noff/ntotal; | |
| 307 | + double term1 = non * std::log((alpha1/alpha)*arg1); | |
| 308 | + double term2 = noff * std::log(alpha1*arg2); | |
| 309 | + sig = sqrt(2.0 * (term1 + term2)); | |
| 310 | + ///////////////////////////////////////////////// | |
| 298 | 311 | //sig_bin_vector[i]=sig; |
| 299 | 312 | sig_histogram(i)=sig; |
| 300 | 313 | excess_bin_vector[i]=non - alpha*noff; |
| ... | ... | @@ -451,4 +464,4 @@ void ctfindvar::init_gtis(void) |
| 451 | 464 | |
| 452 | 465 | // ToDO: This is wrong only making 1 bin |
| 453 | 466 | m_gti = GGti(tstart, tstop); |
| 454 | -} | |
| 455 | 467 | \ No newline at end of file |
| 468 | +} | ... | ... |