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 155 obs.models(gammalib.GModels(datadir+'/crab.xml'))
156 156  
157 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 126 obs.models(gammalib.GModels(datadir+'/crab.xml'))
127 127  
128 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 205 obs.models(gammalib.GModels(datadir+'/crab.xml'))
206 206  
207 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 178 obs.models(gammalib.GModels(datadir+'/crab.xml'))
179 179  
180 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 146 pull = cscripts.cspull()
147 147 pull['inmodel'] = self._model
148 148 pull['outfile'] = 'cspull_py2.dat'
149   - pull['ntrials'] = 2
  149 + pull['ntrials'] = 1
150 150 pull['caldb'] = self._caldb
151 151 pull['irf'] = self._irf
152 152 pull['ra'] = 83.6331
... ... @@ -157,8 +157,8 @@ class Test(test):
157 157 pull['tmax'] = 100.0
158 158 pull['deadc'] = 0.95
159 159 pull['rad'] = 5.0
160   - pull['npix'] = 100
161   - pull['binsz'] = 0.02
  160 + pull['npix'] = 20
  161 + pull['binsz'] = 0.2
162 162 pull['coordsys'] = 'CEL'
163 163 pull['proj'] = 'TAN'
164 164 pull['logfile'] = 'cspull_py2.log'
... ... @@ -168,14 +168,14 @@ class Test(test):
168 168 pull.execute()
169 169  
170 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 173 # Set-up cspull from event list
174 174 pull = cscripts.cspull()
175 175 pull['inobs'] = self._events
176 176 pull['inmodel'] = self._model
177 177 pull['outfile'] = 'cspull_py3.dat'
178   - pull['ntrials'] = 2
  178 + pull['ntrials'] = 1
179 179 pull['caldb'] = self._caldb
180 180 pull['irf'] = self._irf
181 181 pull['enumbins'] = 0
... ... @@ -186,7 +186,7 @@ class Test(test):
186 186 pull.execute()
187 187  
188 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 191 # Build observation container with unbinned observation
192 192 cta = gammalib.GCTAObservation(self._events)
... ... @@ -197,7 +197,7 @@ class Test(test):
197 197 pull = cscripts.cspull(obs)
198 198 pull['inmodel'] = self._model
199 199 pull['outfile'] = 'cspull_py4.dat'
200   - pull['ntrials'] = 2
  200 + pull['ntrials'] = 1
201 201 pull['caldb'] = self._caldb
202 202 pull['irf'] = self._irf
203 203 pull['enumbins'] = 0
... ... @@ -208,7 +208,7 @@ class Test(test):
208 208 pull.execute()
209 209  
210 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 213 # Set-up stacked cspull with one observation where response cubes
214 214 # are specified in the input observation
... ... @@ -216,7 +216,7 @@ class Test(test):
216 216 pull['inobs'] = self._inobs
217 217 pull['inmodel'] = self._stacked_model
218 218 pull['outfile'] = 'cspull_py5.dat'
219   - pull['ntrials'] = 2
  219 + pull['ntrials'] = 1
220 220 pull['enumbins'] = 0
221 221 pull['logfile'] = 'cspull_py5.log'
222 222 pull['chatter'] = 4
... ... @@ -225,7 +225,7 @@ class Test(test):
225 225 pull.execute()
226 226  
227 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 230 # Set-up stacked cspull with two observations from which response
231 231 # cubes will be computed internally. The IRFs are also specified
... ... @@ -235,7 +235,7 @@ class Test(test):
235 235 pull['inobs'] = self._inobs_two
236 236 pull['inmodel'] = self._model
237 237 pull['outfile'] = 'cspull_py6.dat'
238   - pull['ntrials'] = 2
  238 + pull['ntrials'] = 1
239 239 pull['emin'] = 0.02
240 240 pull['emax'] = 100.0
241 241 pull['enumbins'] = 10
... ... @@ -250,13 +250,13 @@ class Test(test):
250 250 pull.execute()
251 251  
252 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 255 # Return
256 256 return
257 257  
258 258 # Check pull file
259   - def _check_pull_file(self, filename):
  259 + def _check_pull_file(self, filename, rows=3):
260 260 """
261 261 Check pull file
262 262 """
... ... @@ -264,8 +264,8 @@ class Test(test):
264 264 pulls = gammalib.GCsv(filename)
265 265  
266 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 270 # Return
271 271 return
... ...
test/test_ctmapcube.py
... ... @@ -71,8 +71,8 @@ class Test(test):
71 71 # Setup ctmapcube command
72 72 cmd = ctmapcube+' inmodel="'+self._model+'"'+ \
73 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 76 ' xref=83.63 yref=22.01 proj=CAR'+ \
77 77 ' logfile="ctmapcube_cmd1.log" chatter=1'
78 78  
... ... @@ -90,8 +90,8 @@ class Test(test):
90 90 # Setup ctmapcube command
91 91 cmd = ctmapcube+' inmodel="events_that_do_not_exist.fits"'+ \
92 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 95 ' xref=83.63 yref=22.01 proj=CAR'+ \
96 96 ' logfile="ctmapcube_cmd2.log"'
97 97  
... ... @@ -114,10 +114,10 @@ class Test(test):
114 114 mapcube['ebinalg'] = 'LOG'
115 115 mapcube['emin'] = 0.1
116 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 121 mapcube['coordsys'] = 'CEL'
122 122 mapcube['proj'] = 'CAR'
123 123 mapcube['xref'] = 83.63
... ... @@ -152,12 +152,12 @@ class Test(test):
152 152 cube = gammalib.GModelSpatialDiffuseCube(filename)
153 153  
154 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 157 # The map cube is not loaded by default !!!! We should add the method so that
158 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 162 # Return
163 163 return
... ...
test/test_cttsmap.py
... ... @@ -69,7 +69,7 @@ class Test(test):
69 69 ' inmodel="'+self._model+'" srcname="Crab"'+ \
70 70 ' caldb="'+self._caldb+'" irf="'+self._irf+'"'+ \
71 71 ' outmap="cttsmap_cmd1.fits"'+ \
72   - ' nxpix=5 nypix=5 binsz=0.02'+ \
  72 + ' nxpix=3 nypix=3 binsz=0.02'+ \
73 73 ' coordsys="CEL" proj="CAR" xref=83.63 yref=22.01'+ \
74 74 ' logfile="cttsmap_cmd1.log" chatter=1'
75 75  
... ... @@ -89,7 +89,7 @@ class Test(test):
89 89 ' inmodel="'+self._model+'" srcname="Crab"'+ \
90 90 ' caldb="'+self._caldb+'" irf="'+self._irf+'"'+ \
91 91 ' outmap="cttsmap_cmd2.fits"'+ \
92   - ' nxpix=5 nypix=5 binsz=0.02'+ \
  92 + ' nxpix=3 nypix=3 binsz=0.02'+ \
93 93 ' coordsys="CEL" proj="CAR" xref=83.63 yref=22.01'+ \
94 94 ' logfile="cttsmap_cmd2.log" chatter=2'
95 95  
... ... @@ -113,8 +113,8 @@ class Test(test):
113 113 tsmap['caldb'] = self._caldb
114 114 tsmap['irf'] = self._irf
115 115 tsmap['outmap'] = 'cttsmap_py1.fits'
116   - tsmap['nxpix'] = 5
117   - tsmap['nypix'] = 5
  116 + tsmap['nxpix'] = 3
  117 + tsmap['nypix'] = 3
118 118 tsmap['binsz'] = 0.02
119 119 tsmap['coordsys'] = 'CEL'
120 120 tsmap['proj'] = 'CAR'
... ... @@ -149,14 +149,14 @@ class Test(test):
149 149  
150 150 # Check dimensions
151 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 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 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 161 # Return
162 162 return
... ...
test/test_examples.py.in
... ... @@ -186,7 +186,7 @@ class Test(gammalib.GPythonTestSuite):
186 186 Test make_ts_distributions
187 187 """
188 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 191 # Execute script
192 192 self._execute_python('make_ts_distributions', args=args)
... ...