Commit d6d31814ef4b23ecdcf67153d0dbbbe1a093fe2f

Authored by Jürgen Knödlseder
1 parent 62bb3946

Integrate code (#2498)

Showing 1 changed file with 14 additions and 10 deletions
cscripts/cssrcdetect.py
... ... @@ -51,7 +51,9 @@ class cssrcdetect(ctools.cscript):
51 51 else:
52 52 self._map = gammalib.GSkyMap()
53 53  
  54 + # Initialise other members
54 55 self._map_dirs = []
  56 +
55 57 # Return
56 58 return
57 59  
... ... @@ -76,14 +78,14 @@ class cssrcdetect(ctools.cscript):
76 78  
77 79 # Query the smoothing parameters
78 80 self['smoothkernel'].string()
79   - if self['smoothkernel'].string().upper() != "NONE":
  81 + if self['smoothkernel'].string().upper() != 'NONE':
80 82 self['smoothparam'].real()
81 83  
82 84 # Query ahead output model filename
83 85 if self._read_ahead():
84 86 self['outmodel'].filename()
85 87 self['outds9file'].filename()
86   - self["momentradius"].real()
  88 + self['momentradius'].real()
87 89  
88 90 # Write input parameters into logger
89 91 self._log_parameters(gammalib.TERSE)
... ... @@ -107,7 +109,7 @@ class cssrcdetect(ctools.cscript):
107 109 self._log_header3(gammalib.NORMAL, 'Iteration '+str(i+1))
108 110  
109 111 # Get map moments
110   - mean, std = self._map_moments(counts, self["momentradius"].real())
  112 + mean, std = self._map_moments(counts, self['momentradius'].real())
111 113  
112 114 # Compute threshold
113 115 sigmap = (counts - mean)/std
... ... @@ -229,8 +231,8 @@ class cssrcdetect(ctools.cscript):
229 231 std *= std
230 232  
231 233 # Convolve by disk to get bin-by-bin mean
232   - mean.smooth("DISK", radius)
233   - std.smooth("DISK", radius)
  234 + mean.smooth('DISK', radius)
  235 + std.smooth('DISK', radius)
234 236  
235 237 # Compute the standard deviation for each pixel
236 238 std = std - (mean*mean)
... ... @@ -348,18 +350,20 @@ class cssrcdetect(ctools.cscript):
348 350 skymap : `~gammalib.GSkyMap()`
349 351 Sky map
350 352 """
351   - self._log_header3(gammalib.NORMAL, "Smoothing Skymap")
  353 + # Log header
  354 + self._log_header3(gammalib.NORMAL, 'Smoothing Skymap')
  355 +
352 356 # Make sure the smoothing kernel is not 'NONE'
353 357 if self['smoothkernel'].string().upper() != 'NONE':
354   - self._log_value(gammalib.NORMAL, "Kernel",
  358 + self._log_value(gammalib.NORMAL, 'Kernel',
355 359 self['smoothkernel'].string())
356   - self._log_value(gammalib.NORMAL, "Parameter",
357   - self["smoothparam"].real())
  360 + self._log_value(gammalib.NORMAL, 'Parameter',
  361 + self['smoothparam'].real())
358 362 skymap.smooth(self['smoothkernel'].string(),
359 363 self['smoothparam'].real())
360 364 else:
361 365 self._log_string(gammalib.NORMAL,
362   - "Smoothing kernel is NONE, smoothing will be ignored.")
  366 + 'Smoothing kernel is NONE, smoothing will be ignored.')
363 367  
364 368 return
365 369  
... ...