Commit 2d0a31cadaf0f7d23e352b8d0eabe03ae10ad102

Authored by Jürgen Knödlseder
1 parent 483edf0e

Correctly use number of counts in event bin in the cntmap method and propagate p…

…rojection and coordinate parameters in sim function.
Showing 1 changed file with 4 additions and 4 deletions
scripts/obsutils.py
@@ -26,7 +26,7 @@ import gammalib @@ -26,7 +26,7 @@ import gammalib
26 # Simulate observations # 26 # Simulate observations #
27 # ===================== # 27 # ===================== #
28 def sim(obs, log=False, debug=False, edisp=False, seed=0, nbins=0, 28 def sim(obs, log=False, debug=False, edisp=False, seed=0, nbins=0,
29 - binsz=0.05, npix=200): 29 + binsz=0.05, npix=200, proj="TAN", coord="GAL"):
30 """ 30 """
31 Simulate events for all observations in the container. 31 Simulate events for all observations in the container.
32 32
@@ -90,8 +90,8 @@ def sim(obs, log=False, debug=False, edisp=False, seed=0, nbins=0, @@ -90,8 +90,8 @@ def sim(obs, log=False, debug=False, edisp=False, seed=0, nbins=0,
90 bin["nxpix"].integer(npix) 90 bin["nxpix"].integer(npix)
91 bin["nypix"].integer(npix) 91 bin["nypix"].integer(npix)
92 bin["binsz"].real(binsz) 92 bin["binsz"].real(binsz)
93 - bin["coordsys"].string("GAL")  
94 - bin["proj"].string("TAN") 93 + bin["coordsys"].string(coord)
  94 + bin["proj"].string(proj)
95 95
96 # Optionally open the log file 96 # Optionally open the log file
97 if log: 97 if log:
@@ -199,7 +199,7 @@ def cntmap(obs, proj="TAN", coord="GAL", xval=0.0, yval=0.0, \ @@ -199,7 +199,7 @@ def cntmap(obs, proj="TAN", coord="GAL", xval=0.0, yval=0.0, \
199 199
200 # Set pixel 200 # Set pixel
201 if pixel < maxpixel: 201 if pixel < maxpixel:
202 - map[pixel] += 1.0 202 + map[pixel] += event.counts()
203 203
204 # Save sky map. The clobber flag is set to True, so any existing FITS 204 # Save sky map. The clobber flag is set to True, so any existing FITS
205 # file will be overwritten. 205 # file will be overwritten.