Commit f2a352d5b71ba9ad985a68b1bba7a04671b635db

Authored by Christoph Deil
1 parent 1f64ddfa

Simplify GApplication parameter setting from Python

examples/benchmark_cta_analysis.py
@@ -55,27 +55,27 @@ def unbinned_pipeline(duration): @@ -55,27 +55,27 @@ def unbinned_pipeline(duration):
55 55
56 # Simulate events 56 # Simulate events
57 sim = ctools.ctobssim() 57 sim = ctools.ctobssim()
58 - sim["inmodel"].filename(model_name)  
59 - sim["caldb"].string(caldb)  
60 - sim["irf"].string(irf)  
61 - sim["ra"].real(ra)  
62 - sim["dec"].real(dec)  
63 - sim["rad"].real(rad_sim)  
64 - sim["tmin"].real(tstart)  
65 - sim["tmax"].real(tstop)  
66 - sim["emin"].real(emin)  
67 - sim["emax"].real(emax) 58 + sim["inmodel"] = model_name
  59 + sim["caldb"] = caldb
  60 + sim["irf"] = irf
  61 + sim["ra"] = ra
  62 + sim["dec"] = dec
  63 + sim["rad"] = rad_sim
  64 + sim["tmin"] = tstart
  65 + sim["tmax"] = tstop
  66 + sim["emin"] = emin
  67 + sim["emax"] = emax
68 sim.run() 68 sim.run()
69 69
70 # Select events 70 # Select events
71 select = ctools.ctselect(sim.obs()) 71 select = ctools.ctselect(sim.obs())
72 - select["ra"].real(ra)  
73 - select["dec"].real(dec)  
74 - select["rad"].real(rad_select)  
75 - select["tmin"].real(tstart)  
76 - select["tmax"].real(tstop)  
77 - select["emin"].real(emin)  
78 - select["emax"].real(emax) 72 + select["ra"] = ra
  73 + select["dec"] = dec
  74 + select["rad"] = rad_select
  75 + select["tmin"] = tstart
  76 + select["tmax"] = tstop
  77 + select["emin"] = emin
  78 + select["emax"] = emax
79 select.run() 79 select.run()
80 80
81 # Get ctlike start CPU time 81 # Get ctlike start CPU time
@@ -124,31 +124,31 @@ def binned_pipeline(duration): @@ -124,31 +124,31 @@ def binned_pipeline(duration):
124 124
125 # Simulate events 125 # Simulate events
126 sim = ctools.ctobssim() 126 sim = ctools.ctobssim()
127 - sim["inmodel"].filename(model_name)  
128 - sim["caldb"].string(caldb)  
129 - sim["irf"].string(irf)  
130 - sim["ra"].real(ra)  
131 - sim["dec"].real(dec)  
132 - sim["rad"].real(rad_sim)  
133 - sim["tmin"].real(tstart)  
134 - sim["tmax"].real(tstop)  
135 - sim["emin"].real(emin)  
136 - sim["emax"].real(emax) 127 + sim["inmodel"] = model_name
  128 + sim["caldb"] = caldb
  129 + sim["irf"] = irf
  130 + sim["ra"] = ra
  131 + sim["dec"] = dec
  132 + sim["rad"] = rad_sim
  133 + sim["tmin"] = tstart
  134 + sim["tmax"] = tstop
  135 + sim["emin"] = emin
  136 + sim["emax"] = emax
137 sim.run() 137 sim.run()
138 138
139 # Bin events into counts map 139 # Bin events into counts map
140 bin = ctools.ctbin(sim.obs()) 140 bin = ctools.ctbin(sim.obs())
141 - bin["ebinalg"].string("LOG")  
142 - bin["emin"].real(emin)  
143 - bin["emax"].real(emax)  
144 - bin["enumbins"].integer(enumbins)  
145 - bin["nxpix"].integer(nxpix)  
146 - bin["nypix"].integer(nypix)  
147 - bin["binsz"].real(binsz)  
148 - bin["coordsys"].string(coordsys)  
149 - bin["xref"].real(ra)  
150 - bin["yref"].real(dec)  
151 - bin["proj"].string(proj) 141 + bin["ebinalg"] = "LOG"
  142 + bin["emin"] = emin
  143 + bin["emax"] = emax
  144 + bin["enumbins"] = enumbins
  145 + bin["nxpix"] = nxpix
  146 + bin["nypix"] = nypix
  147 + bin["binsz"] = binsz
  148 + bin["coordsys"] = coordsys
  149 + bin["xref"] = ra
  150 + bin["yref"] = dec
  151 + bin["proj"] = proj
152 bin.run() 152 bin.run()
153 153
154 # Get ctlike start CPU time 154 # Get ctlike start CPU time
@@ -197,83 +197,83 @@ def stacked_pipeline(duration): @@ -197,83 +197,83 @@ def stacked_pipeline(duration):
197 197
198 # Simulate events 198 # Simulate events
199 sim = ctools.ctobssim() 199 sim = ctools.ctobssim()
200 - sim["inmodel"].filename(model_name)  
201 - sim["caldb"].string(caldb)  
202 - sim["irf"].string(irf)  
203 - sim["ra"].real(ra)  
204 - sim["dec"].real(dec)  
205 - sim["rad"].real(rad_sim)  
206 - sim["tmin"].real(tstart)  
207 - sim["tmax"].real(tstop)  
208 - sim["emin"].real(emin)  
209 - sim["emax"].real(emax) 200 + sim["inmodel"] = model_name
  201 + sim["caldb"] = caldb
  202 + sim["irf"] = irf
  203 + sim["ra"] = ra
  204 + sim["dec"] = dec
  205 + sim["rad"] = rad_sim
  206 + sim["tmin"] = tstart
  207 + sim["tmax"] = tstop
  208 + sim["emin"] = emin
  209 + sim["emax"] = emax
210 sim.run() 210 sim.run()
211 211
212 # Bin events into counts map 212 # Bin events into counts map
213 bin = ctools.ctbin(sim.obs()) 213 bin = ctools.ctbin(sim.obs())
214 - bin["ebinalg"].string("LOG")  
215 - bin["emin"].real(emin)  
216 - bin["emax"].real(emax)  
217 - bin["enumbins"].integer(enumbins)  
218 - bin["nxpix"].integer(nxpix)  
219 - bin["nypix"].integer(nypix)  
220 - bin["binsz"].real(binsz)  
221 - bin["coordsys"].string(coordsys)  
222 - bin["proj"].string(proj)  
223 - bin["xref"].real(ra)  
224 - bin["yref"].real(dec) 214 + bin["ebinalg"] = "LOG"
  215 + bin["emin"] = emin
  216 + bin["emax"] = emax
  217 + bin["enumbins"] = enumbins
  218 + bin["nxpix"] = nxpix
  219 + bin["nypix"] = nypix
  220 + bin["binsz"] = binsz
  221 + bin["coordsys"] = coordsys
  222 + bin["proj"] = proj
  223 + bin["xref"] = ra
  224 + bin["yref"] = dec
225 bin.run() 225 bin.run()
226 226
227 # Create exposure cube 227 # Create exposure cube
228 expcube = ctools.ctexpcube(sim.obs()) 228 expcube = ctools.ctexpcube(sim.obs())
229 - expcube["incube"].filename("NONE")  
230 - expcube["caldb"].string(caldb)  
231 - expcube["irf"].string(irf)  
232 - expcube["ebinalg"].string("LOG")  
233 - expcube["emin"].real(emin)  
234 - expcube["emax"].real(emax)  
235 - expcube["enumbins"].integer(enumbins)  
236 - expcube["nxpix"].integer(nxpix)  
237 - expcube["nypix"].integer(nypix)  
238 - expcube["binsz"].real(binsz)  
239 - expcube["coordsys"].string(coordsys)  
240 - expcube["proj"].string(proj)  
241 - expcube["xref"].real(ra)  
242 - expcube["yref"].real(dec) 229 + expcube["incube"] = "NONE"
  230 + expcube["caldb"] = caldb
  231 + expcube["irf"] = irf
  232 + expcube["ebinalg"] = "LOG"
  233 + expcube["emin"] = emin
  234 + expcube["emax"] = emax
  235 + expcube["enumbins"] = enumbins
  236 + expcube["nxpix"] = nxpix
  237 + expcube["nypix"] = nypix
  238 + expcube["binsz"] = binsz
  239 + expcube["coordsys"] = coordsys
  240 + expcube["proj"] = proj
  241 + expcube["xref"] = ra
  242 + expcube["yref"] = dec
243 expcube.run() 243 expcube.run()
244 244
245 # Create PSF cube 245 # Create PSF cube
246 psfcube = ctools.ctpsfcube(sim.obs()) 246 psfcube = ctools.ctpsfcube(sim.obs())
247 - psfcube["incube"].filename("NONE")  
248 - psfcube["caldb"].string(caldb)  
249 - psfcube["irf"].string(irf)  
250 - psfcube["ebinalg"].string("LOG")  
251 - psfcube["emin"].real(emin)  
252 - psfcube["emax"].real(emax)  
253 - psfcube["enumbins"].integer(enumbins)  
254 - psfcube["nxpix"].integer(10)  
255 - psfcube["nypix"].integer(10)  
256 - psfcube["binsz"].real(1.0)  
257 - psfcube["coordsys"].string(coordsys)  
258 - psfcube["proj"].string(proj)  
259 - psfcube["xref"].real(ra)  
260 - psfcube["yref"].real(dec) 247 + psfcube["incube"] = "NONE"
  248 + psfcube["caldb"] = caldb
  249 + psfcube["irf"] = irf
  250 + psfcube["ebinalg"] = "LOG"
  251 + psfcube["emin"] = emin
  252 + psfcube["emax"] = emax
  253 + psfcube["enumbins"] = enumbins
  254 + psfcube["nxpix"] = 10
  255 + psfcube["nypix"] = 10
  256 + psfcube["binsz"] = 1.0
  257 + psfcube["coordsys"] = coordsys
  258 + psfcube["proj"] = proj
  259 + psfcube["xref"] = ra
  260 + psfcube["yref"] = dec
261 psfcube.run() 261 psfcube.run()
262 262
263 # Create background cube 263 # Create background cube
264 bkgcube = ctools.ctbkgcube(sim.obs()) 264 bkgcube = ctools.ctbkgcube(sim.obs())
265 - bkgcube["incube"].filename("NONE")  
266 - bkgcube["ebinalg"].string("LOG")  
267 - bkgcube["emin"].real(emin)  
268 - bkgcube["emax"].real(emax)  
269 - bkgcube["enumbins"].integer(enumbins)  
270 - bkgcube["nxpix"].integer(10)  
271 - bkgcube["nypix"].integer(10)  
272 - bkgcube["binsz"].real(1.0)  
273 - bkgcube["coordsys"].string(coordsys)  
274 - bkgcube["proj"].string(proj)  
275 - bkgcube["xref"].real(ra)  
276 - bkgcube["yref"].real(dec) 265 + bkgcube["incube"] = "NONE"
  266 + bkgcube["ebinalg"] = "LOG"
  267 + bkgcube["emin"] = emin
  268 + bkgcube["emax"] = emax
  269 + bkgcube["enumbins"] = enumbins
  270 + bkgcube["nxpix"] = 10
  271 + bkgcube["nypix"] = 10
  272 + bkgcube["binsz"] = 1.0
  273 + bkgcube["coordsys"] = coordsys
  274 + bkgcube["proj"] = proj
  275 + bkgcube["xref"] = ra
  276 + bkgcube["yref"] = dec
277 bkgcube.run() 277 bkgcube.run()
278 278
279 # Attach background model to observation container 279 # Attach background model to observation container
examples/check_models.py
@@ -61,27 +61,27 @@ def pipeline(model_name): @@ -61,27 +61,27 @@ def pipeline(model_name):
61 61
62 # Simulate events 62 # Simulate events
63 sim = ctools.ctobssim() 63 sim = ctools.ctobssim()
64 - sim["inmodel"].filename(model_name)  
65 - sim["caldb"].string(caldb)  
66 - sim["irf"].string(irf)  
67 - sim["ra"].real(ra)  
68 - sim["dec"].real(dec)  
69 - sim["rad"].real(rad_sim)  
70 - sim["tmin"].real(tstart)  
71 - sim["tmax"].real(tstop)  
72 - sim["emin"].real(emin)  
73 - sim["emax"].real(emax) 64 + sim["inmodel"] = model_name
  65 + sim["caldb"] = caldb
  66 + sim["irf"] = irf
  67 + sim["ra"] = ra
  68 + sim["dec"] = dec
  69 + sim["rad"] = rad_sim
  70 + sim["tmin"] = tstart
  71 + sim["tmax"] = tstop
  72 + sim["emin"] = emin
  73 + sim["emax"] = emax
74 sim.run() 74 sim.run()
75 75
76 # Select events 76 # Select events
77 select = ctools.ctselect(sim.obs()) 77 select = ctools.ctselect(sim.obs())
78 - select["ra"].real(ra)  
79 - select["dec"].real(dec)  
80 - select["rad"].real(rad_select)  
81 - select["tmin"].real(tstart)  
82 - select["tmax"].real(tstop)  
83 - select["emin"].real(emin)  
84 - select["emax"].real(emax) 78 + select["ra"] = ra
  79 + select["dec"] = dec
  80 + select["rad"] = rad_select
  81 + select["tmin"] = tstart
  82 + select["tmax"] = tstop
  83 + select["emin"] = emin
  84 + select["emax"] = emax
85 select.run() 85 select.run()
86 86
87 # Perform maximum likelihood fitting 87 # Perform maximum likelihood fitting
examples/make_spectrum.py
@@ -48,16 +48,16 @@ def make_spectrum(): @@ -48,16 +48,16 @@ def make_spectrum():
48 48
49 # Simulate events 49 # Simulate events
50 sim = ctools.ctobssim() 50 sim = ctools.ctobssim()
51 - sim["inmodel"].filename(model_name)  
52 - sim["caldb"].string(caldb)  
53 - sim["irf"].string(irf)  
54 - sim["ra"].real(ra)  
55 - sim["dec"].real(dec)  
56 - sim["rad"].real(rad_sim)  
57 - sim["tmin"].real(tstart)  
58 - sim["tmax"].real(tstop)  
59 - sim["emin"].real(emin)  
60 - sim["emax"].real(emax) 51 + sim["inmodel"] = model_name
  52 + sim["caldb"] = caldb
  53 + sim["irf"] = irf
  54 + sim["ra"] = ra
  55 + sim["dec"] = dec
  56 + sim["rad"] = rad_sim
  57 + sim["tmin"] = tstart
  58 + sim["tmax"] = tstop
  59 + sim["emin"] = emin
  60 + sim["emax"] = emax
61 sim.run() 61 sim.run()
62 62
63 # Generate an energy binning 63 # Generate an energy binning
examples/make_ts_distributions.py
@@ -61,22 +61,22 @@ def create_ts(loge, emin, emax, ntrials=100, duration=180000.0, \ @@ -61,22 +61,22 @@ def create_ts(loge, emin, emax, ntrials=100, duration=180000.0, \
61 61
62 # Setup cstsdist tool 62 # Setup cstsdist tool
63 tsdist = cstsdist() 63 tsdist = cstsdist()
64 - tsdist["inmodel"].filename("$CTOOLS/share/models/crab.xml")  
65 - tsdist["srcname"].string("Crab")  
66 - tsdist["outfile"].filename(outfile)  
67 - tsdist["ntrials"].integer(ntrials)  
68 - tsdist["caldb"].string("prod2")  
69 - tsdist["irf"].string("South_50h")  
70 - tsdist["ra"].real(83.63)  
71 - tsdist["dec"].real(22.01)  
72 - tsdist["emin"].real(float(emin))  
73 - tsdist["emax"].real(float(emax))  
74 - tsdist["enumbins"].integer(int(enumbins))  
75 - tsdist["tmin"].real(0.0)  
76 - tsdist["tmax"].real(float(duration))  
77 - tsdist["rad"].real(5.0)  
78 - tsdist["npix"].integer(200)  
79 - tsdist["binsz"].real(0.05) 64 + tsdist["inmodel"] = "$CTOOLS/share/models/crab.xml"
  65 + tsdist["srcname"] = "Crab"
  66 + tsdist["outfile"] = outfile
  67 + tsdist["ntrials"] = ntrials
  68 + tsdist["caldb"] = "prod2"
  69 + tsdist["irf"] = "South_50h"
  70 + tsdist["ra"] = 83.63
  71 + tsdist["dec"] = 22.01
  72 + tsdist["emin"] = emin
  73 + tsdist["emax"] = emax
  74 + tsdist["enumbins"] = enumbins
  75 + tsdist["tmin"] = 0
  76 + tsdist["tmax"] = duration
  77 + tsdist["rad"] = 5.0
  78 + tsdist["npix"] = 200
  79 + tsdist["binsz"] = 0.05
80 #tsdist["debug"].boolean(True) 80 #tsdist["debug"].boolean(True)
81 81
82 # Optionally open the log file 82 # Optionally open the log file
examples/pipeline_binned_disk.py
@@ -117,8 +117,8 @@ def run_pipeline(obs, emin=0.1, emax=100.0, \ @@ -117,8 +117,8 @@ def run_pipeline(obs, emin=0.1, emax=100.0, \
117 """ 117 """
118 # Simulate events 118 # Simulate events
119 sim = ctools.ctobssim(obs) 119 sim = ctools.ctobssim(obs)
120 - sim["debug"].boolean(debug)  
121 - sim["outevents"].filename("obs.xml") 120 + sim["debug"] = debug
  121 + sim["outevents"] = "obs.xml"
122 sim.execute() 122 sim.execute()
123 123
124 # Bin events by looping over all observations in the container 124 # Bin events by looping over all observations in the container
@@ -132,18 +132,18 @@ def run_pipeline(obs, emin=0.1, emax=100.0, \ @@ -132,18 +132,18 @@ def run_pipeline(obs, emin=0.1, emax=100.0, \
132 132
133 # Bin events for that observation 133 # Bin events for that observation
134 bin = ctools.ctbin() 134 bin = ctools.ctbin()
135 - bin["inobs"].filename(eventfile)  
136 - bin["outcube"].filename(cubefile)  
137 - bin["ebinalg"].string("LOG")  
138 - bin["emin"].real(emin)  
139 - bin["emax"].real(emax)  
140 - bin["enumbins"].integer(enumbins)  
141 - bin["nxpix"].integer(nxpix)  
142 - bin["nypix"].integer(nypix)  
143 - bin["binsz"].real(binsz)  
144 - bin["coordsys"].string(coordsys)  
145 - bin["usepnt"].boolean(True)  
146 - bin["proj"].string(proj) 135 + bin["inobs"] = eventfile
  136 + bin["outcube"] = cubefile
  137 + bin["ebinalg"] = "LOG"
  138 + bin["emin"] = emin
  139 + bin["emax"] = emax
  140 + bin["enumbins"] = enumbins
  141 + bin["nxpix"] = nxpix
  142 + bin["nypix"] = nypix
  143 + bin["binsz"] = binsz
  144 + bin["coordsys"] = coordsys
  145 + bin["usepnt"] = True
  146 + bin["proj"] = proj
147 bin.execute() 147 bin.execute()
148 148
149 # Set observation ID 149 # Set observation ID
@@ -160,15 +160,15 @@ def run_pipeline(obs, emin=0.1, emax=100.0, \ @@ -160,15 +160,15 @@ def run_pipeline(obs, emin=0.1, emax=100.0, \
160 160
161 # Perform maximum likelihood fitting 161 # Perform maximum likelihood fitting
162 like = ctools.ctlike() 162 like = ctools.ctlike()
163 - like["inobs"].filename("obs_cube.xml")  
164 - like["inmodel"].filename(model)  
165 - like["outmodel"].filename("fit_results.xml")  
166 - like["expcube"].filename("NONE")  
167 - like["psfcube"].filename("NONE")  
168 - like["bkgcube"].filename("NONE")  
169 - like["caldb"].string(caldb)  
170 - like["irf"].string(irf)  
171 - like["debug"].boolean(True) # Switch this always on for results in console 163 + like["inobs"] = "obs_cube.xml"
  164 + like["inmodel"] = model
  165 + like["outmodel"] = "fit_results.xml"
  166 + like["expcube"] = "NONE"
  167 + like["psfcube"] = "NONE"
  168 + like["bkgcube"] = "NONE"
  169 + like["caldb"] = caldb
  170 + like["irf"] = irf
  171 + like["debug"] = True # Switch this always on for results in console
172 like.execute() 172 like.execute()
173 173
174 # Return 174 # Return
examples/pipeline_binned_mem.py
@@ -111,7 +111,7 @@ def run_pipeline(obs, emin=0.1, emax=100.0, \ @@ -111,7 +111,7 @@ def run_pipeline(obs, emin=0.1, emax=100.0, \
111 """ 111 """
112 # Simulate events 112 # Simulate events
113 sim = ctools.ctobssim(obs) 113 sim = ctools.ctobssim(obs)
114 - sim["debug"].boolean(debug) 114 + sim["debug"] = debug
115 sim.run() 115 sim.run()
116 116
117 # Bin events by looping over all observations in the container 117 # Bin events by looping over all observations in the container
@@ -125,16 +125,16 @@ def run_pipeline(obs, emin=0.1, emax=100.0, \ @@ -125,16 +125,16 @@ def run_pipeline(obs, emin=0.1, emax=100.0, \
125 125
126 # Bin events for that observation 126 # Bin events for that observation
127 bin = ctools.ctbin(container) 127 bin = ctools.ctbin(container)
128 - bin["ebinalg"].string("LOG")  
129 - bin["emin"].real(emin)  
130 - bin["emax"].real(emax)  
131 - bin["enumbins"].integer(enumbins)  
132 - bin["nxpix"].integer(nxpix)  
133 - bin["nypix"].integer(nypix)  
134 - bin["binsz"].real(binsz)  
135 - bin["coordsys"].string(coordsys)  
136 - bin["usepnt"].boolean(True)  
137 - bin["proj"].string(proj) 128 + bin["ebinalg"] = "LOG"
  129 + bin["emin"] = emin
  130 + bin["emax"] = emax
  131 + bin["enumbins"] = enumbins
  132 + bin["nxpix"] = nxpix
  133 + bin["nypix"] = nypix
  134 + bin["binsz"] = binsz
  135 + bin["coordsys"] = coordsys
  136 + bin["usepnt"] = True
  137 + bin["proj"] = proj
138 bin.run() 138 bin.run()
139 139
140 # Append result to observations 140 # Append result to observations
@@ -142,7 +142,7 @@ def run_pipeline(obs, emin=0.1, emax=100.0, \ @@ -142,7 +142,7 @@ def run_pipeline(obs, emin=0.1, emax=100.0, \
142 142
143 # Perform maximum likelihood fitting 143 # Perform maximum likelihood fitting
144 like = ctools.ctlike(obs) 144 like = ctools.ctlike(obs)
145 - like["debug"].boolean(True) # Switch this always on for results in console 145 + like["debug"] = True # Switch this always on for results in console
146 like.run() 146 like.run()
147 147
148 # Return 148 # Return
examples/pipeline_stacked_disk.py
@@ -116,104 +116,104 @@ def run_pipeline(obs, ra=83.63, dec=22.01, emin=0.1, emax=100.0, \ @@ -116,104 +116,104 @@ def run_pipeline(obs, ra=83.63, dec=22.01, emin=0.1, emax=100.0, \
116 """ 116 """
117 # Simulate events 117 # Simulate events
118 sim = ctools.ctobssim(obs) 118 sim = ctools.ctobssim(obs)
119 - sim["debug"].boolean(debug)  
120 - sim["outevents"].filename("obs.xml") 119 + sim["debug"] = debug
  120 + sim["outevents"] = "obs.xml"
121 sim.execute() 121 sim.execute()
122 122
123 # Bin events into counts map 123 # Bin events into counts map
124 bin = ctools.ctbin() 124 bin = ctools.ctbin()
125 - bin["inobs"].filename("obs.xml")  
126 - bin["outcube"].filename("cntcube.fits")  
127 - bin["ebinalg"].string("LOG")  
128 - bin["emin"].real(emin)  
129 - bin["emax"].real(emax)  
130 - bin["enumbins"].integer(enumbins)  
131 - bin["nxpix"].integer(nxpix)  
132 - bin["nypix"].integer(nypix)  
133 - bin["binsz"].real(binsz)  
134 - bin["coordsys"].string(coordsys)  
135 - bin["proj"].string(proj)  
136 - bin["xref"].real(ra)  
137 - bin["yref"].real(dec)  
138 - bin["debug"].boolean(debug) 125 + bin["inobs"] = "obs.xml"
  126 + bin["outcube"] = "cntcube.fits"
  127 + bin["ebinalg"] = "LOG"
  128 + bin["emin"] = emin
  129 + bin["emax"] = emax
  130 + bin["enumbins"] = enumbins
  131 + bin["nxpix"] = nxpix
  132 + bin["nypix"] = nypix
  133 + bin["binsz"] = binsz
  134 + bin["coordsys"] = coordsys
  135 + bin["proj"] = proj
  136 + bin["xref"] = ra
  137 + bin["yref"] = dec
  138 + bin["debug"] = debug
139 bin.execute() 139 bin.execute()
140 140
141 # Create exposure cube 141 # Create exposure cube
142 expcube = ctools.ctexpcube() 142 expcube = ctools.ctexpcube()
143 - expcube["inobs"].filename("obs.xml")  
144 - expcube["incube"].filename("cntcube.fits")  
145 - expcube["outcube"].filename("expcube.fits")  
146 - expcube["caldb"].string(caldb)  
147 - expcube["irf"].string(irf)  
148 - expcube["ebinalg"].string("LOG")  
149 - expcube["emin"].real(emin)  
150 - expcube["emax"].real(emax)  
151 - expcube["enumbins"].integer(enumbins)  
152 - expcube["nxpix"].integer(nxpix)  
153 - expcube["nypix"].integer(nypix)  
154 - expcube["binsz"].real(binsz)  
155 - expcube["coordsys"].string(coordsys)  
156 - expcube["proj"].string(proj)  
157 - expcube["xref"].real(ra)  
158 - expcube["yref"].real(dec)  
159 - expcube["debug"].boolean(debug) 143 + expcube["inobs"] = "obs.xml"
  144 + expcube["incube"] = "cntcube.fits"
  145 + expcube["outcube"] = "expcube.fits"
  146 + expcube["caldb"] = caldb
  147 + expcube["irf"] = irf
  148 + expcube["ebinalg"] = "LOG"
  149 + expcube["emin"] = emin
  150 + expcube["emax"] = emax
  151 + expcube["enumbins"] = enumbins
  152 + expcube["nxpix"] = nxpix
  153 + expcube["nypix"] = nypix
  154 + expcube["binsz"] = binsz
  155 + expcube["coordsys"] = coordsys
  156 + expcube["proj"] = proj
  157 + expcube["xref"] = ra
  158 + expcube["yref"] = dec
  159 + expcube["debug"] = debug
160 expcube.execute() 160 expcube.execute()
161 161
162 # Create PSF cube 162 # Create PSF cube
163 psfcube = ctools.ctpsfcube() 163 psfcube = ctools.ctpsfcube()
164 - psfcube["inobs"].filename("obs.xml")  
165 - psfcube["incube"].filename("NONE")  
166 - psfcube["outcube"].filename("psfcube.fits")  
167 - psfcube["caldb"].string(caldb)  
168 - psfcube["irf"].string(irf)  
169 - psfcube["ebinalg"].string("LOG")  
170 - psfcube["emin"].real(emin)  
171 - psfcube["emax"].real(emax)  
172 - psfcube["enumbins"].integer(enumbins)  
173 - psfcube["nxpix"].integer(10)  
174 - psfcube["nypix"].integer(10)  
175 - psfcube["binsz"].real(1.0)  
176 - psfcube["coordsys"].string(coordsys)  
177 - psfcube["proj"].string(proj)  
178 - psfcube["xref"].real(ra)  
179 - psfcube["yref"].real(dec)  
180 - psfcube["debug"].boolean(debug) 164 + psfcube["inobs"] = "obs.xml"
  165 + psfcube["incube"] = "NONE"
  166 + psfcube["outcube"] = "psfcube.fits"
  167 + psfcube["caldb"] = caldb
  168 + psfcube["irf"] = irf
  169 + psfcube["ebinalg"] = "LOG"
  170 + psfcube["emin"] = emin
  171 + psfcube["emax"] = emax
  172 + psfcube["enumbins"] = enumbins
  173 + psfcube["nxpix"] = 10
  174 + psfcube["nypix"] = 10
  175 + psfcube["binsz"] = 1.0
  176 + psfcube["coordsys"] = coordsys
  177 + psfcube["proj"] = proj
  178 + psfcube["xref"] = ra
  179 + psfcube["yref"] = dec
  180 + psfcube["debug"] = debug
181 psfcube.execute() 181 psfcube.execute()
182 182
183 # Create background cube 183 # Create background cube
184 bkgcube = ctools.ctbkgcube() 184 bkgcube = ctools.ctbkgcube()
185 - bkgcube["inobs"].filename("obs.xml")  
186 - bkgcube["inmodel"].filename(model)  
187 - bkgcube["incube"].filename("cntcube.fits")  
188 - bkgcube["outcube"].filename("bkgcube.fits")  
189 - bkgcube["outmodel"].filename("model_bkg.xml")  
190 - bkgcube["caldb"].string(caldb)  
191 - bkgcube["irf"].string(irf)  
192 - bkgcube["ebinalg"].string("LOG")  
193 - bkgcube["emin"].real(emin)  
194 - bkgcube["emax"].real(emax)  
195 - bkgcube["enumbins"].integer(enumbins)  
196 - bkgcube["nxpix"].integer(10)  
197 - bkgcube["nypix"].integer(10)  
198 - bkgcube["binsz"].real(1.0)  
199 - bkgcube["coordsys"].string(coordsys)  
200 - bkgcube["proj"].string(proj)  
201 - bkgcube["xref"].real(ra)  
202 - bkgcube["yref"].real(dec)  
203 - bkgcube["debug"].boolean(debug) 185 + bkgcube["inobs"] = "obs.xml"
  186 + bkgcube["inmodel"] = model
  187 + bkgcube["incube"] = "cntcube.fits"
  188 + bkgcube["outcube"] = "bkgcube.fits"
  189 + bkgcube["outmodel"] = "model_bkg.xml"
  190 + bkgcube["caldb"] = caldb
  191 + bkgcube["irf"] = irf
  192 + bkgcube["ebinalg"] = "LOG"
  193 + bkgcube["emin"] = emin
  194 + bkgcube["emax"] = emax
  195 + bkgcube["enumbins"] = enumbins
  196 + bkgcube["nxpix"] = 10
  197 + bkgcube["nypix"] = 10
  198 + bkgcube["binsz"] = 1.0
  199 + bkgcube["coordsys"] = coordsys
  200 + bkgcube["proj"] = proj
  201 + bkgcube["xref"] = ra
  202 + bkgcube["yref"] = dec
  203 + bkgcube["debug"] = debug
204 bkgcube.execute() 204 bkgcube.execute()
205 205
206 # Perform maximum likelihood fitting 206 # Perform maximum likelihood fitting
207 like = ctools.ctlike() 207 like = ctools.ctlike()
208 - like["inobs"].filename("cntcube.fits")  
209 - like["inmodel"].filename("model_bkg.xml")  
210 - like["outmodel"].filename("fit_results.xml")  
211 - like["expcube"].filename("expcube.fits")  
212 - like["psfcube"].filename("psfcube.fits")  
213 - like["bkgcube"].filename("bkgcube.fits")  
214 - like["caldb"].string(caldb)  
215 - like["irf"].string(irf)  
216 - like["debug"].boolean(True) # Switch this always on for results in console 208 + like["inobs"] = "cntcube.fits"
  209 + like["inmodel"] = "model_bkg.xml"
  210 + like["outmodel"] = "fit_results.xml"
  211 + like["expcube"] = "expcube.fits"
  212 + like["psfcube"] = "psfcube.fits"
  213 + like["bkgcube"] = "bkgcube.fits"
  214 + like["caldb"] = caldb
  215 + like["irf"] = irf
  216 + like["debug"] = True # Switch this always on for results in console
217 like.execute() 217 like.execute()
218 218
219 # Return 219 # Return
examples/pipeline_stacked_mem.py
@@ -113,74 +113,74 @@ def run_pipeline(obs, ra=83.63, dec=22.01, emin=0.1, emax=100.0, \ @@ -113,74 +113,74 @@ def run_pipeline(obs, ra=83.63, dec=22.01, emin=0.1, emax=100.0, \
113 """ 113 """
114 # Simulate events 114 # Simulate events
115 sim = ctools.ctobssim(obs) 115 sim = ctools.ctobssim(obs)
116 - sim["debug"].boolean(debug) 116 + sim["debug"] = debug
117 sim.run() 117 sim.run()
118 118
119 # Bin events into counts map 119 # Bin events into counts map
120 bin = ctools.ctbin(sim.obs()) 120 bin = ctools.ctbin(sim.obs())
121 - bin["ebinalg"].string("LOG")  
122 - bin["emin"].real(emin)  
123 - bin["emax"].real(emax)  
124 - bin["enumbins"].integer(enumbins)  
125 - bin["nxpix"].integer(nxpix)  
126 - bin["nypix"].integer(nypix)  
127 - bin["binsz"].real(binsz)  
128 - bin["coordsys"].string(coordsys)  
129 - bin["proj"].string(proj)  
130 - bin["xref"].real(ra)  
131 - bin["yref"].real(dec)  
132 - bin["debug"].boolean(debug) 121 + bin["ebinalg"] = "LOG"
  122 + bin["emin"] = emin
  123 + bin["emax"] = emax
  124 + bin["enumbins"] = enumbins
  125 + bin["nxpix"] = nxpix
  126 + bin["nypix"] = nypix
  127 + bin["binsz"] = binsz
  128 + bin["coordsys"] = coordsys
  129 + bin["proj"] = proj
  130 + bin["xref"] = ra
  131 + bin["yref"] = dec
  132 + bin["debug"] = debug
133 bin.run() 133 bin.run()
134 134
135 # Create exposure cube 135 # Create exposure cube
136 expcube = ctools.ctexpcube(sim.obs()) 136 expcube = ctools.ctexpcube(sim.obs())
137 - expcube["incube"].filename("NONE")  
138 - expcube["ebinalg"].string("LOG")  
139 - expcube["emin"].real(emin)  
140 - expcube["emax"].real(emax)  
141 - expcube["enumbins"].integer(enumbins)  
142 - expcube["nxpix"].integer(nxpix)  
143 - expcube["nypix"].integer(nypix)  
144 - expcube["binsz"].real(binsz)  
145 - expcube["coordsys"].string(coordsys)  
146 - expcube["proj"].string(proj)  
147 - expcube["xref"].real(ra)  
148 - expcube["yref"].real(dec)  
149 - expcube["debug"].boolean(debug) 137 + expcube["incube"] = "NONE"
  138 + expcube["ebinalg"] = "LOG"
  139 + expcube["emin"] = emin
  140 + expcube["emax"] = emax
  141 + expcube["enumbins"] = enumbins
  142 + expcube["nxpix"] = nxpix
  143 + expcube["nypix"] = nypix
  144 + expcube["binsz"] = binsz
  145 + expcube["coordsys"] = coordsys
  146 + expcube["proj"] = proj
  147 + expcube["xref"] = ra
  148 + expcube["yref"] = dec
  149 + expcube["debug"] = debug
150 expcube.run() 150 expcube.run()
151 151
152 # Create PSF cube 152 # Create PSF cube
153 psfcube = ctools.ctpsfcube(sim.obs()) 153 psfcube = ctools.ctpsfcube(sim.obs())
154 - psfcube["incube"].filename("NONE")  
155 - psfcube["ebinalg"].string("LOG")  
156 - psfcube["emin"].real(emin)  
157 - psfcube["emax"].real(emax)  
158 - psfcube["enumbins"].integer(enumbins)  
159 - psfcube["nxpix"].integer(10)  
160 - psfcube["nypix"].integer(10)  
161 - psfcube["binsz"].real(1.0)  
162 - psfcube["coordsys"].string(coordsys)  
163 - psfcube["proj"].string(proj)  
164 - psfcube["xref"].real(ra)  
165 - psfcube["yref"].real(dec)  
166 - psfcube["debug"].boolean(debug) 154 + psfcube["incube"] = "NONE"
  155 + psfcube["ebinalg"] = "LOG"
  156 + psfcube["emin"] = emin
  157 + psfcube["emax"] = emax
  158 + psfcube["enumbins"] = enumbins
  159 + psfcube["nxpix"] = 10
  160 + psfcube["nypix"] = 10
  161 + psfcube["binsz"] = 1.0
  162 + psfcube["coordsys"] = coordsys
  163 + psfcube["proj"] = proj
  164 + psfcube["xref"] = ra
  165 + psfcube["yref"] = dec
  166 + psfcube["debug"] = debug
167 psfcube.run() 167 psfcube.run()
168 168
169 # Create background cube 169 # Create background cube
170 bkgcube = ctools.ctbkgcube(sim.obs()) 170 bkgcube = ctools.ctbkgcube(sim.obs())
171 - bkgcube["incube"].filename("NONE")  
172 - bkgcube["ebinalg"].string("LOG")  
173 - bkgcube["emin"].real(emin)  
174 - bkgcube["emax"].real(emax)  
175 - bkgcube["enumbins"].integer(enumbins)  
176 - bkgcube["nxpix"].integer(10)  
177 - bkgcube["nypix"].integer(10)  
178 - bkgcube["binsz"].real(1.0)  
179 - bkgcube["coordsys"].string(coordsys)  
180 - bkgcube["proj"].string(proj)  
181 - bkgcube["xref"].real(ra)  
182 - bkgcube["yref"].real(dec)  
183 - bkgcube["debug"].boolean(debug) 171 + bkgcube["incube"] = "NONE"
  172 + bkgcube["ebinalg"] = "LOG"
  173 + bkgcube["emin"] = emin
  174 + bkgcube["emax"] = emax
  175 + bkgcube["enumbins"] = enumbins
  176 + bkgcube["nxpix"] = 10
  177 + bkgcube["nypix"] = 10
  178 + bkgcube["binsz"] = 1.0
  179 + bkgcube["coordsys"] = coordsys
  180 + bkgcube["proj"] = proj
  181 + bkgcube["xref"] = ra
  182 + bkgcube["yref"] = dec
  183 + bkgcube["debug"] = debug
184 bkgcube.run() 184 bkgcube.run()
185 185
186 # Attach background model to observation container 186 # Attach background model to observation container
@@ -192,7 +192,7 @@ def run_pipeline(obs, ra=83.63, dec=22.01, emin=0.1, emax=100.0, \ @@ -192,7 +192,7 @@ def run_pipeline(obs, ra=83.63, dec=22.01, emin=0.1, emax=100.0, \
192 192
193 # Perform maximum likelihood fitting 193 # Perform maximum likelihood fitting
194 like = ctools.ctlike(bin.obs()) 194 like = ctools.ctlike(bin.obs())
195 - like["debug"].boolean(True) # Switch this always on for results in console 195 + like["debug"] = True # Switch this always on for results in console
196 like.run() 196 like.run()
197 197
198 # Return 198 # Return
examples/pipeline_unbinned_disk.py
@@ -118,32 +118,32 @@ def run_pipeline(obs, ra=83.63, dec=22.01, rad=3.0, \ @@ -118,32 +118,32 @@ def run_pipeline(obs, ra=83.63, dec=22.01, rad=3.0, \
118 118
119 # Simulate events 119 # Simulate events
120 sim = ctools.ctobssim(obs) 120 sim = ctools.ctobssim(obs)
121 - sim["debug"].boolean(debug)  
122 - sim["outevents"].filename("obs.xml") 121 + sim["debug"] = debug
  122 + sim["outevents"] = "obs.xml"
123 sim.execute() 123 sim.execute()
124 124
125 # Select events 125 # Select events
126 select = ctools.ctselect() 126 select = ctools.ctselect()
127 - select["inobs"].filename("obs.xml")  
128 - select["outobs"].filename("obs_selected.xml")  
129 - select["ra"].real(ra)  
130 - select["dec"].real(dec)  
131 - select["rad"].real(rad)  
132 - select["emin"].real(emin)  
133 - select["emax"].real(emax)  
134 - select["tmin"].real(tmin)  
135 - select["tmax"].real(tmax)  
136 - select["debug"].boolean(debug) 127 + select["inobs"] = "obs.xml"
  128 + select["outobs"] = "obs_selected.xml"
  129 + select["ra"] = ra
  130 + select["dec"] = dec
  131 + select["rad"] = rad
  132 + select["emin"] = emin
  133 + select["emax"] = emax
  134 + select["tmin"] = tmin
  135 + select["tmax"] = tmax
  136 + select["debug"] = debug
137 select.execute() 137 select.execute()
138 138
139 # Perform maximum likelihood fitting 139 # Perform maximum likelihood fitting
140 like = ctools.ctlike() 140 like = ctools.ctlike()
141 - like["inobs"].filename("obs_selected.xml")  
142 - like["inmodel"].filename(model)  
143 - like["outmodel"].filename("fit_results.xml")  
144 - like["caldb"].string(caldb)  
145 - like["irf"].string(irf)  
146 - like["debug"].boolean(True) # Switch this always on for results in console 141 + like["inobs"] = "obs_selected.xml"
  142 + like["inmodel"] = model
  143 + like["outmodel"] = "fit_results.xml"
  144 + like["caldb"] = caldb
  145 + like["irf"] = irf
  146 + like["debug"] = True # Switch this always on for results in console
147 like.execute() 147 like.execute()
148 148
149 # Return 149 # Return
examples/pipeline_unbinned_mem.py
@@ -111,24 +111,24 @@ def run_pipeline(obs, ra=83.63, dec=22.01, rad=3.0, \ @@ -111,24 +111,24 @@ def run_pipeline(obs, ra=83.63, dec=22.01, rad=3.0, \
111 """ 111 """
112 # Simulate events 112 # Simulate events
113 sim = ctools.ctobssim(obs) 113 sim = ctools.ctobssim(obs)
114 - sim["debug"].boolean(debug) 114 + sim["debug"] = debug
115 sim.run() 115 sim.run()
116 116
117 # Select events 117 # Select events
118 select = ctools.ctselect(sim.obs()) 118 select = ctools.ctselect(sim.obs())
119 - select["ra"].real(ra)  
120 - select["dec"].real(dec)  
121 - select["rad"].real(rad)  
122 - select["emin"].real(emin)  
123 - select["emax"].real(emax)  
124 - select["tmin"].real(tmin)  
125 - select["tmax"].real(tmax)  
126 - select["debug"].boolean(debug) 119 + select["ra"] = ra
  120 + select["dec"] = dec
  121 + select["rad"] = rad
  122 + select["emin"] = emin
  123 + select["emax"] = emax
  124 + select["tmin"] = tmin
  125 + select["tmax"] = tmax
  126 + select["debug"] = debug
127 select.run() 127 select.run()
128 128
129 # Perform maximum likelihood fitting 129 # Perform maximum likelihood fitting
130 like = ctools.ctlike(select.obs()) 130 like = ctools.ctlike(select.obs())
131 - like["debug"].boolean(True) # Switch this always on for results in console 131 + like["debug"] = True # Switch this always on for results in console
132 like.run() 132 like.run()
133 133
134 # Return 134 # Return
pyext/ctools/analysisutils.py
@@ -260,17 +260,17 @@ class Analyser(base): @@ -260,17 +260,17 @@ class Analyser(base):
260 bin = ct.ctbin() 260 bin = ct.ctbin()
261 bin["evfile"] = self.m_evtfile 261 bin["evfile"] = self.m_evtfile
262 bin["outfile"] = self.m_cntfile 262 bin["outfile"] = self.m_cntfile
263 - bin["ebinalg"].string(self.m_ebinalg)  
264 - bin["emin"].real(self.m_emin)  
265 - bin["emax"].real(self.m_emax) 263 + bin["ebinalg"] = self.m_ebinalg
  264 + bin["emin"] = self.m_emin
  265 + bin["emax"] = self.m_emax
266 Nbdecade = log10(self.m_emax)-log10(self.m_emin)#Compute the number of decade 266 Nbdecade = log10(self.m_emax)-log10(self.m_emin)#Compute the number of decade
267 - bin["enumbins"].integer(int(self.m_enumbins*Nbdecade))  
268 - bin["usepnt"].boolean(self.m_usepnt) # Use pointing for map centre  
269 - bin["nxpix"].integer(self.m_nxpix)  
270 - bin["nypix"].integer(self.m_nypix)  
271 - bin["binsz"].real(self.m_binsz)  
272 - bin["coordsys"].string(self.m_coordsys)  
273 - bin["proj"].string(self.m_proj) 267 + bin["enumbins"] = int(self.m_enumbins*Nbdecade)
  268 + bin["usepnt"] = self.m_usepnt # Use pointing for map centre
  269 + bin["nxpix"] = self.m_nxpix
  270 + bin["nypix"] = self.m_nypix
  271 + bin["binsz"] = self.m_binsz
  272 + bin["coordsys"] = self.m_coordsys
  273 + bin["proj"] = self.m_proj
274 274
275 # Optionally open the log file 275 # Optionally open the log file
276 if log: 276 if log:
@@ -278,7 +278,7 @@ class Analyser(base): @@ -278,7 +278,7 @@ class Analyser(base):
278 278
279 # Optionally switch-on debugging model 279 # Optionally switch-on debugging model
280 if debug: 280 if debug:
281 - bin["debug"].boolean(True) 281 + bin["debug"] = True
282 282
283 # Run ctbin application. This will loop over all observations in 283 # Run ctbin application. This will loop over all observations in
284 # the container and bin the events in counts maps 284 # the container and bin the events in counts maps
@@ -302,11 +302,11 @@ class Analyser(base): @@ -302,11 +302,11 @@ class Analyser(base):
302 else: 302 else:
303 self.like["infile"] = self.m_evtfile 303 self.like["infile"] = self.m_evtfile
304 304
305 - self.like["stat"].string(self.m_stat)  
306 - self.like["caldb"].string(self.m_caldb)  
307 - self.like["irf"].string(self.m_irf) 305 + self.like["stat"] = self.m_stat
  306 + self.like["caldb"] = self.m_caldb
  307 + self.like["irf"] = self.m_irf
308 self.like["srcmdl"] = self.m_xml 308 self.like["srcmdl"] = self.m_xml
309 - self.like["edisp"].boolean(self.m_edisp) 309 + self.like["edisp"] = self.m_edisp
310 self.like["outmdl"] = self.m_xml_out 310 self.like["outmdl"] = self.m_xml_out
311 311
312 # Optionally open the log file 312 # Optionally open the log file
@@ -314,7 +314,7 @@ class Analyser(base): @@ -314,7 +314,7 @@ class Analyser(base):
314 self.like.logFileOpen() 314 self.like.logFileOpen()
315 # Optionally switch-on debugging model 315 # Optionally switch-on debugging model
316 if debug: 316 if debug:
317 - self.like["debug"].boolean(True) 317 + self.like["debug"] = True
318 318
319 def fit(self,log=False,debug=False): 319 def fit(self,log=False,debug=False):
320 self.validate() 320 self.validate()
pyext/ctools/obsutils.py
@@ -45,8 +45,8 @@ def sim(obs, log=False, debug=False, chatter=2, edisp=False, seed=0, nbins=0, @@ -45,8 +45,8 @@ def sim(obs, log=False, debug=False, chatter=2, edisp=False, seed=0, nbins=0,
45 45
46 # Allocate ctobssim application and set parameters 46 # Allocate ctobssim application and set parameters
47 sim = ctools.ctobssim(obs) 47 sim = ctools.ctobssim(obs)
48 - sim["seed"].integer(seed)  
49 - sim["edisp"].boolean(edisp) 48 + sim["seed"] = seed
  49 + sim["edisp"] = edisp
50 50
51 # Optionally open the log file 51 # Optionally open the log file
52 if log: 52 if log:
@@ -54,10 +54,10 @@ def sim(obs, log=False, debug=False, chatter=2, edisp=False, seed=0, nbins=0, @@ -54,10 +54,10 @@ def sim(obs, log=False, debug=False, chatter=2, edisp=False, seed=0, nbins=0,
54 54
55 # Optionally switch-on debugging model 55 # Optionally switch-on debugging model
56 if debug: 56 if debug:
57 - sim["debug"].boolean(True) 57 + sim["debug"] = True
58 58
59 # Set chatter level 59 # Set chatter level
60 - sim["chatter"].integer(chatter) 60 + sim["chatter"] = chatter
61 61
62 # Run ctobssim application. This will loop over all observations in the 62 # Run ctobssim application. This will loop over all observations in the
63 # container and simulation the events for each observation. Note that 63 # container and simulation the events for each observation. Note that
@@ -85,16 +85,16 @@ def sim(obs, log=False, debug=False, chatter=2, edisp=False, seed=0, nbins=0, @@ -85,16 +85,16 @@ def sim(obs, log=False, debug=False, chatter=2, edisp=False, seed=0, nbins=0,
85 85
86 # Allocate ctbin application and set parameters 86 # Allocate ctbin application and set parameters
87 bin = ctools.ctbin(sim.obs()) 87 bin = ctools.ctbin(sim.obs())
88 - bin["ebinalg"].string("LOG")  
89 - bin["emin"].real(emin)  
90 - bin["emax"].real(emax)  
91 - bin["enumbins"].integer(nbins)  
92 - bin["usepnt"].boolean(True) # Use pointing for map centre  
93 - bin["nxpix"].integer(npix)  
94 - bin["nypix"].integer(npix)  
95 - bin["binsz"].real(binsz)  
96 - bin["coordsys"].string(coord)  
97 - bin["proj"].string(proj) 88 + bin["ebinalg"] = "LOG"
  89 + bin["emin"] = emin
  90 + bin["emax"] = emax
  91 + bin["enumbins"] = nbins
  92 + bin["usepnt"] = True # Use pointing for map centre
  93 + bin["nxpix"] = npix
  94 + bin["nypix"] = npix
  95 + bin["binsz"] = binsz
  96 + bin["coordsys"] = coord
  97 + bin["proj"] = proj
98 98
99 # Optionally open the log file 99 # Optionally open the log file
100 if log: 100 if log:
@@ -102,10 +102,10 @@ def sim(obs, log=False, debug=False, chatter=2, edisp=False, seed=0, nbins=0, @@ -102,10 +102,10 @@ def sim(obs, log=False, debug=False, chatter=2, edisp=False, seed=0, nbins=0,
102 102
103 # Optionally switch-on debugging model 103 # Optionally switch-on debugging model
104 if debug: 104 if debug:
105 - bin["debug"].boolean(True) 105 + bin["debug"] = True
106 106
107 # Set chatter level 107 # Set chatter level
108 - bin["chatter"].integer(chatter) 108 + bin["chatter"] = chatter
109 109
110 # Run ctbin application. This will loop over all observations in 110 # Run ctbin application. This will loop over all observations in
111 # the container and bin the events in counts maps 111 # the container and bin the events in counts maps
@@ -154,13 +154,13 @@ def fit(obs, log=False, debug=False, chatter=2, edisp=False): @@ -154,13 +154,13 @@ def fit(obs, log=False, debug=False, chatter=2, edisp=False):
154 154
155 # Optionally switch-on debugging model 155 # Optionally switch-on debugging model
156 if debug: 156 if debug:
157 - like["debug"].boolean(True) 157 + like["debug"] = True
158 158
159 # Set chatter level 159 # Set chatter level
160 - like["chatter"].integer(chatter) 160 + like["chatter"] = chatter
161 161
162 # Optionally apply energy dispersion 162 # Optionally apply energy dispersion
163 - like["edisp"].boolean(edisp) 163 + like["edisp"] = edisp
164 164
165 # Run ctlike application. 165 # Run ctlike application.
166 like.run() 166 like.run()
@@ -189,7 +189,7 @@ def cterror(obs, srcname, log=False, debug=False, chatter=2): @@ -189,7 +189,7 @@ def cterror(obs, srcname, log=False, debug=False, chatter=2):
189 error = ctools.cterror(obs) 189 error = ctools.cterror(obs)
190 190
191 # Set cterror parameters 191 # Set cterror parameters
192 - error["srcname"].string(srcname) 192 + error["srcname"] = srcname
193 193
194 # Optionally open the log file 194 # Optionally open the log file
195 if log: 195 if log:
@@ -197,10 +197,10 @@ def cterror(obs, srcname, log=False, debug=False, chatter=2): @@ -197,10 +197,10 @@ def cterror(obs, srcname, log=False, debug=False, chatter=2):
197 197
198 # Optionally switch-on debugging model 198 # Optionally switch-on debugging model
199 if debug: 199 if debug:
200 - error["debug"].boolean(True) 200 + error["debug"] = True
201 201
202 # Set chatter level 202 # Set chatter level
203 - error["chatter"].integer(chatter) 203 + error["chatter"] = chatter
204 204
205 # Run cterror application. 205 # Run cterror application.
206 error.run() 206 error.run()
@@ -625,13 +625,13 @@ def spectrum(obs, source, ebounds): @@ -625,13 +625,13 @@ def spectrum(obs, source, ebounds):
625 625
626 # Clone observations and reset energy thresholds 626 # Clone observations and reset energy thresholds
627 select = ctools.ctselect(obs) 627 select = ctools.ctselect(obs)
628 - select["ra"].value("UNDEF")  
629 - select["dec"].value("UNDEF")  
630 - select["rad"].value("UNDEF")  
631 - select["tmin"].real(0.0)  
632 - select["tmax"].real(0.0)  
633 - select["emin"].real(ebounds.emin(i).TeV())  
634 - select["emax"].real(ebounds.emax(i).TeV()) 628 + select["ra"] = "UNDEF"
  629 + select["dec"] = "UNDEF"
  630 + select["rad"] = "UNDEF"
  631 + select["tmin"] = 0
  632 + select["tmax"] = 0
  633 + select["emin"] = ebounds.emin(i).TeV()
  634 + select["emax"] = ebounds.emax(i).TeV()
635 select.run() 635 select.run()
636 636
637 # Refit and write out to spectrum 637 # Refit and write out to spectrum
scripts/cslightcrv.py
@@ -378,13 +378,13 @@ class cslightcrv(ctools.cscript): @@ -378,13 +378,13 @@ class cslightcrv(ctools.cscript):
378 378
379 # Select events 379 # Select events
380 select = ctools.ctselect(self.obs) 380 select = ctools.ctselect(self.obs)
381 - select["emin"].real(self.m_emin)  
382 - select["emax"].real(self.m_emax)  
383 - select["tmin"].real(tmin.convert(select.time_reference()))  
384 - select["tmax"].real(tmax.convert(select.time_reference()))  
385 - select["rad"].value("UNDEFINED")  
386 - select["ra"].value("UNDEFINED")  
387 - select["dec"].value("UNDEFINED") 381 + select["emin"] = self.m_emin
  382 + select["emax"] = self.m_emax
  383 + select["tmin"] = tmin.convert(select.time_reference())
  384 + select["tmax"] = tmax.convert(select.time_reference())
  385 + select["rad"] = "UNDEFINED"
  386 + select["ra"] = "UNDEFINED"
  387 + select["dec"] = "UNDEFINED"
388 select.run() 388 select.run()
389 389
390 # Retrieve observation 390 # Retrieve observation
@@ -399,18 +399,18 @@ class cslightcrv(ctools.cscript): @@ -399,18 +399,18 @@ class cslightcrv(ctools.cscript):
399 399
400 # Bin events 400 # Bin events
401 bin = ctools.ctbin(select.obs()) 401 bin = ctools.ctbin(select.obs())
402 - bin["usepnt"].boolean(False)  
403 - bin["ebinalg"].string("LOG")  
404 - bin["xref"].real(self.m_xref)  
405 - bin["yref"].real(self.m_yref)  
406 - bin["binsz"].real(self.m_binsz)  
407 - bin["nxpix"].integer(self.m_nxpix)  
408 - bin["nypix"].integer(self.m_nypix)  
409 - bin["enumbins"].integer(self.m_ebins)  
410 - bin["emin"].real(self.m_emin)  
411 - bin["emax"].real(self.m_emax)  
412 - bin["coordsys"].string(self.m_coordsys)  
413 - bin["proj"].string(self.m_proj) 402 + bin["usepnt"] = False
  403 + bin["ebinalg"] = "LOG"
  404 + bin["xref"] = self.m_xref
  405 + bin["yref"] = self.m_yref
  406 + bin["binsz"] = self.m_binsz
  407 + bin["nxpix"] = self.m_nxpix
  408 + bin["nypix"] = self.m_nypix
  409 + bin["enumbins"] = self.m_ebins
  410 + bin["emin"] = self.m_emin
  411 + bin["emax"] = self.m_emax
  412 + bin["coordsys"] = self.m_coordsys
  413 + bin["proj"] = self.m_proj
414 bin.run() 414 bin.run()
415 415
416 # Header 416 # Header
@@ -419,19 +419,19 @@ class cslightcrv(ctools.cscript): @@ -419,19 +419,19 @@ class cslightcrv(ctools.cscript):
419 419
420 # Create exposure cube 420 # Create exposure cube
421 expcube = ctools.ctexpcube(select.obs()) 421 expcube = ctools.ctexpcube(select.obs())
422 - expcube["incube"].filename("NONE")  
423 - expcube["usepnt"].boolean(False)  
424 - expcube["ebinalg"].string("LOG")  
425 - expcube["xref"].real(self.m_xref)  
426 - expcube["yref"].real(self.m_yref)  
427 - expcube["binsz"].real(self.m_binsz)  
428 - expcube["nxpix"].integer(self.m_nxpix)  
429 - expcube["nypix"].integer(self.m_nypix)  
430 - expcube["enumbins"].integer(self.m_ebins)  
431 - expcube["emin"].real(self.m_emin)  
432 - expcube["emax"].real(self.m_emax)  
433 - expcube["coordsys"].string(self.m_coordsys)  
434 - expcube["proj"].string(self.m_proj) 422 + expcube["incube"] = "NONE"
  423 + expcube["usepnt"] = False
  424 + expcube["ebinalg"] = "LOG"
  425 + expcube["xref"] = self.m_xref
  426 + expcube["yref"] = self.m_yref
  427 + expcube["binsz"] = self.m_binsz
  428 + expcube["nxpix"] = self.m_nxpix
  429 + expcube["nypix"] = self.m_nypix
  430 + expcube["enumbins"] = self.m_ebins
  431 + expcube["emin"] = self.m_emin
  432 + expcube["emax"] = self.m_emax
  433 + expcube["coordsys"] = self.m_coordsys
  434 + expcube["proj"] = self.m_proj
435 expcube.run() 435 expcube.run()
436 436
437 # Header 437 # Header
@@ -440,19 +440,19 @@ class cslightcrv(ctools.cscript): @@ -440,19 +440,19 @@ class cslightcrv(ctools.cscript):
440 440
441 # Create psf cube 441 # Create psf cube
442 psfcube = ctools.ctpsfcube(select.obs()) 442 psfcube = ctools.ctpsfcube(select.obs())
443 - psfcube["incube"].filename("NONE")  
444 - psfcube["usepnt"].boolean(False)  
445 - psfcube["ebinalg"].string("LOG")  
446 - psfcube["xref"].real(self.m_xref)  
447 - psfcube["yref"].real(self.m_yref)  
448 - psfcube["binsz"].real(self.m_binsz)  
449 - psfcube["nxpix"].integer(self.m_nxpix)  
450 - psfcube["nypix"].integer(self.m_nypix)  
451 - psfcube["enumbins"].integer(self.m_ebins)  
452 - psfcube["emin"].real(self.m_emin)  
453 - psfcube["emax"].real(self.m_emax)  
454 - psfcube["coordsys"].string(self.m_coordsys)  
455 - psfcube["proj"].string(self.m_proj) 443 + psfcube["incube"] = "NONE"
  444 + psfcube["usepnt"] = False
  445 + psfcube["ebinalg"] = "LOG"
  446 + psfcube["xref"] = self.m_xref
  447 + psfcube["yref"] = self.m_yref
  448 + psfcube["binsz"] = self.m_binsz
  449 + psfcube["nxpix"] = self.m_nxpix
  450 + psfcube["nypix"] = self.m_nypix
  451 + psfcube["enumbins"] = self.m_ebins
  452 + psfcube["emin"] = self.m_emin
  453 + psfcube["emax"] = self.m_emax
  454 + psfcube["coordsys"] = self.m_coordsys
  455 + psfcube["proj"] = self.m_proj
456 psfcube.run() 456 psfcube.run()
457 457
458 # Header 458 # Header
@@ -461,19 +461,19 @@ class cslightcrv(ctools.cscript): @@ -461,19 +461,19 @@ class cslightcrv(ctools.cscript):
461 461
462 # Create background cube 462 # Create background cube
463 bkgcube = ctools.ctbkgcube(select.obs()) 463 bkgcube = ctools.ctbkgcube(select.obs())
464 - bkgcube["incube"].filename("NONE")  
465 - bkgcube["usepnt"].boolean(False)  
466 - bkgcube["ebinalg"].string("LOG")  
467 - bkgcube["xref"].real(self.m_xref)  
468 - bkgcube["yref"].real(self.m_yref)  
469 - bkgcube["binsz"].real(self.m_binsz)  
470 - bkgcube["nxpix"].integer(self.m_nxpix)  
471 - bkgcube["nypix"].integer(self.m_nypix)  
472 - bkgcube["enumbins"].integer(self.m_ebins)  
473 - bkgcube["emin"].real(self.m_emin)  
474 - bkgcube["emax"].real(self.m_emax)  
475 - bkgcube["coordsys"].string(self.m_coordsys)  
476 - bkgcube["proj"].string(self.m_proj) 464 + bkgcube["incube"] = "NONE"
  465 + bkgcube["usepnt"] = False
  466 + bkgcube["ebinalg"] = "LOG"
  467 + bkgcube["xref"] = self.m_xref
  468 + bkgcube["yref"] = self.m_yref
  469 + bkgcube["binsz"] = self.m_binsz
  470 + bkgcube["nxpix"] = self.m_nxpix
  471 + bkgcube["nypix"] = self.m_nypix
  472 + bkgcube["enumbins"] = self.m_ebins
  473 + bkgcube["emin"] = self.m_emin
  474 + bkgcube["emax"] = self.m_emax
  475 + bkgcube["coordsys"] = self.m_coordsys
  476 + bkgcube["proj"] = self.m_proj
477 bkgcube.run() 477 bkgcube.run()
478 478
479 # Set new binned observation 479 # Set new binned observation
@@ -531,8 +531,8 @@ class cslightcrv(ctools.cscript): @@ -531,8 +531,8 @@ class cslightcrv(ctools.cscript):
531 531
532 # Create upper limit object 532 # Create upper limit object
533 ulimit = ctools.ctulimit(like.obs()) 533 ulimit = ctools.ctulimit(like.obs())
534 - ulimit["srcname"].string(self.m_srcname)  
535 - ulimit["eref"].real(1.0) 534 + ulimit["srcname"] = self.m_srcname
  535 + ulimit["eref"] = 1.0
536 536
537 # Try to run upper limit and catch exceptions 537 # Try to run upper limit and catch exceptions
538 try: 538 try:
scripts/csresmap.py
@@ -217,20 +217,20 @@ class csresmap(ctools.cscript): @@ -217,20 +217,20 @@ class csresmap(ctools.cscript):
217 217
218 # Create countsmap 218 # Create countsmap
219 bin = ctools.ctbin(self.obs) 219 bin = ctools.ctbin(self.obs)
220 - bin["nxpix"].integer(self.m_nxpix)  
221 - bin["nypix"].integer(self.m_nypix)  
222 - bin["proj"].string(self.m_proj)  
223 - bin["coordsys"].string(self.m_coordsys)  
224 - bin["xref"].real(self.m_xref)  
225 - bin["yref"].real(self.m_yref)  
226 - bin["enumbins"].integer(self.m_enumbins)  
227 - bin["ebinalg"].string(self.m_ebinalg)  
228 - bin["emin"].real(self.m_emin)  
229 - bin["emax"].real(self.m_emax)  
230 - bin["binsz"].real(self.m_binsz)  
231 - bin["chatter"].integer(self.m_chatter)  
232 - bin["clobber"].boolean(self.m_clobber)  
233 - bin["debug"].boolean(self.m_debug) 220 + bin["nxpix"] = self.m_nxpix
  221 + bin["nypix"] = self.m_nypix
  222 + bin["proj"] = self.m_proj
  223 + bin["coordsys"] = self.m_coordsys
  224 + bin["xref"] = self.m_xref
  225 + bin["yref"] = self.m_yref
  226 + bin["enumbins"] = self.m_enumbins
  227 + bin["ebinalg"] = self.m_ebinalg
  228 + bin["emin"] = self.m_emin
  229 + bin["emax"] = self.m_emax
  230 + bin["binsz"] = self.m_binsz
  231 + bin["chatter"] = self.m_chatter
  232 + bin["clobber"] = self.m_clobber
  233 + bin["debug"] = self.m_debug
234 bin.run() 234 bin.run()
235 235
236 # Store counts map as residual map. Note that we need a 236 # Store counts map as residual map. Note that we need a
@@ -250,9 +250,9 @@ class csresmap(ctools.cscript): @@ -250,9 +250,9 @@ class csresmap(ctools.cscript):
250 # Create model map 250 # Create model map
251 model = ctools.ctmodel(self.obs) 251 model = ctools.ctmodel(self.obs)
252 model.cube(bin.cube()) 252 model.cube(bin.cube())
253 - model["chatter"].integer(self.m_chatter)  
254 - model["clobber"].boolean(self.m_clobber)  
255 - model["debug"].boolean(self.m_debug) 253 + model["chatter"] = self.m_chatter
  254 + model["clobber"] = self.m_clobber
  255 + model["debug"] = self.m_debug
256 model.run() 256 model.run()
257 257
258 # Get model map into GSkymap object 258 # Get model map into GSkymap object
scripts/csspec.py
@@ -322,13 +322,13 @@ class csspec(ctools.cscript): @@ -322,13 +322,13 @@ class csspec(ctools.cscript):
322 322
323 # Select events 323 # Select events
324 select = ctools.ctselect(self.obs) 324 select = ctools.ctselect(self.obs)
325 - select["emin"].real(emin.TeV())  
326 - select["emax"].real(emax.TeV())  
327 - select["tmin"].value("UNDEFINED")  
328 - select["tmax"].value("UNDEFINED")  
329 - select["rad"].value("UNDEFINED")  
330 - select["ra"].value("UNDEFINED")  
331 - select["dec"].value("UNDEFINED") 325 + select["emin"] = emin.TeV()
  326 + select["emax"] = emax.TeV()
  327 + select["tmin"] = "UNDEFINED"
  328 + select["tmax"] = "UNDEFINED"
  329 + select["rad"] = "UNDEFINED"
  330 + select["ra"] = "UNDEFINED"
  331 + select["dec"] = "UNDEFINED"
332 select.run() 332 select.run()
333 333
334 # Retrieve observation 334 # Retrieve observation
@@ -343,18 +343,18 @@ class csspec(ctools.cscript): @@ -343,18 +343,18 @@ class csspec(ctools.cscript):
343 343
344 # Bin events 344 # Bin events
345 bin = ctools.ctbin(select.obs()) 345 bin = ctools.ctbin(select.obs())
346 - bin["usepnt"].boolean(False)  
347 - bin["ebinalg"].string("LOG")  
348 - bin["xref"].real(self.m_xref)  
349 - bin["yref"].real(self.m_yref)  
350 - bin["binsz"].real(self.m_binsz)  
351 - bin["nxpix"].integer(self.m_nxpix)  
352 - bin["nypix"].integer(self.m_nypix)  
353 - bin["enumbins"].integer(self.m_ebins)  
354 - bin["emin"].real(emin.TeV())  
355 - bin["emax"].real(emax.TeV())  
356 - bin["coordsys"].string(self.m_coordsys)  
357 - bin["proj"].string(self.m_proj) 346 + bin["usepnt"] = False
  347 + bin["ebinalg"] = "LOG"
  348 + bin["xref"] = self.m_xref
  349 + bin["yref"] = self.m_yref
  350 + bin["binsz"] = self.m_binsz
  351 + bin["nxpix"] = self.m_nxpix
  352 + bin["nypix"] = self.m_nypix
  353 + bin["enumbins"] = self.m_ebins
  354 + bin["emin"] = emin.TeV()
  355 + bin["emax"] = emax.TeV()
  356 + bin["coordsys"] = self.m_coordsys
  357 + bin["proj"] = self.m_proj
358 bin.run() 358 bin.run()
359 359
360 # Header 360 # Header
@@ -363,19 +363,19 @@ class csspec(ctools.cscript): @@ -363,19 +363,19 @@ class csspec(ctools.cscript):
363 363
364 # Create exposure cube 364 # Create exposure cube
365 expcube = ctools.ctexpcube(select.obs()) 365 expcube = ctools.ctexpcube(select.obs())
366 - expcube["incube"].filename("NONE")  
367 - expcube["usepnt"].boolean(False)  
368 - expcube["ebinalg"].string("LOG")  
369 - expcube["xref"].real(self.m_xref)  
370 - expcube["yref"].real(self.m_yref)  
371 - expcube["binsz"].real(self.m_binsz)  
372 - expcube["nxpix"].integer(self.m_nxpix)  
373 - expcube["nypix"].integer(self.m_nypix)  
374 - expcube["enumbins"].integer(self.m_ebins)  
375 - expcube["emin"].real(emin.TeV())  
376 - expcube["emax"].real(emax.TeV())  
377 - expcube["coordsys"].string(self.m_coordsys)  
378 - expcube["proj"].string(self.m_proj) 366 + expcube["incube"] = "NONE"
  367 + expcube["usepnt"] = False
  368 + expcube["ebinalg"] = "LOG"
  369 + expcube["xref"] = self.m_xref
  370 + expcube["yref"] = self.m_yref
  371 + expcube["binsz"] = self.m_binsz
  372 + expcube["nxpix"] = self.m_nxpix
  373 + expcube["nypix"] = self.m_nypix
  374 + expcube["enumbins"] = self.m_ebins
  375 + expcube["emin"] = emin.TeV()
  376 + expcube["emax"] = emax.TeV()
  377 + expcube["coordsys"] = self.m_coordsys
  378 + expcube["proj"] = self.m_proj
379 expcube.run() 379 expcube.run()
380 380
381 # Header 381 # Header
@@ -384,19 +384,19 @@ class csspec(ctools.cscript): @@ -384,19 +384,19 @@ class csspec(ctools.cscript):
384 384
385 # Create psf cube 385 # Create psf cube
386 psfcube = ctools.ctpsfcube(select.obs()) 386 psfcube = ctools.ctpsfcube(select.obs())
387 - psfcube["incube"].filename("NONE")  
388 - psfcube["usepnt"].boolean(False)  
389 - psfcube["ebinalg"].string("LOG")  
390 - psfcube["xref"].real(self.m_xref)  
391 - psfcube["yref"].real(self.m_yref)  
392 - psfcube["binsz"].real(self.m_binsz)  
393 - psfcube["nxpix"].integer(self.m_nxpix)  
394 - psfcube["nypix"].integer(self.m_nypix)  
395 - psfcube["enumbins"].integer(self.m_ebins)  
396 - psfcube["emin"].real(emin.TeV())  
397 - psfcube["emax"].real(emax.TeV())  
398 - psfcube["coordsys"].string(self.m_coordsys)  
399 - psfcube["proj"].string(self.m_proj) 387 + psfcube["incube"] = "NONE"
  388 + psfcube["usepnt"] = False
  389 + psfcube["ebinalg"] = "LOG"
  390 + psfcube["xref"] = self.m_xref
  391 + psfcube["yref"] = self.m_yref
  392 + psfcube["binsz"] = self.m_binsz
  393 + psfcube["nxpix"] = self.m_nxpix
  394 + psfcube["nypix"] = self.m_nypix
  395 + psfcube["enumbins"] = self.m_ebins
  396 + psfcube["emin"] = emin.TeV()
  397 + psfcube["emax"] = emax.TeV()
  398 + psfcube["coordsys"] = self.m_coordsys
  399 + psfcube["proj"] = self.m_proj
400 psfcube.run() 400 psfcube.run()
401 401
402 # Header 402 # Header
@@ -405,19 +405,19 @@ class csspec(ctools.cscript): @@ -405,19 +405,19 @@ class csspec(ctools.cscript):
405 405
406 # Create background cube 406 # Create background cube
407 bkgcube = ctools.ctbkgcube(select.obs()) 407 bkgcube = ctools.ctbkgcube(select.obs())
408 - bkgcube["incube"].filename("NONE")  
409 - bkgcube["usepnt"].boolean(False)  
410 - bkgcube["ebinalg"].string("LOG")  
411 - bkgcube["xref"].real(self.m_xref)  
412 - bkgcube["yref"].real(self.m_yref)  
413 - bkgcube["binsz"].real(self.m_binsz)  
414 - bkgcube["nxpix"].integer(self.m_nxpix)  
415 - bkgcube["nypix"].integer(self.m_nypix)  
416 - bkgcube["enumbins"].integer(self.m_ebins)  
417 - bkgcube["emin"].real(emin.TeV())  
418 - bkgcube["emax"].real(emax.TeV())  
419 - bkgcube["coordsys"].string(self.m_coordsys)  
420 - bkgcube["proj"].string(self.m_proj) 408 + bkgcube["incube"] = "NONE"
  409 + bkgcube["usepnt"] = False
  410 + bkgcube["ebinalg"] = "LOG"
  411 + bkgcube["xref"] = self.m_xref
  412 + bkgcube["yref"] = self.m_yref
  413 + bkgcube["binsz"] = self.m_binsz
  414 + bkgcube["nxpix"] = self.m_nxpix
  415 + bkgcube["nypix"] = self.m_nypix
  416 + bkgcube["enumbins"] = self.m_ebins
  417 + bkgcube["emin"] = emin.TeV()
  418 + bkgcube["emax"] = emax.TeV()
  419 + bkgcube["coordsys"] = self.m_coordsys
  420 + bkgcube["proj"] = self.m_proj
421 bkgcube.run() 421 bkgcube.run()
422 422
423 # Set new binned observation 423 # Set new binned observation
@@ -475,8 +475,8 @@ class csspec(ctools.cscript): @@ -475,8 +475,8 @@ class csspec(ctools.cscript):
475 475
476 # Create upper limit object 476 # Create upper limit object
477 ulimit = ctools.ctulimit(like.obs()) 477 ulimit = ctools.ctulimit(like.obs())
478 - ulimit["srcname"].string(self.m_srcname)  
479 - ulimit["eref"].real(elogmean.TeV()) 478 + ulimit["srcname"] = self.m_srcname
  479 + ulimit["eref"] = elogmean.TeV()
480 480
481 # Try to run upper limit and catch exceptions 481 # Try to run upper limit and catch exceptions
482 try: 482 try:
test/test_ctbin.py
@@ -64,19 +64,19 @@ class Test(gammalib.GPythonTestSuite): @@ -64,19 +64,19 @@ class Test(gammalib.GPythonTestSuite):
64 """ 64 """
65 # Set-up ctbin 65 # Set-up ctbin
66 bin = ctools.ctbin() 66 bin = ctools.ctbin()
67 - bin["inobs"].filename(self.events_name)  
68 - bin["outcube"].filename("cntmap.fits")  
69 - bin["ebinalg"].string("LOG")  
70 - bin["emin"].real(0.1)  
71 - bin["emax"].real(100.0)  
72 - bin["enumbins"].integer(20)  
73 - bin["nxpix"].integer(200)  
74 - bin["nypix"].integer(200)  
75 - bin["binsz"].real(0.02)  
76 - bin["coordsys"].string("CEL")  
77 - bin["proj"].string("CAR")  
78 - bin["xref"].real(83.63)  
79 - bin["yref"].real(22.01) 67 + bin["inobs"] = self.events_name
  68 + bin["outcube"] = "cntmap.fits"
  69 + bin["ebinalg"] = "LOG"
  70 + bin["emin"] = 0.1
  71 + bin["emax"] = 100.0
  72 + bin["enumbins"] = 20
  73 + bin["nxpix"] = 200
  74 + bin["nypix"] = 200
  75 + bin["binsz"] = 0.02
  76 + bin["coordsys"] = "CEL"
  77 + bin["proj"] = "CAR"
  78 + bin["xref"] = 83.63
  79 + bin["yref"] = 22.01
80 80
81 # Run tool 81 # Run tool
82 self.test_try("Run ctbin") 82 self.test_try("Run ctbin")
test/test_ctbkgcube.py
@@ -67,24 +67,24 @@ class Test(gammalib.GPythonTestSuite): @@ -67,24 +67,24 @@ class Test(gammalib.GPythonTestSuite):
67 """ 67 """
68 # Set-up ctbkgcube 68 # Set-up ctbkgcube
69 bkgcube = ctools.ctbkgcube() 69 bkgcube = ctools.ctbkgcube()
70 - bkgcube["inobs"].filename(self.events_name)  
71 - bkgcube["inmodel"].filename(self.bkg_model)  
72 - bkgcube["incube"].filename("NONE")  
73 - bkgcube["outcube"].filename("bkgcube.fits")  
74 - bkgcube["outmodel"].filename("bkgcube.xml")  
75 - bkgcube["caldb"].string(self.caldb)  
76 - bkgcube["irf"].string(self.irf)  
77 - bkgcube["ebinalg"].string("LOG")  
78 - bkgcube["emin"].real(0.1)  
79 - bkgcube["emax"].real(100.0)  
80 - bkgcube["enumbins"].integer(20)  
81 - bkgcube["nxpix"].integer(10)  
82 - bkgcube["nypix"].integer(10)  
83 - bkgcube["binsz"].real(0.4)  
84 - bkgcube["coordsys"].string("CEL")  
85 - bkgcube["proj"].string("CAR")  
86 - bkgcube["xref"].real(83.63)  
87 - bkgcube["yref"].real(22.01) 70 + bkgcube["inobs"] = self.events_name
  71 + bkgcube["inmodel"] = self.bkg_model
  72 + bkgcube["incube"] = "NONE"
  73 + bkgcube["outcube"] = "bkgcube.fits"
  74 + bkgcube["outmodel"] = "bkgcube.xml"
  75 + bkgcube["caldb"] = self.caldb
  76 + bkgcube["irf"] = self.irf
  77 + bkgcube["ebinalg"] = "LOG"
  78 + bkgcube["emin"] = 0.1
  79 + bkgcube["emax"] = 100
  80 + bkgcube["enumbins"] = 20
  81 + bkgcube["nxpix"] = 10
  82 + bkgcube["nypix"] = 10
  83 + bkgcube["binsz"] = 0.4
  84 + bkgcube["coordsys"] = "CEL"
  85 + bkgcube["proj"] = "CAR"
  86 + bkgcube["xref"] = 83.63
  87 + bkgcube["yref"] = 22.01
88 88
89 # Run tool 89 # Run tool
90 self.test_try("Run ctbkgcube") 90 self.test_try("Run ctbkgcube")
test/test_ctbutterfly.py
@@ -67,14 +67,14 @@ class Test(gammalib.GPythonTestSuite): @@ -67,14 +67,14 @@ class Test(gammalib.GPythonTestSuite):
67 """ 67 """
68 # Set-up ctbutterfly 68 # Set-up ctbutterfly
69 butterfly = ctools.ctbutterfly() 69 butterfly = ctools.ctbutterfly()
70 - butterfly["inobs"].filename(self.events_name)  
71 - butterfly["inmodel"].filename(self.model_name)  
72 - butterfly["srcname"].string("Crab")  
73 - butterfly["caldb"].string(self.caldb)  
74 - butterfly["irf"].string(self.irf)  
75 - butterfly["emin"].real(0.1)  
76 - butterfly["emax"].real(100)  
77 - butterfly["outfile"].filename("butterfly.txt") 70 + butterfly["inobs"] = self.events_name
  71 + butterfly["inmodel"] = self.model_name
  72 + butterfly["srcname"] = "Crab"
  73 + butterfly["caldb"] = self.caldb
  74 + butterfly["irf"] = self.irf
  75 + butterfly["emin"] = 0.1
  76 + butterfly["emax"] = 100
  77 + butterfly["outfile"] = "butterfly.txt"
78 78
79 # Run tool 79 # Run tool
80 self.test_try("Run ctbutterfly") 80 self.test_try("Run ctbutterfly")
test/test_ctcubemask.py
@@ -65,14 +65,14 @@ class Test(gammalib.GPythonTestSuite): @@ -65,14 +65,14 @@ class Test(gammalib.GPythonTestSuite):
65 """ 65 """
66 # Set-up ctcubemask 66 # Set-up ctcubemask
67 mask = ctools.ctcubemask() 67 mask = ctools.ctcubemask()
68 - mask["inobs"].filename(self.cntmap_name)  
69 - mask["regfile"].filename(self.regfile)  
70 - mask["outcube"].filename("filtered_cntmap.fits")  
71 - mask["ra"].real(83.63)  
72 - mask["dec"].real(22.01)  
73 - mask["rad"].real(2.0)  
74 - mask["emin"].real(0.1)  
75 - mask["emax"].real(100.0) 68 + mask["inobs"] = self.cntmap_name
  69 + mask["regfile"] = self.regfile
  70 + mask["outcube"] = "filtered_cntmap.fits"
  71 + mask["ra"] = 83.63
  72 + mask["dec"] = 22.01
  73 + mask["rad"] = 2.0
  74 + mask["emin"] = 0.1
  75 + mask["emax"] = 100
76 76
77 # Run tool 77 # Run tool
78 self.test_try("Run ctcubemask") 78 self.test_try("Run ctcubemask")
test/test_ctexpcube.py
@@ -66,22 +66,22 @@ class Test(gammalib.GPythonTestSuite): @@ -66,22 +66,22 @@ class Test(gammalib.GPythonTestSuite):
66 """ 66 """
67 # Set-up ctexpcube 67 # Set-up ctexpcube
68 expcube = ctools.ctexpcube() 68 expcube = ctools.ctexpcube()
69 - expcube["inobs"].filename(self.events_name)  
70 - expcube["incube"].filename("NONE")  
71 - expcube["outcube"].filename("expcube.fits")  
72 - expcube["caldb"].string(self.caldb)  
73 - expcube["irf"].string(self.irf)  
74 - expcube["ebinalg"].string("LOG")  
75 - expcube["emin"].real(0.1)  
76 - expcube["emax"].real(100.0)  
77 - expcube["enumbins"].integer(20)  
78 - expcube["nxpix"].integer(200)  
79 - expcube["nypix"].integer(200)  
80 - expcube["binsz"].real(0.02)  
81 - expcube["coordsys"].string("CEL")  
82 - expcube["proj"].string("CAR")  
83 - expcube["xref"].real(83.63)  
84 - expcube["yref"].real(22.01) 69 + expcube["inobs"] = self.events_name
  70 + expcube["incube"] = "NONE"
  71 + expcube["outcube"] = "expcube.fits"
  72 + expcube["caldb"] = self.caldb
  73 + expcube["irf"] = self.irf
  74 + expcube["ebinalg"] = "LOG"
  75 + expcube["emin"] = 0.1
  76 + expcube["emax"] = 100
  77 + expcube["enumbins"] = 20
  78 + expcube["nxpix"] = 200
  79 + expcube["nypix"] = 200
  80 + expcube["binsz"] = 0.02
  81 + expcube["coordsys"] = "CEL"
  82 + expcube["proj"] = "CAR"
  83 + expcube["xref"] = 83.63
  84 + expcube["yref"] = 22.01
85 85
86 # Run tool 86 # Run tool
87 self.test_try("Run ctexpcube") 87 self.test_try("Run ctexpcube")
test/test_ctmodel.py
@@ -66,30 +66,30 @@ class Test(gammalib.GPythonTestSuite): @@ -66,30 +66,30 @@ class Test(gammalib.GPythonTestSuite):
66 """ 66 """
67 # Set-up ctmodel from scratch 67 # Set-up ctmodel from scratch
68 model = ctools.ctmodel() 68 model = ctools.ctmodel()
69 - model["incube"].filename("NONE")  
70 - model["outcube"].filename("modmap.fits")  
71 - model["inmodel"].filename(self.model_name)  
72 - model["inobs"].filename("NONE")  
73 - model["expcube"].filename("NONE")  
74 - model["psfcube"].filename("NONE")  
75 - model["bkgcube"].filename("NONE")  
76 - model["caldb"].string(self.caldb)  
77 - model["irf"].string(self.irf)  
78 - model["rad"].real(5.0)  
79 - model["ra"].real(83.63)  
80 - model["dec"].real(22.01)  
81 - model["tmin"].real(0.0)  
82 - model["tmax"].real(1800.0)  
83 - model["emin"].real(0.1)  
84 - model["emax"].real(100.0)  
85 - model["enumbins"].integer(20)  
86 - model["nxpix"].integer(200)  
87 - model["nypix"].integer(200)  
88 - model["binsz"].real(0.02)  
89 - model["coordsys"].string("CEL")  
90 - model["proj"].string("CAR")  
91 - model["xref"].real(83.63)  
92 - model["yref"].real(22.01) 69 + model["incube"] = "NONE"
  70 + model["outcube"] = "modmap.fits"
  71 + model["inmodel"] = self.model_name
  72 + model["inobs"] = "NONE"
  73 + model["expcube"] = "NONE"
  74 + model["psfcube"] = "NONE"
  75 + model["bkgcube"] = "NONE"
  76 + model["caldb"] = self.caldb
  77 + model["irf"] = self.irf
  78 + model["rad"] = 5
  79 + model["ra"] = 83.63
  80 + model["dec"] = 22.01
  81 + model["tmin"] = 0
  82 + model["tmax"] = 1800
  83 + model["emin"] = 0.1
  84 + model["emax"] = 100
  85 + model["enumbins"] = 20
  86 + model["nxpix"] = 200
  87 + model["nypix"] = 200
  88 + model["binsz"] = 0.02
  89 + model["coordsys"] = "CEL"
  90 + model["proj"] = "CAR"
  91 + model["xref"] = 83.63
  92 + model["yref"] = 22.01
93 93
94 # Run tool 94 # Run tool
95 self.test_try("Run ctmodel") 95 self.test_try("Run ctmodel")
test/test_ctobssim.py
@@ -67,17 +67,17 @@ class Test(gammalib.GPythonTestSuite): @@ -67,17 +67,17 @@ class Test(gammalib.GPythonTestSuite):
67 """ 67 """
68 # Set-up ctobssim 68 # Set-up ctobssim
69 sim = ctools.ctobssim() 69 sim = ctools.ctobssim()
70 - sim["inmodel"].filename(self.model_name)  
71 - sim["outevents"].filename("events.fits")  
72 - sim["caldb"].string(self.caldb)  
73 - sim["irf"].string(self.irf)  
74 - sim["ra"].real(83.63)  
75 - sim["dec"].real(22.01)  
76 - sim["rad"].real(10.0)  
77 - sim["tmin"].real(0.0)  
78 - sim["tmax"].real(1800.0)  
79 - sim["emin"].real(0.1)  
80 - sim["emax"].real(100.0) 70 + sim["inmodel"] = self.model_name
  71 + sim["outevents"] = "events.fits"
  72 + sim["caldb"] = self.caldb
  73 + sim["irf"] = self.irf
  74 + sim["ra"] = 83.63
  75 + sim["dec"] = 22.01
  76 + sim["rad"] = 10.0
  77 + sim["tmin"] = 0.0
  78 + sim["tmax"] = 1800.0
  79 + sim["emin"] = 0.1
  80 + sim["emax"] = 100.0
81 81
82 # Run tool 82 # Run tool
83 self.test_try("Run ctobssim") 83 self.test_try("Run ctobssim")
@@ -117,8 +117,8 @@ class Test(gammalib.GPythonTestSuite): @@ -117,8 +117,8 @@ class Test(gammalib.GPythonTestSuite):
117 117
118 # Set-up ctobssim 118 # Set-up ctobssim
119 sim = ctools.ctobssim(obs) 119 sim = ctools.ctobssim(obs)
120 - sim["outevents"].filename("sim_events.xml")  
121 - sim["inmodel"].filename(self.model_name) 120 + sim["outevents"] = "sim_events.xml"
  121 + sim["inmodel"] = self.model_name
122 # Run tool 122 # Run tool
123 self.test_try("Run ctobssim") 123 self.test_try("Run ctobssim")
124 try: 124 try:
test/test_ctpsfcube.py
@@ -66,24 +66,24 @@ class Test(gammalib.GPythonTestSuite): @@ -66,24 +66,24 @@ class Test(gammalib.GPythonTestSuite):
66 """ 66 """
67 # Set-up ctpsfcube 67 # Set-up ctpsfcube
68 psfcube = ctools.ctpsfcube() 68 psfcube = ctools.ctpsfcube()
69 - psfcube["inobs"].filename(self.events_name)  
70 - psfcube["incube"].filename("NONE")  
71 - psfcube["outcube"].filename("psfcube.fits")  
72 - psfcube["caldb"].string(self.caldb)  
73 - psfcube["irf"].string(self.irf)  
74 - psfcube["ebinalg"].string("LOG")  
75 - psfcube["emin"].real(0.1)  
76 - psfcube["emax"].real(100.0)  
77 - psfcube["enumbins"].integer(20)  
78 - psfcube["nxpix"].integer(10)  
79 - psfcube["nypix"].integer(10)  
80 - psfcube["binsz"].real(0.4)  
81 - psfcube["coordsys"].string("CEL")  
82 - psfcube["proj"].string("CAR")  
83 - psfcube["xref"].real(83.63)  
84 - psfcube["yref"].real(22.01)  
85 - psfcube["amax"].real(0.3)  
86 - psfcube["anumbins"].integer(10) 69 + psfcube["inobs"] = self.events_name
  70 + psfcube["incube"] = "NONE"
  71 + psfcube["outcube"] = "psfcube.fits"
  72 + psfcube["caldb"] = self.caldb
  73 + psfcube["irf"] = self.irf
  74 + psfcube["ebinalg"] = "LOG"
  75 + psfcube["emin"] = 0.1
  76 + psfcube["emax"] = 100
  77 + psfcube["enumbins"] = 20
  78 + psfcube["nxpix"] = 10
  79 + psfcube["nypix"] = 10
  80 + psfcube["binsz"] = 0.4
  81 + psfcube["coordsys"] = "CEL"
  82 + psfcube["proj"] = "CAR"
  83 + psfcube["xref"] = 83.63
  84 + psfcube["yref"] = 22.01
  85 + psfcube["amax"] = 0.3
  86 + psfcube["anumbins"] = 10
87 87
88 # Run tool 88 # Run tool
89 self.test_try("Run ctpsfcube") 89 self.test_try("Run ctpsfcube")
test/test_ctselect.py
@@ -64,15 +64,15 @@ class Test(gammalib.GPythonTestSuite): @@ -64,15 +64,15 @@ class Test(gammalib.GPythonTestSuite):
64 """ 64 """
65 # Set-up ctselect 65 # Set-up ctselect
66 select = ctools.ctselect() 66 select = ctools.ctselect()
67 - select["inobs"].filename(self.events_name)  
68 - select["outobs"].filename("selected_events.fits")  
69 - select["ra"].real(83.63)  
70 - select["dec"].real(22.01)  
71 - select["rad"].real(3.0)  
72 - select["tmin"].real(0.0)  
73 - select["tmax"].real(1800.0)  
74 - select["emin"].real(0.1)  
75 - select["emax"].real(100.0) 67 + select["inobs"] = self.events_name
  68 + select["outobs"] = "selected_events.fits"
  69 + select["ra"] = 83.63
  70 + select["dec"] = 22.01
  71 + select["rad"] = 3
  72 + select["tmin"] = 0
  73 + select["tmax"] = 1800
  74 + select["emin"] = 0.1
  75 + select["emax"] = 100
76 76
77 # Run tool 77 # Run tool
78 self.test_try("Run ctselect") 78 self.test_try("Run ctselect")
test/test_ctskymap.py
@@ -64,17 +64,17 @@ class Test(gammalib.GPythonTestSuite): @@ -64,17 +64,17 @@ class Test(gammalib.GPythonTestSuite):
64 """ 64 """
65 # Set-up ctskymap 65 # Set-up ctskymap
66 skymap = ctools.ctskymap() 66 skymap = ctools.ctskymap()
67 - skymap["inobs"].filename(self.events_name)  
68 - skymap["outmap"].filename("skymap.fits")  
69 - skymap["emin"].real(0.1)  
70 - skymap["emax"].real(100.0)  
71 - skymap["nxpix"].integer(200)  
72 - skymap["nypix"].integer(200)  
73 - skymap["binsz"].real(0.02)  
74 - skymap["coordsys"].string("CEL")  
75 - skymap["proj"].string("CAR")  
76 - skymap["xref"].real(83.63)  
77 - skymap["yref"].real(22.01) 67 + skymap["inobs"] = self.events_name
  68 + skymap["outmap"] = "skymap.fits"
  69 + skymap["emin"] = 0.1
  70 + skymap["emax"] = 100
  71 + skymap["nxpix"] = 200
  72 + skymap["nypix"] = 200
  73 + skymap["binsz"] = 0.02
  74 + skymap["coordsys"] = "CEL"
  75 + skymap["proj"] = "CAR"
  76 + skymap["xref"] = 83.63
  77 + skymap["yref"] = 22.01
78 78
79 # Run tool 79 # Run tool
80 self.test_try("Run ctskymap") 80 self.test_try("Run ctskymap")
test/test_cttsmap.py
@@ -67,19 +67,19 @@ class Test(gammalib.GPythonTestSuite): @@ -67,19 +67,19 @@ class Test(gammalib.GPythonTestSuite):
67 """ 67 """
68 # Set-up cttsmap 68 # Set-up cttsmap
69 tsmap = ctools.cttsmap() 69 tsmap = ctools.cttsmap()
70 - tsmap["inobs"].filename(self.events_name)  
71 - tsmap["inmodel"].filename(self.model_name)  
72 - tsmap["srcname"].string("Crab")  
73 - tsmap["caldb"].string(self.caldb)  
74 - tsmap["irf"].string(self.irf)  
75 - tsmap["outmap"].filename("tsmap.fits")  
76 - tsmap["nxpix"].integer(5)  
77 - tsmap["nypix"].integer(5)  
78 - tsmap["binsz"].real(0.02)  
79 - tsmap["coordsys"].string("CEL")  
80 - tsmap["proj"].string("CAR")  
81 - tsmap["xref"].real(83.63)  
82 - tsmap["yref"].real(22.01) 70 + tsmap["inobs"] = self.events_name
  71 + tsmap["inmodel"] = self.model_name
  72 + tsmap["srcname"] = "Crab"
  73 + tsmap["caldb"] = self.caldb
  74 + tsmap["irf"] = self.irf
  75 + tsmap["outmap"] = "tsmap.fits"
  76 + tsmap["nxpix"] = 5
  77 + tsmap["nypix"] = 5
  78 + tsmap["binsz"] = 0.02
  79 + tsmap["coordsys"] = "CEL"
  80 + tsmap["proj"] = "CAR"
  81 + tsmap["xref"] = 83.63
  82 + tsmap["yref"] = 22.01
83 83
84 # Run tool 84 # Run tool
85 self.test_try("Run cttsmap") 85 self.test_try("Run cttsmap")
test/test_pipelines.py
@@ -78,17 +78,17 @@ class Test(gammalib.GPythonTestSuite): @@ -78,17 +78,17 @@ class Test(gammalib.GPythonTestSuite):
78 78
79 # Simulate events 79 # Simulate events
80 sim = ctools.ctobssim() 80 sim = ctools.ctobssim()
81 - sim["inmodel"].filename(model_name)  
82 - sim["outevents"].filename(events_name)  
83 - sim["caldb"].string(caldb)  
84 - sim["irf"].string(irf)  
85 - sim["ra"].real(ra)  
86 - sim["dec"].real(dec)  
87 - sim["rad"].real(rad_sim)  
88 - sim["tmin"].real(tstart)  
89 - sim["tmax"].real(tstop)  
90 - sim["emin"].real(emin)  
91 - sim["emax"].real(emax) 81 + sim["inmodel"] = model_name
  82 + sim["outevents"] = events_name
  83 + sim["caldb"] = caldb
  84 + sim["irf"] = irf
  85 + sim["ra"] = ra
  86 + sim["dec"] = dec
  87 + sim["rad"] = rad_sim
  88 + sim["tmin"] = tstart
  89 + sim["tmax"] = tstop
  90 + sim["emin"] = emin
  91 + sim["emax"] = emax
92 self.test_try("Execute ctobssim") 92 self.test_try("Execute ctobssim")
93 try: 93 try:
94 sim.execute() 94 sim.execute()
@@ -98,15 +98,15 @@ class Test(gammalib.GPythonTestSuite): @@ -98,15 +98,15 @@ class Test(gammalib.GPythonTestSuite):
98 98
99 # Select events 99 # Select events
100 select = ctools.ctselect() 100 select = ctools.ctselect()
101 - select["inobs"].filename(events_name)  
102 - select["outobs"].filename(selected_events_name)  
103 - select["ra"].real(ra)  
104 - select["dec"].real(dec)  
105 - select["rad"].real(rad_select)  
106 - select["tmin"].real(tstart)  
107 - select["tmax"].real(tstop)  
108 - select["emin"].real(emin)  
109 - select["emax"].real(emax) 101 + select["inobs"] = events_name
  102 + select["outobs"] = selected_events_name
  103 + select["ra"] = ra
  104 + select["dec"] = dec
  105 + select["rad"] = rad_select
  106 + select["tmin"] = tstart
  107 + select["tmax"] = tstop
  108 + select["emin"] = emin
  109 + select["emax"] = emax
110 self.test_try("Execute ctselect") 110 self.test_try("Execute ctselect")
111 try: 111 try:
112 select.execute() 112 select.execute()
@@ -116,11 +116,11 @@ class Test(gammalib.GPythonTestSuite): @@ -116,11 +116,11 @@ class Test(gammalib.GPythonTestSuite):
116 116
117 # Perform maximum likelihood fitting 117 # Perform maximum likelihood fitting
118 like = ctools.ctlike() 118 like = ctools.ctlike()
119 - like["inobs"].filename(selected_events_name)  
120 - like["inmodel"].filename(model_name)  
121 - like["outmodel"].filename(result_name)  
122 - like["caldb"].string(caldb)  
123 - like["irf"].string(irf) 119 + like["inobs"] = selected_events_name
  120 + like["inmodel"] = model_name
  121 + like["outmodel"] = result_name
  122 + like["caldb"] = caldb
  123 + like["irf"] = irf
124 self.test_try("Execute ctlike") 124 self.test_try("Execute ctlike")
125 try: 125 try:
126 like.execute() 126 like.execute()
@@ -149,16 +149,16 @@ class Test(gammalib.GPythonTestSuite): @@ -149,16 +149,16 @@ class Test(gammalib.GPythonTestSuite):
149 149
150 # Simulate events 150 # Simulate events
151 sim = ctools.ctobssim() 151 sim = ctools.ctobssim()
152 - sim["inmodel"].filename(model_name)  
153 - sim["caldb"].string(caldb)  
154 - sim["irf"].string(irf)  
155 - sim["ra"].real(ra)  
156 - sim["dec"].real(dec)  
157 - sim["rad"].real(rad_sim)  
158 - sim["tmin"].real(tstart)  
159 - sim["tmax"].real(tstop)  
160 - sim["emin"].real(emin)  
161 - sim["emax"].real(emax) 152 + sim["inmodel"] = model_name
  153 + sim["caldb"] = caldb
  154 + sim["irf"] = irf
  155 + sim["ra"] = ra
  156 + sim["dec"] = dec
  157 + sim["rad"] = rad_sim
  158 + sim["tmin"] = tstart
  159 + sim["tmax"] = tstop
  160 + sim["emin"] = emin
  161 + sim["emax"] = emax
162 self.test_try("Run ctobssim") 162 self.test_try("Run ctobssim")
163 try: 163 try:
164 sim.run() 164 sim.run()
@@ -168,13 +168,13 @@ class Test(gammalib.GPythonTestSuite): @@ -168,13 +168,13 @@ class Test(gammalib.GPythonTestSuite):
168 168
169 # Select events 169 # Select events
170 select = ctools.ctselect(sim.obs()) 170 select = ctools.ctselect(sim.obs())
171 - select["ra"].real(ra)  
172 - select["dec"].real(dec)  
173 - select["rad"].real(rad_select)  
174 - select["tmin"].real(tstart)  
175 - select["tmax"].real(tstop)  
176 - select["emin"].real(emin)  
177 - select["emax"].real(emax) 171 + select["ra"] = ra
  172 + select["dec"] = dec
  173 + select["rad"] = rad_select
  174 + select["tmin"] = tstart
  175 + select["tmax"] = tstop
  176 + select["emin"] = emin
  177 + select["emax"] = emax
178 self.test_try("Run ctselect") 178 self.test_try("Run ctselect")
179 try: 179 try:
180 select.run() 180 select.run()