Commit ab607e325b23dbcd00b3e0fbd50c5d0507ff9005

Authored by Jürgen Knödlseder
1 parent 718635be

Fix some code quality issues

cscripts/Makefile.am
... ... @@ -205,6 +205,7 @@ testdata = $(top_srcdir)/test/data/crab.xml \
205 205 $(top_srcdir)/test/data/sensitivity_integral.dat \
206 206 $(top_srcdir)/test/data/skymap.fits \
207 207 $(top_srcdir)/test/data/spectrum.fits \
  208 + $(top_srcdir)/test/data/spectrum_castro.fits \
208 209 $(top_srcdir)/test/data/residual.fits \
209 210 $(top_srcdir)/test/data/residual_onoff.fits \
210 211 $(top_srcdir)/test/data/lightcurve.fits \
... ...
cscripts/csscs.py
... ... @@ -70,13 +70,13 @@ class csscs(ctools.csobservation):
70 70 Pickled instance
71 71 """
72 72 # Set pickled dictionary
73   - state = {'base': ctools.csobservation.__getstate__(self),
74   - 'nthreads': self._nthreads,
75   - 'srcnames': self._srcnames,
76   - 'method': self._method,
77   - 'fits': self._fits,
78   - 'excl_reg_map': self._excl_reg_map,
79   - 'excl_reg_name' : self._excl_reg_name}
  73 + state = {'base': ctools.csobservation.__getstate__(self),
  74 + 'nthreads': self._nthreads,
  75 + 'srcnames': self._srcnames,
  76 + 'method': self._method,
  77 + 'fits': self._fits,
  78 + 'excl_reg_map': self._excl_reg_map,
  79 + 'excl_reg_name': self._excl_reg_name}
80 80  
81 81 # Return pickled dictionary
82 82 return state
... ... @@ -107,7 +107,7 @@ class csscs(ctools.csobservation):
107 107 """
108 108 Get On/Off analysis parameters.
109 109  
110   - This is done here rather then in ctools.is_onoff because the exclusion
  110 + This is done here rather than in ctools.is_onoff because the exclusion
111 111 map needs to be handled differently as an automatic parameter but
112 112 queried only if not already set and we need to verify is not empty.
113 113 Also many parameters are already queried for all methods
... ... @@ -470,8 +470,8 @@ class csscs(ctools.csobservation):
470 470 new_obs : `~gammalib.GObservations`
471 471 Observations in circular ROI
472 472 """
473   - # Determine type of masking according
474   - # to observation type and analysis method
  473 + # Determine type of masking according to observation type and analysis
  474 + # method
475 475 if self._method == 'UNBINNED':
476 476 new_obs = self._mask_evlist(self.obs(), ra, dec, rad)
477 477 elif self._method == 'BINNED':
... ... @@ -570,7 +570,7 @@ class csscs(ctools.csobservation):
570 570 # Calculate correction factor
571 571 # Spatial model flux over ROI divided by ROI solid angle
572 572 corr_factor = source.spatial().flux(roi)
573   - corr_factor /= gammalib.twopi * (1 - math.cos(math.radians(self['rad'].real())))
  573 + corr_factor /= gammalib.twopi * (1.0 - math.cos(math.radians(self['rad'].real())))
574 574  
575 575 # Multiply flux by correction factor
576 576 flux *= corr_factor
... ...
test/data/spectrum_castro.fits 0 → 100644
No preview for this file type
test/test_examples.py.in
... ... @@ -418,6 +418,12 @@ class Test(gammalib.GPythonTestSuite):
418 418 # Execute script
419 419 self._execute_python('show_spectrum', args=args)
420 420  
  421 + # Set arguments
  422 + args = '-p example_show_spectrum_castro.eps %s/spectrum_castro.fits' % self._datadir
  423 +
  424 + # Execute script
  425 + self._execute_python('show_spectrum', args=args)
  426 +
421 427 # Return
422 428 return
423 429  
... ...