Commit 77f1091b9c2457bd0b93a57fd37cd185cd6e8a80

Authored by Jürgen Knödlseder
1 parent 1661676c

Reduce duration of unit test

examples/pipeline_binned_disk.py
@@ -155,4 +155,5 @@ if __name__ == '__main__': @@ -155,4 +155,5 @@ if __name__ == '__main__':
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__ == '__main__': @@ -126,4 +126,4 @@ if __name__ == '__main__':
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__ == '__main__': @@ -205,4 +205,5 @@ if __name__ == '__main__':
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__ == '__main__': @@ -178,4 +178,4 @@ if __name__ == '__main__':
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_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)