Commit d2ce573f21f4573cf3785cdbff3b5ce28d173b4b

Authored by Jürgen Knödlseder
2 parents a552305f 77f1091b

Merge branch '1828-enhance-code-quality' into integration

cscripts/cssens.py
@@ -373,7 +373,17 @@ class cssens(ctools.cscript): @@ -373,7 +373,17 @@ class cssens(ctools.cscript):
373 logL = fit.opt().value() 373 logL = fit.opt().value()
374 npred = fit.obs().npred() 374 npred = fit.obs().npred()
375 models = fit.obs().models() 375 models = fit.obs().models()
376 - ts = models[self._srcname].ts() 376 + source = models[self._srcname]
  377 + ts = source.ts()
  378 +
  379 + # Get fitted Crab, photon and energy fluxes
  380 + crab_flux = source['Prefactor'].value() / crab_prefactor
  381 + photon_flux = source.spectral().flux(emin, emax)
  382 + energy_flux = source.spectral().eflux(emin, emax)
  383 +
  384 + # Compute differential sensitivity in unit erg/cm2/s
  385 + energy = gammalib.GEnergy(e_mean, 'TeV')
  386 + sensitivity = source.spectral().eval(energy) * e_mean*erg_mean * 1.0e6
377 387
378 # Assess quality based on a comparison between Npred and Nevents 388 # Assess quality based on a comparison between Npred and Nevents
379 quality = npred - nevents 389 quality = npred - nevents
@@ -400,27 +410,30 @@ class cssens(ctools.cscript): @@ -400,27 +410,30 @@ class cssens(ctools.cscript):
400 for par in model: 410 for par in model:
401 self._log(str(par)+'\n') 411 self._log(str(par)+'\n')
402 412
403 - # Start over if TS was non-positive 413 + # If TS was non-positive then increase the test flux and start
  414 + # over
404 if ts <= 0.0: 415 if ts <= 0.0:
405 - if self._logExplicit():  
406 - self._log('Non positive TS. Start over.\n')  
407 - continue  
408 416
409 - # Get fitted Crab, photon and energy fluxes  
410 - crab_flux = models[self._srcname]['Prefactor'].value() / \  
411 - crab_prefactor  
412 - photon_flux = models[self._srcname].spectral().flux(emin, emax)  
413 - energy_flux = models[self._srcname].spectral().eflux(emin, emax) 417 + # If the number of iterations was exceeded then stop
  418 + if (iterations >= self._max_iter):
  419 + if self._logTerse():
  420 + self._log(' Test ended after %d iterations.\n' %
  421 + self._max_iter)
  422 + break
414 423
415 - # Compute differential sensitivity in unit erg/cm2/s  
416 - energy = gammalib.GEnergy(e_mean, 'TeV')  
417 - sensitivity = models[self._srcname].spectral().eval(energy) * \  
418 - e_mean*erg_mean * 1.0e6 424 + # Increase test flux by a factor of 2
  425 + test_crab_flux = test_crab_flux * 2.0
  426 +
  427 + # Signal start we start over
  428 + if self._logExplicit():
  429 + self._log('Non positive TS, increase test flux and start '
  430 + 'over.\n')
  431 +
  432 + # ... and start over
  433 + continue
419 434
420 # Compute flux correction factor based on average TS 435 # Compute flux correction factor based on average TS
421 - correct = 1.0  
422 - if ts > 0:  
423 - correct = math.sqrt(self._ts_thres/ts) 436 + correct = math.sqrt(self._ts_thres/ts)
424 437
425 # Compute extrapolated fluxes 438 # Compute extrapolated fluxes
426 crab_flux = correct * crab_flux 439 crab_flux = correct * crab_flux
@@ -432,7 +445,7 @@ class cssens(ctools.cscript): @@ -432,7 +445,7 @@ class cssens(ctools.cscript):
432 energy_flux_value.append(energy_flux) 445 energy_flux_value.append(energy_flux)
433 sensitivity_value.append(sensitivity) 446 sensitivity_value.append(sensitivity)
434 447
435 - # Write background and test source fit results 448 + # Write fit results
436 if self._logExplicit(): 449 if self._logExplicit():
437 self._log.parformat('Photon flux') 450 self._log.parformat('Photon flux')
438 self._log(photon_flux) 451 self._log(photon_flux)
@@ -453,7 +466,7 @@ class cssens(ctools.cscript): @@ -453,7 +466,7 @@ class cssens(ctools.cscript):
453 for par in model: 466 for par in model:
454 self._log(str(par)+'\n') 467 self._log(str(par)+'\n')
455 elif self._logTerse(): 468 elif self._logTerse():
456 - self._log.parformat('Iteration '+str(iterations)) 469 + self._log.parformat('Iteration %d' % iterations)
457 self._log('TS=') 470 self._log('TS=')
458 self._log(ts) 471 self._log(ts)
459 self._log(' ') 472 self._log(' ')
@@ -589,7 +602,19 @@ class cssens(ctools.cscript): @@ -589,7 +602,19 @@ class cssens(ctools.cscript):
589 results = [] 602 results = []
590 603
591 # Set test source model for this observation 604 # Set test source model for this observation
592 - models = modutils.test_source(self._obs.models(), self._srcname) 605 + models = modutils.test_source(self._obs.models(), self._srcname,
  606 + ra=self._ra, dec=self._dec)
  607 +
  608 + # Write observations into logger
  609 + if self._logTerse():
  610 + self._log('\n')
  611 + self._log.header1(gammalib.number('Observation',len(self._obs)))
  612 + self._log(str(self._obs))
  613 + self._log('\n')
  614 + if self._logExplicit():
  615 + for obs in self._obs:
  616 + self._log(str(obs))
  617 + self._log('\n')
593 618
594 # Write models into logger 619 # Write models into logger
595 if self._logTerse(): 620 if self._logTerse():
examples/pipeline_binned_disk.py
@@ -155,4 +155,5 @@ if __name__ == &#39;__main__&#39;: @@ -155,4 +155,5 @@ if __name__ == &#39;__main__&#39;:
155 obs.models(gammalib.GModels(datadir+'/crab.xml')) 155 obs.models(gammalib.GModels(datadir+'/crab.xml'))
156 156
157 # Run analysis pipeline 157 # Run analysis pipeline
158 - run_pipeline(obs, model=datadir+'/crab.xml') 158 + run_pipeline(obs, model=datadir+'/crab.xml', enumbins=10, nxpix=40,
  159 + nypix=40, binsz=0.1)
examples/pipeline_binned_mem.py
@@ -126,4 +126,4 @@ if __name__ == &#39;__main__&#39;: @@ -126,4 +126,4 @@ if __name__ == &#39;__main__&#39;:
126 obs.models(gammalib.GModels(datadir+'/crab.xml')) 126 obs.models(gammalib.GModels(datadir+'/crab.xml'))
127 127
128 # Run analysis pipeline 128 # Run analysis pipeline
129 - run_pipeline(obs) 129 + run_pipeline(obs, enumbins=10, nxpix=40, nypix=40, binsz=0.1)
examples/pipeline_stacked_disk.py
@@ -205,4 +205,5 @@ if __name__ == &#39;__main__&#39;: @@ -205,4 +205,5 @@ if __name__ == &#39;__main__&#39;:
205 obs.models(gammalib.GModels(datadir+'/crab.xml')) 205 obs.models(gammalib.GModels(datadir+'/crab.xml'))
206 206
207 # Run analysis pipeline 207 # Run analysis pipeline
208 - run_pipeline(obs, model=datadir+'/crab.xml') 208 + run_pipeline(obs, model=datadir+'/crab.xml', enumbins=10, nxpix=40,
  209 + nypix=40, binsz=0.1)
examples/pipeline_stacked_mem.py
@@ -178,4 +178,4 @@ if __name__ == &#39;__main__&#39;: @@ -178,4 +178,4 @@ if __name__ == &#39;__main__&#39;:
178 obs.models(gammalib.GModels(datadir+'/crab.xml')) 178 obs.models(gammalib.GModels(datadir+'/crab.xml'))
179 179
180 # Run analysis pipeline 180 # Run analysis pipeline
181 - run_pipeline(obs) 181 + run_pipeline(obs, enumbins=10, nxpix=40, nypix=40, binsz=0.1)
test/test_cspull.py
@@ -146,7 +146,7 @@ class Test(test): @@ -146,7 +146,7 @@ class Test(test):
146 pull = cscripts.cspull() 146 pull = cscripts.cspull()
147 pull['inmodel'] = self._model 147 pull['inmodel'] = self._model
148 pull['outfile'] = 'cspull_py2.dat' 148 pull['outfile'] = 'cspull_py2.dat'
149 - pull['ntrials'] = 2 149 + pull['ntrials'] = 1
150 pull['caldb'] = self._caldb 150 pull['caldb'] = self._caldb
151 pull['irf'] = self._irf 151 pull['irf'] = self._irf
152 pull['ra'] = 83.6331 152 pull['ra'] = 83.6331
@@ -157,8 +157,8 @@ class Test(test): @@ -157,8 +157,8 @@ class Test(test):
157 pull['tmax'] = 100.0 157 pull['tmax'] = 100.0
158 pull['deadc'] = 0.95 158 pull['deadc'] = 0.95
159 pull['rad'] = 5.0 159 pull['rad'] = 5.0
160 - pull['npix'] = 100  
161 - pull['binsz'] = 0.02 160 + pull['npix'] = 20
  161 + pull['binsz'] = 0.2
162 pull['coordsys'] = 'CEL' 162 pull['coordsys'] = 'CEL'
163 pull['proj'] = 'TAN' 163 pull['proj'] = 'TAN'
164 pull['logfile'] = 'cspull_py2.log' 164 pull['logfile'] = 'cspull_py2.log'
@@ -168,14 +168,14 @@ class Test(test): @@ -168,14 +168,14 @@ class Test(test):
168 pull.execute() 168 pull.execute()
169 169
170 # Check pull distribution file 170 # Check pull distribution file
171 - self._check_pull_file('cspull_py2.dat') 171 + self._check_pull_file('cspull_py2.dat', rows=2)
172 172
173 # Set-up cspull from event list 173 # Set-up cspull from event list
174 pull = cscripts.cspull() 174 pull = cscripts.cspull()
175 pull['inobs'] = self._events 175 pull['inobs'] = self._events
176 pull['inmodel'] = self._model 176 pull['inmodel'] = self._model
177 pull['outfile'] = 'cspull_py3.dat' 177 pull['outfile'] = 'cspull_py3.dat'
178 - pull['ntrials'] = 2 178 + pull['ntrials'] = 1
179 pull['caldb'] = self._caldb 179 pull['caldb'] = self._caldb
180 pull['irf'] = self._irf 180 pull['irf'] = self._irf
181 pull['enumbins'] = 0 181 pull['enumbins'] = 0
@@ -186,7 +186,7 @@ class Test(test): @@ -186,7 +186,7 @@ class Test(test):
186 pull.execute() 186 pull.execute()
187 187
188 # Check pull distribution file 188 # Check pull distribution file
189 - self._check_pull_file('cspull_py3.dat') 189 + self._check_pull_file('cspull_py3.dat', rows=2)
190 190
191 # Build observation container with unbinned observation 191 # Build observation container with unbinned observation
192 cta = gammalib.GCTAObservation(self._events) 192 cta = gammalib.GCTAObservation(self._events)
@@ -197,7 +197,7 @@ class Test(test): @@ -197,7 +197,7 @@ class Test(test):
197 pull = cscripts.cspull(obs) 197 pull = cscripts.cspull(obs)
198 pull['inmodel'] = self._model 198 pull['inmodel'] = self._model
199 pull['outfile'] = 'cspull_py4.dat' 199 pull['outfile'] = 'cspull_py4.dat'
200 - pull['ntrials'] = 2 200 + pull['ntrials'] = 1
201 pull['caldb'] = self._caldb 201 pull['caldb'] = self._caldb
202 pull['irf'] = self._irf 202 pull['irf'] = self._irf
203 pull['enumbins'] = 0 203 pull['enumbins'] = 0
@@ -208,7 +208,7 @@ class Test(test): @@ -208,7 +208,7 @@ class Test(test):
208 pull.execute() 208 pull.execute()
209 209
210 # Check pull distribution file 210 # Check pull distribution file
211 - self._check_pull_file('cspull_py4.dat') 211 + self._check_pull_file('cspull_py4.dat', rows=2)
212 212
213 # Set-up stacked cspull with one observation where response cubes 213 # Set-up stacked cspull with one observation where response cubes
214 # are specified in the input observation 214 # are specified in the input observation
@@ -216,7 +216,7 @@ class Test(test): @@ -216,7 +216,7 @@ class Test(test):
216 pull['inobs'] = self._inobs 216 pull['inobs'] = self._inobs
217 pull['inmodel'] = self._stacked_model 217 pull['inmodel'] = self._stacked_model
218 pull['outfile'] = 'cspull_py5.dat' 218 pull['outfile'] = 'cspull_py5.dat'
219 - pull['ntrials'] = 2 219 + pull['ntrials'] = 1
220 pull['enumbins'] = 0 220 pull['enumbins'] = 0
221 pull['logfile'] = 'cspull_py5.log' 221 pull['logfile'] = 'cspull_py5.log'
222 pull['chatter'] = 4 222 pull['chatter'] = 4
@@ -225,7 +225,7 @@ class Test(test): @@ -225,7 +225,7 @@ class Test(test):
225 pull.execute() 225 pull.execute()
226 226
227 # Check pull distribution file 227 # Check pull distribution file
228 - self._check_pull_file('cspull_py5.dat') 228 + self._check_pull_file('cspull_py5.dat', rows=2)
229 229
230 # Set-up stacked cspull with two observations from which response 230 # Set-up stacked cspull with two observations from which response
231 # cubes will be computed internally. The IRFs are also specified 231 # cubes will be computed internally. The IRFs are also specified
@@ -235,7 +235,7 @@ class Test(test): @@ -235,7 +235,7 @@ class Test(test):
235 pull['inobs'] = self._inobs_two 235 pull['inobs'] = self._inobs_two
236 pull['inmodel'] = self._model 236 pull['inmodel'] = self._model
237 pull['outfile'] = 'cspull_py6.dat' 237 pull['outfile'] = 'cspull_py6.dat'
238 - pull['ntrials'] = 2 238 + pull['ntrials'] = 1
239 pull['emin'] = 0.02 239 pull['emin'] = 0.02
240 pull['emax'] = 100.0 240 pull['emax'] = 100.0
241 pull['enumbins'] = 10 241 pull['enumbins'] = 10
@@ -250,13 +250,13 @@ class Test(test): @@ -250,13 +250,13 @@ class Test(test):
250 pull.execute() 250 pull.execute()
251 251
252 # Check pull distribution file 252 # Check pull distribution file
253 - self._check_pull_file('cspull_py6.dat') 253 + self._check_pull_file('cspull_py6.dat', rows=2)
254 254
255 # Return 255 # Return
256 return 256 return
257 257
258 # Check pull file 258 # Check pull file
259 - def _check_pull_file(self, filename): 259 + def _check_pull_file(self, filename, rows=3):
260 """ 260 """
261 Check pull file 261 Check pull file
262 """ 262 """
@@ -264,8 +264,8 @@ class Test(test): @@ -264,8 +264,8 @@ class Test(test):
264 pulls = gammalib.GCsv(filename) 264 pulls = gammalib.GCsv(filename)
265 265
266 # Check dimensions 266 # Check dimensions
267 - self.test_value(pulls.nrows(), 3,  
268 - 'Check for 3 rows in pull file') 267 + self.test_value(pulls.nrows(), rows,
  268 + 'Check for number of rows in pull file')
269 269
270 # Return 270 # Return
271 return 271 return
test/test_cssens.py
@@ -72,7 +72,7 @@ class Test(test): @@ -72,7 +72,7 @@ class Test(test):
72 cmd = cssens+' inmodel="'+self._model+'"'+ \ 72 cmd = cssens+' inmodel="'+self._model+'"'+ \
73 ' srcname="Crab"'+ \ 73 ' srcname="Crab"'+ \
74 ' caldb="'+self._caldb+'" irf="'+self._irf+'"'+ \ 74 ' caldb="'+self._caldb+'" irf="'+self._irf+'"'+ \
75 - ' duration=500.0 rad=3.0 emin=1.0 emax=10.0 bins=1'+ \ 75 + ' duration=1800.0 rad=3.0 emin=1.0 emax=10.0 bins=1'+ \
76 ' outfile="cssens_cmd1.dat"'+ \ 76 ' outfile="cssens_cmd1.dat"'+ \
77 ' logfile="cssens_cmd1.log" chatter=1' 77 ' logfile="cssens_cmd1.log" chatter=1'
78 78
@@ -91,7 +91,7 @@ class Test(test): @@ -91,7 +91,7 @@ class Test(test):
91 cmd = cssens+' inmodel="model_that_does_not_exist.xml"'+ \ 91 cmd = cssens+' inmodel="model_that_does_not_exist.xml"'+ \
92 ' srcname="Crab"'+ \ 92 ' srcname="Crab"'+ \
93 ' caldb="'+self._caldb+'" irf="'+self._irf+'"'+ \ 93 ' caldb="'+self._caldb+'" irf="'+self._irf+'"'+ \
94 - ' duration=500.0 rad=3.0 emin=1.0 emax=10.0 bins=1'+ \ 94 + ' duration=1800.0 rad=3.0 emin=1.0 emax=10.0 bins=1'+ \
95 ' outfile="cssens_cmd2.dat"'+ \ 95 ' outfile="cssens_cmd2.dat"'+ \
96 ' logfile="cssens_cmd2.log" chatter=2' 96 ' logfile="cssens_cmd2.log" chatter=2'
97 97
@@ -115,7 +115,7 @@ class Test(test): @@ -115,7 +115,7 @@ class Test(test):
115 sens['caldb'] = self._caldb 115 sens['caldb'] = self._caldb
116 sens['irf'] = self._irf 116 sens['irf'] = self._irf
117 sens['outfile'] = 'cssens_py1.dat' 117 sens['outfile'] = 'cssens_py1.dat'
118 - sens['duration'] = 500.0 118 + sens['duration'] = 1800.0
119 sens['rad'] = 3.0 119 sens['rad'] = 3.0
120 sens['emin'] = 1.0 120 sens['emin'] = 1.0
121 sens['emax'] = 10.0 121 sens['emax'] = 10.0
test/test_ctmapcube.py
@@ -71,8 +71,8 @@ class Test(test): @@ -71,8 +71,8 @@ class Test(test):
71 # Setup ctmapcube command 71 # Setup ctmapcube command
72 cmd = ctmapcube+' inmodel="'+self._model+'"'+ \ 72 cmd = ctmapcube+' inmodel="'+self._model+'"'+ \
73 ' outcube="ctmapcube_cmd1.fits"'+\ 73 ' outcube="ctmapcube_cmd1.fits"'+\
74 - ' emin=0.1 emax=100.0 enumbins=20 ebinalg=LOG'+ \  
75 - ' nxpix=200 nypix=200 binsz=0.02 coordsys=CEL'+ \ 74 + ' emin=0.1 emax=100.0 enumbins=10 ebinalg=LOG'+ \
  75 + ' nxpix=100 nypix=100 binsz=0.04 coordsys=CEL'+ \
76 ' xref=83.63 yref=22.01 proj=CAR'+ \ 76 ' xref=83.63 yref=22.01 proj=CAR'+ \
77 ' logfile="ctmapcube_cmd1.log" chatter=1' 77 ' logfile="ctmapcube_cmd1.log" chatter=1'
78 78
@@ -90,8 +90,8 @@ class Test(test): @@ -90,8 +90,8 @@ class Test(test):
90 # Setup ctmapcube command 90 # Setup ctmapcube command
91 cmd = ctmapcube+' inmodel="events_that_do_not_exist.fits"'+ \ 91 cmd = ctmapcube+' inmodel="events_that_do_not_exist.fits"'+ \
92 ' outcube="ctmapcube_cmd2.fits"'+\ 92 ' outcube="ctmapcube_cmd2.fits"'+\
93 - ' emin=0.1 emax=100.0 enumbins=20 ebinalg=LOG'+ \  
94 - ' nxpix=200 nypix=200 binsz=0.02 coordsys=CEL'+ \ 93 + ' emin=0.1 emax=100.0 enumbins=10 ebinalg=LOG'+ \
  94 + ' nxpix=100 nypix=100 binsz=0.04 coordsys=CEL'+ \
95 ' xref=83.63 yref=22.01 proj=CAR'+ \ 95 ' xref=83.63 yref=22.01 proj=CAR'+ \
96 ' logfile="ctmapcube_cmd2.log"' 96 ' logfile="ctmapcube_cmd2.log"'
97 97
@@ -114,10 +114,10 @@ class Test(test): @@ -114,10 +114,10 @@ class Test(test):
114 mapcube['ebinalg'] = 'LOG' 114 mapcube['ebinalg'] = 'LOG'
115 mapcube['emin'] = 0.1 115 mapcube['emin'] = 0.1
116 mapcube['emax'] = 100.0 116 mapcube['emax'] = 100.0
117 - mapcube['enumbins'] = 20  
118 - mapcube['nxpix'] = 200  
119 - mapcube['nypix'] = 200  
120 - mapcube['binsz'] = 0.02 117 + mapcube['enumbins'] = 10
  118 + mapcube['nxpix'] = 100
  119 + mapcube['nypix'] = 100
  120 + mapcube['binsz'] = 0.04
121 mapcube['coordsys'] = 'CEL' 121 mapcube['coordsys'] = 'CEL'
122 mapcube['proj'] = 'CAR' 122 mapcube['proj'] = 'CAR'
123 mapcube['xref'] = 83.63 123 mapcube['xref'] = 83.63
@@ -152,12 +152,12 @@ class Test(test): @@ -152,12 +152,12 @@ class Test(test):
152 cube = gammalib.GModelSpatialDiffuseCube(filename) 152 cube = gammalib.GModelSpatialDiffuseCube(filename)
153 153
154 # Test map cube 154 # Test map cube
155 - #self.test_value(cube.maps(), 20, "20 maps")  
156 - #self.test_value(cube.pixels(), 40000, "40000 map pixels") 155 + #self.test_value(cube.maps(), 10, "10 maps")
  156 + #self.test_value(cube.pixels(), 10000, "10000 map pixels")
157 # The map cube is not loaded by default !!!! We should add the method so that 157 # The map cube is not loaded by default !!!! We should add the method so that
158 # the attributes are known !!!! 158 # the attributes are known !!!!
159 - self.test_value(cube.maps(), 0, '20 maps')  
160 - self.test_value(cube.pixels(), 0, '40000 map pixels') 159 + self.test_value(cube.maps(), 0, '10 maps')
  160 + self.test_value(cube.pixels(), 0, '10000 map pixels')
161 161
162 # Return 162 # Return
163 return 163 return
test/test_cttsmap.py
@@ -69,7 +69,7 @@ class Test(test): @@ -69,7 +69,7 @@ class Test(test):
69 ' inmodel="'+self._model+'" srcname="Crab"'+ \ 69 ' inmodel="'+self._model+'" srcname="Crab"'+ \
70 ' caldb="'+self._caldb+'" irf="'+self._irf+'"'+ \ 70 ' caldb="'+self._caldb+'" irf="'+self._irf+'"'+ \
71 ' outmap="cttsmap_cmd1.fits"'+ \ 71 ' outmap="cttsmap_cmd1.fits"'+ \
72 - ' nxpix=5 nypix=5 binsz=0.02'+ \ 72 + ' nxpix=3 nypix=3 binsz=0.02'+ \
73 ' coordsys="CEL" proj="CAR" xref=83.63 yref=22.01'+ \ 73 ' coordsys="CEL" proj="CAR" xref=83.63 yref=22.01'+ \
74 ' logfile="cttsmap_cmd1.log" chatter=1' 74 ' logfile="cttsmap_cmd1.log" chatter=1'
75 75
@@ -89,7 +89,7 @@ class Test(test): @@ -89,7 +89,7 @@ class Test(test):
89 ' inmodel="'+self._model+'" srcname="Crab"'+ \ 89 ' inmodel="'+self._model+'" srcname="Crab"'+ \
90 ' caldb="'+self._caldb+'" irf="'+self._irf+'"'+ \ 90 ' caldb="'+self._caldb+'" irf="'+self._irf+'"'+ \
91 ' outmap="cttsmap_cmd2.fits"'+ \ 91 ' outmap="cttsmap_cmd2.fits"'+ \
92 - ' nxpix=5 nypix=5 binsz=0.02'+ \ 92 + ' nxpix=3 nypix=3 binsz=0.02'+ \
93 ' coordsys="CEL" proj="CAR" xref=83.63 yref=22.01'+ \ 93 ' coordsys="CEL" proj="CAR" xref=83.63 yref=22.01'+ \
94 ' logfile="cttsmap_cmd2.log" chatter=2' 94 ' logfile="cttsmap_cmd2.log" chatter=2'
95 95
@@ -113,8 +113,8 @@ class Test(test): @@ -113,8 +113,8 @@ class Test(test):
113 tsmap['caldb'] = self._caldb 113 tsmap['caldb'] = self._caldb
114 tsmap['irf'] = self._irf 114 tsmap['irf'] = self._irf
115 tsmap['outmap'] = 'cttsmap_py1.fits' 115 tsmap['outmap'] = 'cttsmap_py1.fits'
116 - tsmap['nxpix'] = 5  
117 - tsmap['nypix'] = 5 116 + tsmap['nxpix'] = 3
  117 + tsmap['nypix'] = 3
118 tsmap['binsz'] = 0.02 118 tsmap['binsz'] = 0.02
119 tsmap['coordsys'] = 'CEL' 119 tsmap['coordsys'] = 'CEL'
120 tsmap['proj'] = 'CAR' 120 tsmap['proj'] = 'CAR'
@@ -149,14 +149,14 @@ class Test(test): @@ -149,14 +149,14 @@ class Test(test):
149 149
150 # Check dimensions 150 # Check dimensions
151 self.test_value(ts.naxis(), 2, 'Check for 2 dimensions') 151 self.test_value(ts.naxis(), 2, 'Check for 2 dimensions')
152 - self.test_value(ts.naxes(0), 5, 'Check for 5 pixels in X')  
153 - self.test_value(ts.naxes(1), 5, 'Check for 5 pixels in Y') 152 + self.test_value(ts.naxes(0), 3, 'Check for 3 pixels in X')
  153 + self.test_value(ts.naxes(1), 3, 'Check for 3 pixels in Y')
154 self.test_value(prefactor.naxis(), 2, 'Check for 2 dimensions') 154 self.test_value(prefactor.naxis(), 2, 'Check for 2 dimensions')
155 - self.test_value(prefactor.naxes(0), 5, 'Check for 5 pixels in X')  
156 - self.test_value(prefactor.naxes(1), 5, 'Check for 5 pixels in Y') 155 + self.test_value(prefactor.naxes(0), 3, 'Check for 3 pixels in X')
  156 + self.test_value(prefactor.naxes(1), 3, 'Check for 3 pixels in Y')
157 self.test_value(index.naxis(), 2, 'Check for 2 dimensions') 157 self.test_value(index.naxis(), 2, 'Check for 2 dimensions')
158 - self.test_value(index.naxes(0), 5, 'Check for 5 pixels in X')  
159 - self.test_value(index.naxes(1), 5, 'Check for 5 pixels in Y') 158 + self.test_value(index.naxes(0), 3, 'Check for 3 pixels in X')
  159 + self.test_value(index.naxes(1), 3, 'Check for 3 pixels in Y')
160 160
161 # Return 161 # Return
162 return 162 return
test/test_examples.py.in
@@ -186,7 +186,7 @@ class Test(gammalib.GPythonTestSuite): @@ -186,7 +186,7 @@ class Test(gammalib.GPythonTestSuite):
186 Test make_ts_distributions 186 Test make_ts_distributions
187 """ 187 """
188 # Set arguments 188 # Set arguments
189 - args = '-n 2 -e 0 -t 1800 -d %s' % self._datadir 189 + args = '-n 1 -e 0 -t 100 -d %s' % self._datadir
190 190
191 # Execute script 191 # Execute script
192 self._execute_python('make_ts_distributions', args=args) 192 self._execute_python('make_ts_distributions', args=args)