diff --git a/scripts/obsutils.py b/scripts/obsutils.py index 79a4b5b..b163ad2 100755 --- a/scripts/obsutils.py +++ b/scripts/obsutils.py @@ -52,24 +52,16 @@ def sim(obs, log=False, debug=False, edisp=False, seed=0, nbins=0, # Optionally switch-on debugging model if debug: sim["debug"].boolean(True) - - # Optionally apply energy dispersion - sim["edisp"].boolean(edisp) # Run ctobssim application. This will loop over all observations in the # container and simulation the events for each observation. Note that # events are not added together, they still apply to each observation # separately. sim.run() - - # Make a deep copy of the observation that will be returned - # (the ctobssim object will go out of scope one the function is - # left) - obssim = sim.obs().copy() - obsbin = None # Binned option? if nbins > 0: + # Determine common energy boundaries for observations emin = None emax = None @@ -84,7 +76,7 @@ def sim(obs, log=False, debug=False, edisp=False, seed=0, nbins=0, emax = run_emax elif run_emax > emax: emax = run_emax - + # Allocate ctbin application and set parameters bin = ctools.ctbin(sim.obs()) bin["ebinalg"].string("LOG") @@ -113,13 +105,13 @@ def sim(obs, log=False, debug=False, edisp=False, seed=0, nbins=0, # Make a deep copy of the observation that will be returned # (the ctbin object will go out of scope one the function is # left) - obsbin = bin.obs().copy() + obs = bin.obs().copy() # Delete the simulation del sim # Return observation container - return obsbin,obssim + return obs # ================ #