Commit 07c6a2257a71039358d7fbe1f16221d11b45e280
1 parent
80f9d225
Add pixel index check to cntmap function (bug #1238)
Showing
1 changed file
with
5 additions
and
1 deletions
scripts/obsutils.py
| ... | ... | @@ -183,6 +183,9 @@ def cntmap(obs, proj="TAN", coord="GAL", xval=0.0, yval=0.0, \ |
| 183 | 183 | """ |
| 184 | 184 | # Allocate counts map |
| 185 | 185 | map = gammalib.GSkymap(proj, coord, xval, yval, -binsz, binsz, nxpix, nypix, 1) |
| 186 | + | |
| 187 | + # Set maximum pixel number | |
| 188 | + maxpixel = nxpix * nypix | |
| 186 | 189 | |
| 187 | 190 | # Fill all observations |
| 188 | 191 | for run in obs: |
| ... | ... | @@ -195,7 +198,8 @@ def cntmap(obs, proj="TAN", coord="GAL", xval=0.0, yval=0.0, \ |
| 195 | 198 | pixel = map.dir2inx(skydir) |
| 196 | 199 | |
| 197 | 200 | # Set pixel |
| 198 | - map[pixel] += 1.0 | |
| 201 | + if pixel < maxpixel: | |
| 202 | + map[pixel] += 1.0 | |
| 199 | 203 | |
| 200 | 204 | # Save sky map. The clobber flag is set to True, so any existing FITS |
| 201 | 205 | # file will be overwritten. | ... | ... |