Commit 949c4e71d41f4483cc4e665dc5de6a05cd797fc6

Authored by Jürgen Knödlseder
1 parent dcf1d563

Adapt to new GSkyRegionRectangle interface (#3248)

Showing 1 changed file with 11 additions and 10 deletions
cscripts/csphagen.py
@@ -227,17 +227,18 @@ class csphagen(ctools.csobservation): @@ -227,17 +227,18 @@ class csphagen(ctools.csobservation):
227 self._rad = self['rad'].real() 227 self._rad = self['rad'].real()
228 self._src_reg.append(gammalib.GSkyRegionCircle(self._src_dir, self._rad)) 228 self._src_reg.append(gammalib.GSkyRegionCircle(self._src_dir, self._rad))
229 229
230 - # ... otherwise if source shape is a rectangle then append GSkyRegionRect 230 + # ... otherwise if source shape is a rectangle then append
  231 + # GSkyRegionRectangle
231 elif self._srcshape == 'RECT': 232 elif self._srcshape == 'RECT':
232 233
233 # Set rectangular source region 234 # Set rectangular source region
234 self._reg_width = self['width'].real() 235 self._reg_width = self['width'].real()
235 self._reg_height = self['height'].real() 236 self._reg_height = self['height'].real()
236 self._reg_posang = self['posang'].real() 237 self._reg_posang = self['posang'].real()
237 - self._src_reg.append(gammalib.GSkyRegionRect(self._src_dir,  
238 - self._reg_width,  
239 - self._reg_height,  
240 - self._reg_posang)) 238 + self._src_reg.append(gammalib.GSkyRegionRectangle(self._src_dir,
  239 + self._reg_width,
  240 + self._reg_height,
  241 + self._reg_posang))
241 242
242 # Query usage of background model 243 # Query usage of background model
243 self['use_model_bkg'].boolean() 244 self['use_model_bkg'].boolean()
@@ -417,7 +418,7 @@ class csphagen(ctools.csobservation): @@ -417,7 +418,7 @@ class csphagen(ctools.csobservation):
417 elif self._srcshape == 'RECT': 418 elif self._srcshape == 'RECT':
418 419
419 # Get the sky directions of the corners of the rectangle 420 # Get the sky directions of the corners of the rectangle
420 - cs = [self._src_reg[0].get_corner(icorner) for icorner in range(4)] 421 + cs = [self._src_reg[0].corner(icorner) for icorner in range(4)]
421 422
422 # Compute the 6 opening angles 423 # Compute the 6 opening angles
423 combinations = [[0,1], [0,2], [0,3], [1,2], [1,3], [2,3]] 424 combinations = [[0,1], [0,2], [0,3], [1,2], [1,3], [2,3]]
@@ -508,10 +509,10 @@ class csphagen(ctools.csobservation): @@ -508,10 +509,10 @@ class csphagen(ctools.csobservation):
508 region = gammalib.GSkyRegionCircle(ctr_dir, self._rad) 509 region = gammalib.GSkyRegionCircle(ctr_dir, self._rad)
509 elif self._srcshape == 'RECT': 510 elif self._srcshape == 'RECT':
510 # Adjust the posang of the rectangle correspondingly 511 # Adjust the posang of the rectangle correspondingly
511 - region = gammalib.GSkyRegionRect(ctr_dir,  
512 - self._reg_width,  
513 - self._reg_height,  
514 - self._reg_posang + dphi) 512 + region = gammalib.GSkyRegionRectangle(ctr_dir,
  513 + self._reg_width,
  514 + self._reg_height,
  515 + self._reg_posang + dphi)
515 if self._has_exclusion: 516 if self._has_exclusion:
516 if self._excl_reg.overlaps(region): 517 if self._excl_reg.overlaps(region):
517 518