Commit 7088cdebb94d731966d591601d328bea1a9a6a23

Authored by Jürgen Knödlseder
1 parent 1bfa71e6

Integrate code

Showing 1 changed file with 12 additions and 13 deletions
cscripts/csresmap.py
... ... @@ -248,28 +248,27 @@ class csresmap(ctools.cscript):
248 248  
249 249 # Loop over every bin in the map
250 250 for i in range(self._resmap.npix()):
251   -
252   - # If the model value > 0.0 do the computation as normal
  251 +
  252 + # If the model value > 0.0 do the computation as normal ...
253 253 model_val = modelmap[i]
254 254 if model_val > 0.0:
255   -
256   - # If the data value is also > 0 then proceed as normal
  255 +
  256 + # If the data value is also > 0 then compute the
  257 + # significance^2 and save it to the map ...
257 258 data_val = self._resmap[i]
258 259 if data_val > 0.0:
259   - # Compute the significance^2 and save it to the map
260   - log_val = math.log(data_val/model_val)
  260 + log_val = math.log(data_val/model_val)
261 261 self._resmap[i] = (data_val*log_val) + model_val - data_val
262   -
263   - # If the data value is less than zero, then compute the
264   - # reduced value of the above expression. This is necessary
265   - # to avoid computing log(0).
  262 +
  263 + # ... otherwise compute the reduced value of the above
  264 + # expression. This is necessary to avoid computing log(0).
266 265 else:
267 266 self._resmap[i] = model_val
268   -
269   - # If the model value is zero, hard-code the significance to 0
  267 +
  268 + # ... otherwise hard-code the significance to 0
270 269 else:
271 270 self._resmap[i] = 0.0
272   -
  271 +
273 272 # Compute significance map
274 273 self._resmap *= 2.0
275 274 self._resmap = self._resmap.sqrt()
... ...