Commit c093864a46a8fd3c7edd38aa0964312c8fd9bf62

Authored by Jürgen Knödlseder
1 parent 854ebb52

Merge in code

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