Commit a5cfc4d81cf31a90c172b5ac5e10c74afc08f535
1 parent
aa44445c
Do not skip bins with zero counts in csspec (#2672)
Showing
4 changed files
with
9 additions
and
5 deletions
ChangeLog
| ... | ... | @@ -3,6 +3,7 @@ |
| 3 | 3 | * Version 1.6.0 released |
| 4 | 4 | ======================== |
| 5 | 5 | |
| 6 | + Do not skip bins with zero counts in csspec (#2672) | |
| 6 | 7 | Use "ENERG" instead of "ETRUE" in energy dispersion axis names in csroot2caldb (#2670) |
| 7 | 8 | Add hidden "use_irf_bkg" parameter to csphagen (#2659) |
| 8 | 9 | Use full RMF true energy range for On/Off analysis in csspec (#2656) | ... | ... |
NEWS
| ... | ... | @@ -315,6 +315,8 @@ Add hidden "nthreads" parameter and implement parallelisation of computations |
| 315 | 315 | |
| 316 | 316 | csspec - Generates Spectral Energy Distribution |
| 317 | 317 | ----------------------------------------------- |
| 318 | +The script no longer skips energy bins with zero counts (#2672). | |
| 319 | + | |
| 318 | 320 | The full true energy range of the RMF is now used in an On/Off analysis to |
| 319 | 321 | prevent cutting off the tails of the energy dispersion, which happened before |
| 320 | 322 | when the script was used for the analysis of H.E.S.S. data (#2656). | ... | ... |
cscripts/csspec.py
| ... | ... | @@ -640,15 +640,14 @@ class csspec(ctools.csobservation): |
| 640 | 640 | # Write header for fitting |
| 641 | 641 | self._log_header3(gammalib.EXPLICIT, 'Performing fit') |
| 642 | 642 | |
| 643 | - # Perform maximum likelihood fit. Skip bins that have no events. | |
| 643 | + # Perform maximum likelihood fit | |
| 644 | 644 | like = ctools.ctlike(obs) |
| 645 | 645 | like['edisp'] = self['edisp'].boolean() |
| 646 | 646 | like['nthreads'] = 1 # Avoids OpenMP conflict |
| 647 | - if like.obs().nobserved() > 0: | |
| 648 | - like.run() | |
| 647 | + like.run() | |
| 649 | 648 | |
| 650 | 649 | # Continue only if log-likelihood is non-zero |
| 651 | - if like.obs().logL() != 0.0 and like.obs().nobserved() > 0: | |
| 650 | + if like.obs().logL() != 0.0: | |
| 652 | 651 | |
| 653 | 652 | # Get results |
| 654 | 653 | fitted_models = like.obs().models() |
| ... | ... | @@ -715,7 +714,7 @@ class csspec(ctools.csobservation): |
| 715 | 714 | # ... otherwise if logL is zero then signal that bin is |
| 716 | 715 | # skipped |
| 717 | 716 | else: |
| 718 | - value = 'No event in this bin. Likelihood is zero. Bin is skipped.' | |
| 717 | + value = 'Likelihood is zero. Bin is skipped.' | |
| 719 | 718 | self._log_value(gammalib.TERSE, 'Bin '+str(i+1), value) |
| 720 | 719 | |
| 721 | 720 | # Return result | ... | ... |
doc/source/admin/release_history/1.6.rst
| ... | ... | @@ -32,6 +32,8 @@ Bug fixes |
| 32 | 32 | Improvements |
| 33 | 33 | ------------ |
| 34 | 34 | |
| 35 | +* [`2672 <https://cta-redmine.irap.omp.eu/issues/2672>`_] - | |
| 36 | + Do not skip bins with zero counts in :ref:`csspec` | |
| 35 | 37 | * [`2670 <https://cta-redmine.irap.omp.eu/issues/2670>`_] - |
| 36 | 38 | Use ``ENERG`` instead of ``ETRUE`` in energy dispersion axis names in |
| 37 | 39 | :ref:`csroot2caldb` | ... | ... |