Commit 25f4cad1fe7cfac9127a921775ed67f0984508e2

Authored by Jürgen Knödlseder
1 parent af729264

Switch back to old code (before issue_1251 integration)

Showing 1 changed file with 4 additions and 12 deletions
scripts/obsutils.py
... ... @@ -52,24 +52,16 @@ def sim(obs, log=False, debug=False, edisp=False, seed=0, nbins=0,
52 52 # Optionally switch-on debugging model
53 53 if debug:
54 54 sim["debug"].boolean(True)
55   -
56   - # Optionally apply energy dispersion
57   - sim["edisp"].boolean(edisp)
58 55  
59 56 # Run ctobssim application. This will loop over all observations in the
60 57 # container and simulation the events for each observation. Note that
61 58 # events are not added together, they still apply to each observation
62 59 # separately.
63 60 sim.run()
64   -
65   - # Make a deep copy of the observation that will be returned
66   - # (the ctobssim object will go out of scope one the function is
67   - # left)
68   - obssim = sim.obs().copy()
69   - obsbin = None
70 61  
71 62 # Binned option?
72 63 if nbins > 0:
  64 +
73 65 # Determine common energy boundaries for observations
74 66 emin = None
75 67 emax = None
... ... @@ -84,7 +76,7 @@ def sim(obs, log=False, debug=False, edisp=False, seed=0, nbins=0,
84 76 emax = run_emax
85 77 elif run_emax > emax:
86 78 emax = run_emax
87   -
  79 +
88 80 # Allocate ctbin application and set parameters
89 81 bin = ctools.ctbin(sim.obs())
90 82 bin["ebinalg"].string("LOG")
... ... @@ -113,13 +105,13 @@ def sim(obs, log=False, debug=False, edisp=False, seed=0, nbins=0,
113 105 # Make a deep copy of the observation that will be returned
114 106 # (the ctbin object will go out of scope one the function is
115 107 # left)
116   - obsbin = bin.obs().copy()
  108 + obs = bin.obs().copy()
117 109  
118 110 # Delete the simulation
119 111 del sim
120 112  
121 113 # Return observation container
122   - return obsbin,obssim
  114 + return obs
123 115  
124 116  
125 117 # ================ #
... ...