Commit c093864a46a8fd3c7edd38aa0964312c8fd9bf62
1 parent
854ebb52
Merge in code
Showing
1 changed file
with
9 additions
and
5 deletions
cscripts/csphagen.py
| ... | ... | @@ -3,7 +3,7 @@ |
| 3 | 3 | # Computes the PHA spectra for source/background and ARF/RMF files using the |
| 4 | 4 | # reflected region method |
| 5 | 5 | # |
| 6 | -# Copyright (C) 2017-2019 Luigi Tibaldo | |
| 6 | +# Copyright (C) 2017-2020 Luigi Tibaldo | |
| 7 | 7 | # |
| 8 | 8 | # This program is free software: you can redistribute it and/or modify |
| 9 | 9 | # it under the terms of the GNU General Public License as published by |
| ... | ... | @@ -398,21 +398,25 @@ class csphagen(ctools.csobservation): |
| 398 | 398 | else: |
| 399 | 399 | |
| 400 | 400 | # Append reflected regions |
| 401 | - alpha = 360.0 / N | |
| 402 | - dphi_max = 360. - alpha * (1 + N_skip) | |
| 403 | - dphi = alpha * (1 + N_skip) | |
| 401 | + alpha = 360.0 / N | |
| 402 | + dphi_max = 360.0 - alpha * (1 + N_skip) | |
| 403 | + dphi = alpha * (1 + N_skip) | |
| 404 | 404 | while dphi <= dphi_max: |
| 405 | 405 | ctr_dir = pnt_dir.clone() |
| 406 | 406 | ctr_dir.rotate_deg(posang + dphi, offset) |
| 407 | 407 | region = gammalib.GSkyRegionCircle(ctr_dir, self._rad) |
| 408 | 408 | if self._has_exclusion: |
| 409 | 409 | if self._excl_reg.overlaps(region): |
| 410 | + | |
| 411 | + # Signal region overlap | |
| 410 | 412 | msg = ' Reflected region overlaps with '\ |
| 411 | 413 | 'exclusion region.' |
| 412 | 414 | self._log_string(gammalib.EXPLICIT, msg) |
| 413 | - # if region overlaps with exclusion region | |
| 415 | + | |
| 416 | + # If region overlaps with exclusion region | |
| 414 | 417 | # try to increment by 10% of angular step |
| 415 | 418 | dphi += 0.1 * alpha |
| 419 | + | |
| 416 | 420 | else: |
| 417 | 421 | regions.append(region) |
| 418 | 422 | dphi += alpha | ... | ... |