Commit ce13a42e8ac03ec15c43639f8764cf3497a3dea7
1 parent
c9dfb402
Original energy boundaries are now restored after each sensitivit computation per energy bin
Showing
1 changed file
with
10 additions
and
1 deletions
cscripts/cssens.py
| ... | ... | @@ -53,6 +53,7 @@ class cssens(ctools.cscript): |
| 53 | 53 | # Initialise class members |
| 54 | 54 | self._obs = gammalib.GObservations() |
| 55 | 55 | self._ebounds = gammalib.GEbounds() |
| 56 | + self._obs_ebounds = [] | |
| 56 | 57 | self._srcname = "" |
| 57 | 58 | self._outfile = gammalib.GFilename() |
| 58 | 59 | self._ra = None |
| ... | ... | @@ -657,6 +658,10 @@ class cssens(ctools.cscript): |
| 657 | 658 | for par in model: |
| 658 | 659 | self._log(str(par)+"\n") |
| 659 | 660 | |
| 661 | + # Restore energy boundaries of observation container | |
| 662 | + for i, obs in enumerate(self._obs): | |
| 663 | + obs.events().ebounds(self._obs_ebounds[i]) | |
| 664 | + | |
| 660 | 665 | # Store result |
| 661 | 666 | result = {'loge': loge, 'emin': emin.TeV(), 'emax': emax.TeV(), \ |
| 662 | 667 | 'crab_flux': crab_flux, 'photon_flux': photon_flux, \ |
| ... | ... | @@ -678,7 +683,11 @@ class cssens(ctools.cscript): |
| 678 | 683 | |
| 679 | 684 | # Get parameters |
| 680 | 685 | self._get_parameters() |
| 681 | - | |
| 686 | + | |
| 687 | + # Loop over observations and store ebounds | |
| 688 | + for obs in self._obs: | |
| 689 | + self._obs_ebounds.append(obs.events().ebounds()) | |
| 690 | + | |
| 682 | 691 | # Initialise script |
| 683 | 692 | colnames = ['loge', 'emin', 'emax', 'crab_flux', 'photon_flux', |
| 684 | 693 | 'energy_flux', 'sensitivity'] | ... | ... |