Commit 8f95f029475ff37abff1589aa91f5be1fbac33fc
1 parent
a7c7b80a
Replace range(len(use_layers))[::n_layers] in csspec as this poses problems on Python 3.0 & 3.1.
Showing
1 changed file
with
13 additions
and
3 deletions
cscripts/csspec.py
| ... | ... | @@ -217,14 +217,24 @@ class csspec(ctools.cscript): |
| 217 | 217 | |
| 218 | 218 | # Create energy boundaries |
| 219 | 219 | self.m_ebounds = gammalib.GEbounds() |
| 220 | - for i in range(len(use_layers))[::n_layers]: | |
| 221 | - i_start = i | |
| 222 | - i_stop = i + n_layers - 1 | |
| 220 | + i_start = 0 | |
| 221 | + i_stop = n_layers - 1 | |
| 222 | + while i_start < len(use_layers): | |
| 223 | 223 | if i_stop >= len(use_layers): |
| 224 | 224 | i_stop = len(use_layers) - 1 |
| 225 | 225 | ebinmin = cube_ebounds.emin(use_layers[i_start]) |
| 226 | 226 | ebinmax = cube_ebounds.emax(use_layers[i_stop]) |
| 227 | 227 | self.m_ebounds.append(ebinmin, ebinmax) |
| 228 | + i_start += n_layers | |
| 229 | + i_stop += n_layers | |
| 230 | + #for i in range(len(use_layers))[::n_layers]: | |
| 231 | + # i_start = i | |
| 232 | + # i_stop = i + n_layers - 1 | |
| 233 | + # if i_stop >= len(use_layers): | |
| 234 | + # i_stop = len(use_layers) - 1 | |
| 235 | + # ebinmin = cube_ebounds.emin(use_layers[i_start]) | |
| 236 | + # ebinmax = cube_ebounds.emax(use_layers[i_stop]) | |
| 237 | + # self.m_ebounds.append(ebinmin, ebinmax) | |
| 228 | 238 | |
| 229 | 239 | # Unbinned mode |
| 230 | 240 | else: | ... | ... |