Commit 9a6d4bbe8a90dc3ff4f570123cb01faac8482ee2
1 parent
0d92b43b
First working version using gaussian error propagation.
Showing
1 changed file
with
8 additions
and
11 deletions
src/ctbutterfly/ctbutterfly.cpp
| ... | ... | @@ -245,7 +245,7 @@ void ctbutterfly::run(void) |
| 245 | 245 | |
| 246 | 246 | // Get covariance matrix. |
| 247 | 247 | GObservations::likelihood likelihood = m_obs.function(); |
| 248 | - if(!gepmode) { | |
| 248 | + if(!m_gepmode) { | |
| 249 | 249 | m_covariance = likelihood.curvature()->invert(); |
| 250 | 250 | } |
| 251 | 251 | else { |
| ... | ... | @@ -275,7 +275,7 @@ void ctbutterfly::run(void) |
| 275 | 275 | likelihood.eval(pars); |
| 276 | 276 | |
| 277 | 277 | // Get covariance matrix. |
| 278 | - if(!gepmode) { | |
| 278 | + if(!m_gepmode) { | |
| 279 | 279 | m_covariance = likelihood.curvature()->invert(); |
| 280 | 280 | } |
| 281 | 281 | else { |
| ... | ... | @@ -312,6 +312,8 @@ void ctbutterfly::run(void) |
| 312 | 312 | double prefactor_mean = (*skymodel)["Prefactor"].value(); |
| 313 | 313 | double index_mean = (*skymodel)["Index"].value(); |
| 314 | 314 | double pivot_mean = (*skymodel)["PivotEnergy"].value(); |
| 315 | + double prefactor_scale = (*skymodel)["Prefactor"].scale(); | |
| 316 | + double index_scale = (*skymodel)["Index"].scale(); | |
| 315 | 317 | GEnergy pivot(pivot_mean, "MeV"); |
| 316 | 318 | |
| 317 | 319 | // Write parameter indices into logger |
| ... | ... | @@ -373,11 +375,11 @@ void ctbutterfly::run(void) |
| 373 | 375 | |
| 374 | 376 | // Compute prefactor and index |
| 375 | 377 | double prefactor = (major * cos_t * vector1[0] + |
| 376 | - minor * sin_t * vector2[0]) + | |
| 377 | - prefactor_mean; | |
| 378 | + minor * sin_t * vector2[0]) * prefactor_scale + | |
| 379 | + prefactor_mean; | |
| 378 | 380 | double index = (major * cos_t * vector1[1] + |
| 379 | - minor * sin_t * vector2[1]) + | |
| 380 | - index_mean; | |
| 381 | + minor * sin_t * vector2[1]) * index_scale + | |
| 382 | + index_mean; | |
| 381 | 383 | |
| 382 | 384 | // Write prefactor and index into logger |
| 383 | 385 | log_value(EXPLICIT, "Angle "+gammalib::str(t*gammalib::rad2deg), |
| ... | ... | @@ -452,11 +454,6 @@ void ctbutterfly::run(void) |
| 452 | 454 | |
| 453 | 455 | // Get the energy of current bin |
| 454 | 456 | GEnergy energy = m_ebounds.elogmean(i); |
| 455 | - | |
| 456 | - // Log status info | |
| 457 | - std::string msg = "Computing butterfly for bin number "+ | |
| 458 | - gammalib::str(i)+" at "+energy.print(); | |
| 459 | - log_string(NORMAL, msg); | |
| 460 | 457 | |
| 461 | 458 | // Initialise model flux value |
| 462 | 459 | double model_flux = 0.0; | ... | ... |