Commit 6d012d33e4a713aa8b2c865a3fd49b00504f3e7e

Authored by Michael Mayer
1 parent a5be536c

fixed minor error

Showing 1 changed file with 8 additions and 5 deletions
cscripts/cshessobs.py
... ... @@ -290,6 +290,7 @@ class cshessobs(ctools.cscript):
290 290 spec[1].free()
291 291  
292 292 else:
  293 +
293 294 # Use several energy-dependent scaling factors
294 295 fits = gammalib.GFits(aefffile)
295 296 emin = fits["EFFECTIVE AREA"].real("LO_THRES")
... ... @@ -306,14 +307,16 @@ class cshessobs(ctools.cscript):
306 307 energy = bounds.elogmean(i)
307 308 spec.append(energy, plaw.eval(energy, gammalib.GTime()))
308 309 for par in spec:
  310 +
309 311 if "Energy" in par.name():
310 312 par.fix()
311 313 elif "Intensity" in par.name():
312   - par.scale(scale)
313   - par.min(0.01*par.scale())
314   - par.max(100.0*par.scale())
315   -# print prefactor, index
316   -# print spec
  314 + parscale = pow(10,math.floor(math.log10(abs(par.value()))))
  315 + par.scale(parscale)
  316 + par.min(0.01*parscale)
  317 + par.max(100.0*parscale)
  318 +
  319 +
317 320 return spec
318 321  
319 322 def hess_background(self, run, aefffile, trgrate, zenith):
... ...