Commit 6e7fafe8dcd85f6aac8c63044534bb255d833b07

Authored by Jürgen Knödlseder
1 parent 091ffad3

Produce slimmer event list and counts cube for unit testing (#2310)

cscripts/Makefile.am
... ... @@ -162,9 +162,8 @@ testdata = $(top_srcdir)/test/data/crab.xml \
162 162 $(top_srcdir)/test/data/obs_unbinned.xml \
163 163 $(top_srcdir)/test/data/obs_stacked.xml \
164 164 $(top_srcdir)/test/data/obs_stacked_two.xml \
165   - $(top_srcdir)/test/data/crab_events.fits.gz \
166   - $(top_srcdir)/test/data/crab_cntmap.fits.gz \
167   - $(top_srcdir)/test/data/crab_cntmap_small.fits.gz \
  165 + $(top_srcdir)/test/data/crab_events.fits \
  166 + $(top_srcdir)/test/data/crab_cntmap.fits \
168 167 $(top_srcdir)/test/data/crab_expcube.fits.gz \
169 168 $(top_srcdir)/test/data/crab_psfcube.fits.gz \
170 169 $(top_srcdir)/test/data/crab_edispcube.fits.gz \
... ...
dev/make_test_data.py 0 → 100755
  1 +#! /usr/bin/env python
  2 +# ==========================================================================
  3 +# Generates test data
  4 +#
  5 +# Copyright (C) 2018 Juergen Knoedlseder
  6 +#
  7 +# This program is free software: you can redistribute it and/or modify
  8 +# it under the terms of the GNU General Public License as published by
  9 +# the Free Software Foundation, either version 3 of the License, or
  10 +# (at your option) any later version.
  11 +#
  12 +# This program is distributed in the hope that it will be useful,
  13 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
  14 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15 +# GNU General Public License for more details.
  16 +#
  17 +# You should have received a copy of the GNU General Public License
  18 +# along with this program. If not, see <http://www.gnu.org/licenses/>.
  19 +#
  20 +# ==========================================================================
  21 +import gammalib
  22 +import ctools
  23 +
  24 +
  25 +# ================= #
  26 +# Create event list #
  27 +# ================= #
  28 +def create_event_list():
  29 + """
  30 + Create event list
  31 + """
  32 + # Simulate events
  33 + sim = ctools.ctobssim()
  34 + sim['inmodel'] = 'test/data/crab.xml'
  35 + sim['outevents'] = 'test/data/crab_events.fits'
  36 + sim['caldb'] = 'prod2'
  37 + sim['irf'] = 'South_0.5h'
  38 + sim['edisp'] = False
  39 + sim['ra'] = 83.63
  40 + sim['dec'] = 22.51
  41 + sim['rad'] = 2.0
  42 + sim['tmin'] = '2020-01-01T00:00:00'
  43 + sim['tmax'] = '2020-01-01T00:05:00'
  44 + sim['emin'] = 1.0
  45 + sim['emax'] = 100.0
  46 + sim.execute()
  47 +
  48 + # Return
  49 + return
  50 +
  51 +
  52 +# ================== #
  53 +# Create counts cube #
  54 +# ================== #
  55 +def create_count_cube():
  56 + """
  57 + Create counts cube
  58 + """
  59 + # Allocate ctbin application and set parameters
  60 + bin = ctools.ctbin()
  61 + bin['inobs'] = 'test/data/crab_events.fits'
  62 + bin['outcube'] = 'test/data/crab_cntmap.fits'
  63 + bin['ebinalg'] = 'LOG'
  64 + bin['emin'] = 1.0
  65 + bin['emax'] = 100.0
  66 + bin['enumbins'] = 5
  67 + bin['usepnt'] = True # Use pointing for map centre
  68 + bin['nxpix'] = 20
  69 + bin['nypix'] = 20
  70 + bin['binsz'] = 0.2
  71 + bin['coordsys'] = 'CEL'
  72 + bin['proj'] = 'TAN'
  73 + bin.execute()
  74 +
  75 + # Return
  76 + return
  77 +
  78 +
  79 +# ======================== #
  80 +# Main routine entry point #
  81 +# ======================== #
  82 +if __name__ == '__main__':
  83 +
  84 + # Run tests
  85 + create_event_list()
  86 + create_count_cube()
  87 +
... ...
pyext/Makefile.am
... ... @@ -64,8 +64,8 @@ testscripts = ctools/tests/__init__.py \
64 64  
65 65 # Test data to be distributed in $(pyexecdir)/ctools/tests/data
66 66 testdata = $(top_srcdir)/test/data/crab.xml \
67   - $(top_srcdir)/test/data/crab_events.fits.gz \
68   - $(top_srcdir)/test/data/crab_cntmap.fits.gz \
  67 + $(top_srcdir)/test/data/crab_events.fits \
  68 + $(top_srcdir)/test/data/crab_cntmap.fits \
69 69 $(top_srcdir)/test/data/phased_events.fits.gz \
70 70 $(top_srcdir)/test/data/invalid_event_list.fits.gz \
71 71 $(top_srcdir)/test/data/model_temporal_phasecurve.xml \
... ...
test/data/crab_cntmap.fits 0 → 100755
No preview for this file type
test/data/crab_cntmap.fits.gz deleted
No preview for this file type
test/data/crab_cntmap_small.fits.gz deleted
No preview for this file type
test/data/crab_events.fits 0 → 100644
No preview for this file type
test/data/crab_events.fits.gz deleted
No preview for this file type
test/test_csobsinfo.py
... ... @@ -134,7 +134,7 @@ class Test(test):
134 134 self.test_value(len(obsinfo.offsets()), 1, 'Test number of offsets')
135 135 self.test_value(obsinfo.offsets()[0], 0.5, 'Test offset angle')
136 136 self.test_value(obsinfo.ebounds().size(), 1, 'Test number of energy boundaries')
137   - self.test_value(obsinfo.ebounds().emin().GeV(), 100.0, 'Test minimum energy')
  137 + self.test_value(obsinfo.ebounds().emin().TeV(), 1.0, 'Test minimum energy')
138 138 self.test_value(obsinfo.ebounds().emax().TeV(), 100.0, 'Test maximum energy')
139 139  
140 140 # Return
... ...
test/test_csresmap.py
... ... @@ -73,8 +73,8 @@ class Test(test):
73 73 ' outmap="csresmap_cmd1.fits"'+ \
74 74 ' inmodel="'+self._model+'"'+ \
75 75 ' caldb="'+self._caldb+'" irf="'+self._irf+'"'+ \
76   - ' emin=0.1 emax=100.0 enumbins=20'+ \
77   - ' nxpix=50 nypix=50 binsz=0.02'+ \
  76 + ' emin=1.0 emax=100.0 enumbins=5'+ \
  77 + ' nxpix=20 nypix=20 binsz=0.2'+ \
78 78 ' coordsys="CEL" proj="CAR" xref=83.63 yref=22.01'+ \
79 79 ' algorithm="SUBDIVSQRT"'+ \
80 80 ' logfile="csresmap_cmd1.log" chatter=1'
... ... @@ -91,8 +91,8 @@ class Test(test):
91 91 ' outmap="csresmap_cmd1.fits"'+ \
92 92 ' inmodel="'+self._model+'"'+ \
93 93 ' caldb="'+self._caldb+'" irf="'+self._irf+'"'+ \
94   - ' emin=0.1 emax=100.0 enumbins=20'+ \
95   - ' nxpix=50 nypix=50 binsz=0.02'+ \
  94 + ' emin=1.0 emax=100.0 enumbins=5'+ \
  95 + ' nxpix=20 nypix=20 binsz=0.2'+ \
96 96 ' coordsys="CEL" proj="CAR" xref=83.63 yref=22.01'+ \
97 97 ' algorithm="SUBDIVSQRT"'+ \
98 98 ' logfile="csresmap_cmd2.log" debug=yes chatter=2'
... ... @@ -119,12 +119,12 @@ class Test(test):
119 119 resmap['inmodel'] = self._model
120 120 resmap['caldb'] = self._caldb
121 121 resmap['irf'] = self._irf
122   - resmap['emin'] = 0.1
  122 + resmap['emin'] = 1.0
123 123 resmap['emax'] = 100.0
124   - resmap['enumbins'] = 20
125   - resmap['nxpix'] = 50
126   - resmap['nypix'] = 50
127   - resmap['binsz'] = 0.02
  124 + resmap['enumbins'] = 5
  125 + resmap['nxpix'] = 20
  126 + resmap['nypix'] = 20
  127 + resmap['binsz'] = 0.2
128 128 resmap['coordsys'] = 'CEL'
129 129 resmap['proj'] = 'CAR'
130 130 resmap['xref'] = 83.63
... ... @@ -162,7 +162,7 @@ class Test(test):
162 162 resmap.execute()
163 163  
164 164 # Check pull distribution file
165   - self._check_result_file('csresmap_py2.fits', nx=200, ny=200)
  165 + self._check_result_file('csresmap_py2.fits')
166 166  
167 167 # Run csresmap with SUBDIVSQRT algorithm
168 168 resmap = cscripts.csresmap()
... ... @@ -185,7 +185,7 @@ class Test(test):
185 185 resmap.execute()
186 186  
187 187 # Check pull distribution file
188   - self._check_result_file('csresmap_py3.fits', nx=200, ny=200)
  188 + self._check_result_file('csresmap_py3.fits')
189 189  
190 190 # Run csresmap with SIGNIFICANCE algorithm
191 191 resmap = cscripts.csresmap()
... ... @@ -208,14 +208,14 @@ class Test(test):
208 208 resmap.execute()
209 209  
210 210 # Check pull distribution file
211   - self._check_result_file('csresmap_py4.fits', nx=200, ny=200)
  211 + self._check_result_file('csresmap_py4.fits')
212 212  
213 213  
214 214 # Return
215 215 return
216 216  
217 217 # Check result file
218   - def _check_result_file(self, filename, nx=50, ny=50):
  218 + def _check_result_file(self, filename, nx=20, ny=20):
219 219 """
220 220 Check result file
221 221 """
... ...
test/test_csresspec.py
... ... @@ -181,7 +181,7 @@ class Test(test):
181 181 resspec.execute()
182 182  
183 183 # Check result file
184   - self._check_result_file('csresspec_py3.fits', 20, 5)
  184 + self._check_result_file('csresspec_py3.fits', 5, 5)
185 185  
186 186 # Set-up csresspec for counts cube with source mask
187 187 resspec = cscripts.csresspec()
... ... @@ -208,7 +208,7 @@ class Test(test):
208 208 resspec.execute()
209 209  
210 210 # Check result file
211   - self._check_result_file('csresspec_py4.fits', 20, 5)
  211 + self._check_result_file('csresspec_py4.fits', 5, 5)
212 212  
213 213 # Set-up csresspec for On/Off observations
214 214 resspec = cscripts.csresspec()
... ...
test/test_csspec.py
... ... @@ -43,7 +43,6 @@ class Test(test):
43 43 test.__init__(self)
44 44  
45 45 # Set members
46   - self._inobs = self._datadir + '/crab_cntmap_small.fits'
47 46 self._inonoff = self._datadir + '/onoff_obs.xml'
48 47 self._expcube = self._datadir + '/crab_expcube.fits'
49 48 self._psfcube = self._datadir + '/crab_psfcube.fits'
... ... @@ -146,7 +145,7 @@ class Test(test):
146 145  
147 146 # Set-up stacked csspec
148 147 spec = cscripts.csspec()
149   - spec['inobs'] = self._inobs
  148 + spec['inobs'] = self._cntcube
150 149 spec['expcube'] = self._expcube
151 150 spec['psfcube'] = self._psfcube
152 151 spec['edispcube'] = self._edispcube
... ...
test/test_ctbin.py
... ... @@ -72,7 +72,7 @@ class Test(test):
72 72 # Setup ctbin command
73 73 cmd = ctbin+' inobs="'+self._events+'"'+ \
74 74 ' outcube="cntmap_cmd1.fits"'+\
75   - ' emin=0.1 emax=100.0 enumbins=10 ebinalg="LOG"'+ \
  75 + ' emin=1.0 emax=100.0 enumbins=10 ebinalg="LOG"'+ \
76 76 ' nxpix=40 nypix=40 binsz=0.1 coordsys="CEL"'+ \
77 77 ' xref=83.63 yref=22.01 proj="CAR"'+ \
78 78 ' logfile="ctbin_cmd1.log" chatter=1'
... ... @@ -83,12 +83,12 @@ class Test(test):
83 83  
84 84 # Load counts cube and check content.
85 85 evt = gammalib.GCTAEventCube('cntmap_cmd1.fits')
86   - self._check_cube(evt, 3105)
  86 + self._check_cube(evt, 245)
87 87  
88 88 # Setup ctbin command
89 89 cmd = ctbin+' inobs="events_that_do_not_exist.fits"'+ \
90 90 ' outcube="cntmap_cmd2.fits"'+\
91   - ' emin=0.1 emax=100.0 enumbins=10 ebinalg="LOG"'+ \
  91 + ' emin=1.0 emax=100.0 enumbins=10 ebinalg="LOG"'+ \
92 92 ' nxpix=40 nypix=40 binsz=0.1 coordsys="CEL"'+ \
93 93 ' xref=83.63 yref=22.01 proj="CAR"'+ \
94 94 ' logfile="ctbin_cmd2.log" debug=yes chatter=1'
... ... @@ -100,7 +100,7 @@ class Test(test):
100 100 # Setup ctbin command with different ebounds than input
101 101 cmd = ctbin+' inobs="'+self._events+'"'+ \
102 102 ' outcube="cntmap_cmd3.fits"'+\
103   - ' emin=0.5 emax=20.0 enumbins=10 ebinalg="LOG"'+ \
  103 + ' emin=2.0 emax=20.0 enumbins=10 ebinalg="LOG"'+ \
104 104 ' nxpix=40 nypix=40 binsz=0.1 coordsys="CEL"'+ \
105 105 ' xref=83.63 yref=22.01 proj="CAR"'+ \
106 106 ' logfile="ctbin_cmd3.log" chatter=3'
... ... @@ -111,7 +111,7 @@ class Test(test):
111 111  
112 112 # Load counts cube and check content.
113 113 evt = gammalib.GCTAEventCube('cntmap_cmd3.fits')
114   - self._check_cube(evt, 617)
  114 + self._check_cube(evt, 115)
115 115  
116 116 # Check ctbin --help
117 117 self._check_help(ctbin)
... ... @@ -152,7 +152,7 @@ class Test(test):
152 152 binning['inobs'] = self._events
153 153 binning['outcube'] = 'ctbin_py1.fits'
154 154 binning['ebinalg'] = 'LOG'
155   - binning['emin'] = 0.1
  155 + binning['emin'] = 1.0
156 156 binning['emax'] = 100.0
157 157 binning['enumbins'] = 10
158 158 binning['nxpix'] = 40
... ... @@ -170,15 +170,15 @@ class Test(test):
170 170 binning.run()
171 171  
172 172 # Check content of observation container and counts cube
173   - self._check_observation(binning, 3105)
174   - self._check_cube(binning.cube(), 3105)
  173 + self._check_observation(binning, 245)
  174 + self._check_cube(binning.cube(), 245)
175 175  
176 176 # Copy ctbin tool
177 177 cpy_bin = binning.copy()
178 178  
179 179 # Check content of observation container and counts cube
180   - self._check_observation(cpy_bin, 3105)
181   - self._check_cube(cpy_bin.cube(), 3105)
  180 + self._check_observation(cpy_bin, 245)
  181 + self._check_cube(cpy_bin.cube(), 245)
182 182  
183 183 # Run copy of ctbin tool again
184 184 cpy_bin['logfile'] = 'ctbin_py2.log'
... ... @@ -197,7 +197,7 @@ class Test(test):
197 197  
198 198 # Load counts cube and check content
199 199 evt = gammalib.GCTAEventCube('ctbin_py1.fits')
200   - self._check_cube(evt, 3105)
  200 + self._check_cube(evt, 245)
201 201  
202 202 # Now clear ctbin tool
203 203 binning.clear()
... ... @@ -217,7 +217,7 @@ class Test(test):
217 217 binning = ctools.ctbin(obs)
218 218 binning['outcube'] = 'ctbin_py3.fits'
219 219 binning['ebinalg'] = 'LOG'
220   - binning['emin'] = 0.1
  220 + binning['emin'] = 1.0
221 221 binning['emax'] = 100.0
222 222 binning['enumbins'] = 10
223 223 binning['nxpix'] = 40
... ... @@ -237,16 +237,16 @@ class Test(test):
237 237  
238 238 # Check content of observation and cube (need multiplier=3 since
239 239 # three identical observations have been appended)
240   - self._check_observation(binning, 3105, multiplier=3)
241   - self._check_cube(binning.cube(), 3105, multiplier=3)
  240 + self._check_observation(binning, 245, multiplier=3)
  241 + self._check_cube(binning.cube(), 245, multiplier=3)
242 242  
243 243 # Load counts cube and check content.
244 244 evt = gammalib.GCTAEventCube('ctbin_py3.fits')
245   - self._check_cube(evt, 3105, multiplier=3)
  245 + self._check_cube(evt, 245, multiplier=3)
246 246  
247 247 # And finally go for a fully Pythonic version with all parameters
248 248 # being specified in a dictionary
249   - pars = {'inobs': self._events, 'ebinalg': 'LIN', 'emin': 0.1,
  249 + pars = {'inobs': self._events, 'ebinalg': 'LIN', 'emin': 1.0,
250 250 'emax': 100.0, 'enumbins': 10, 'nxpix': 40, 'nypix': 40,
251 251 'binsz': 0.1, 'coordsys': 'CEL', 'proj': 'CAR',
252 252 'xref': 83.63, 'yref': 22.01, 'outcube': 'ctbin_py4.fits',
... ... @@ -258,7 +258,7 @@ class Test(test):
258 258  
259 259 # Load counts cube and check content
260 260 evt = gammalib.GCTAEventCube('ctbin_py4.fits')
261   - self._check_cube(evt, 3105)
  261 + self._check_cube(evt, 245)
262 262  
263 263 # Return
264 264 return
... ...
test/test_ctbkgcube.py
... ... @@ -72,7 +72,7 @@ class Test(test):
72 72 ' outcube="ctbkgcube_cmd1.fits"'+ \
73 73 ' outmodel="ctbkgcube_cmd1.xml"'+ \
74 74 ' caldb="'+self._caldb+'" irf="'+self._irf+'"'+ \
75   - ' ebinalg="LOG" emin=0.1 emax=100.0 enumbins=20'+ \
  75 + ' ebinalg="LOG" emin=1.0 emax=100.0 enumbins=5'+ \
76 76 ' nxpix=10 nypix=10 binsz=0.4'+ \
77 77 ' coordsys="CEL" proj="CAR" xref=83.63 yref=22.01'+ \
78 78 ' logfile="ctbkgcube_cmd1.log" chatter=1'
... ... @@ -91,7 +91,7 @@ class Test(test):
91 91 ' outcube="ctbkgcube_cmd2.fits"'+ \
92 92 ' outmodel="ctbkgcube_cmd2.xml"'+ \
93 93 ' caldb="'+self._caldb+'" irf="'+self._irf+'"'+ \
94   - ' ebinalg="LOG" emin=0.1 emax=100.0 enumbins=20'+ \
  94 + ' ebinalg="LOG" emin=1.0 emax=100.0 enumbins=5'+ \
95 95 ' nxpix=10 nypix=10 binsz=0.4'+ \
96 96 ' coordsys="CEL" proj="CAR" xref=83.63 yref=22.01'+ \
97 97 ' logfile="ctbkgcube_cmd2.log" debug=yes chatter=1'
... ... @@ -158,9 +158,9 @@ class Test(test):
158 158 bkgcube['caldb'] = self._caldb
159 159 bkgcube['irf'] = self._irf
160 160 bkgcube['ebinalg'] = 'LOG'
161   - bkgcube['emin'] = 0.1
  161 + bkgcube['emin'] = 1.0
162 162 bkgcube['emax'] = 100.0
163   - bkgcube['enumbins'] = 20
  163 + bkgcube['enumbins'] = 5
164 164 bkgcube['nxpix'] = 10
165 165 bkgcube['nypix'] = 10
166 166 bkgcube['binsz'] = 0.4
... ... @@ -224,7 +224,7 @@ class Test(test):
224 224 bkgcube['ebinalg'] = 'LOG'
225 225 bkgcube['emin'] = 0.2
226 226 bkgcube['emax'] = 150.0
227   - bkgcube['enumbins'] = 20
  227 + bkgcube['enumbins'] = 5
228 228 bkgcube['nxpix'] = 10
229 229 bkgcube['nypix'] = 10
230 230 bkgcube['binsz'] = 0.4
... ... @@ -243,13 +243,13 @@ class Test(test):
243 243 bkgcube.execute()
244 244  
245 245 # Check result files
246   - self._check_result_files('ctbkgcube_py5', nenergies=23)
  246 + self._check_result_files('ctbkgcube_py5', nenergies=8)
247 247  
248 248 # Return
249 249 return
250 250  
251 251 # Check result files
252   - def _check_result_files(self, filename, nenergies=21, nmodels=2):
  252 + def _check_result_files(self, filename, nenergies=6, nmodels=2):
253 253 """
254 254 Check result file
255 255  
... ... @@ -276,7 +276,7 @@ class Test(test):
276 276 return
277 277  
278 278 # Check background cube
279   - def _check_cube(self, cube, nenergies=21):
  279 + def _check_cube(self, cube, nenergies=6):
280 280 """
281 281 Check background cube
282 282  
... ...
test/test_ctcubemask.py
... ... @@ -72,8 +72,8 @@ class Test(test):
72 72 cmd = ctcubemask+' inobs="'+self._cntcube+'"'+ \
73 73 ' regfile="'+self._exclusion+'"'+ \
74 74 ' outcube="ctcubemask_cmd1.fits"'+ \
75   - ' ra=83.63 dec=22.01 rad=2.0'+ \
76   - ' emin=0.1 emax=100.0'+ \
  75 + ' ra=83.63 dec=22.01 rad=1.0'+ \
  76 + ' emin=1.0 emax=100.0'+ \
77 77 ' logfile="ctcubemask_cmd1.log" chatter=1'
78 78  
79 79 # Check if execution was successful
... ... @@ -87,8 +87,8 @@ class Test(test):
87 87 cmd = ctcubemask+' inobs="counts_cube_that_does_not_exist.fits"'+ \
88 88 ' regfile="'+self._exclusion+'"'+ \
89 89 ' outcube="ctcubemask_cmd2.fits"'+ \
90   - ' ra=83.63 dec=22.01 rad=2.0'+ \
91   - ' emin=0.1 emax=100.0'+ \
  90 + ' ra=83.63 dec=22.01 rad=1.0'+ \
  91 + ' emin=1.0 emax=100.0'+ \
92 92 ' logfile="ctcubemask_cmd2.log" debug=yes chatter=2'
93 93  
94 94 # Check if execution failed
... ... @@ -128,8 +128,8 @@ class Test(test):
128 128 mask['regfile'] = self._exclusion
129 129 mask['ra'] = 83.63
130 130 mask['dec'] = 22.01
131   - mask['rad'] = 2.0
132   - mask['emin'] = 0.1
  131 + mask['rad'] = 1.0
  132 + mask['emin'] = 1.0
133 133 mask['emax'] = 100.0
134 134 mask['outcube'] = 'ctcubemask_py1.fits'
135 135 mask['logfile'] = 'ctcubemask_py1.log'
... ... @@ -151,8 +151,8 @@ class Test(test):
151 151 mask['ra'] = 83.63
152 152 mask['dec'] = 22.01
153 153 mask['rad'] = 3.0
154   - mask['emin'] = 1.0
155   - mask['emax'] = 100.0
  154 + mask['emin'] = 2.0
  155 + mask['emax'] = 10.0
156 156 mask['outcube'] = 'ctcubemask_py2.fits'
157 157 mask['logfile'] = 'ctcubemask_py2.log'
158 158 mask['chatter'] = 3
... ... @@ -163,7 +163,7 @@ class Test(test):
163 163 mask.execute()
164 164  
165 165 # Check result file
166   - self._check_result_file('ctcubemask_py2.fits', events=573)
  166 + self._check_result_file('ctcubemask_py2.fits', events=65)
167 167  
168 168 # Copy ctcubemask tool
169 169 cpy_mask = mask.copy()
... ... @@ -179,7 +179,7 @@ class Test(test):
179 179 cpy_mask.execute()
180 180  
181 181 # Check result file
182   - self._check_result_file('ctcubemask_py3.fits', events=573)
  182 + self._check_result_file('ctcubemask_py3.fits', events=65)
183 183  
184 184 # Clear ctcubemask tool
185 185 cpy_mask.clear()
... ... @@ -197,7 +197,7 @@ class Test(test):
197 197 mask['regfile'] = 'NONE'
198 198 mask['ra'] = 83.63
199 199 mask['dec'] = 22.01
200   - mask['rad'] = 3.0
  200 + mask['rad'] = 1.0
201 201 mask['emin'] = 'NONE'
202 202 mask['emax'] = 'NONE'
203 203 mask['outcube'] = 'ctcubemask_py4.xml'
... ... @@ -209,13 +209,13 @@ class Test(test):
209 209 mask.execute()
210 210  
211 211 # Check result file
212   - self._check_result_file('filtered_crab_cntmap.fits', events=5542)
  212 + self._check_result_file('filtered_crab_cntmap.fits', events=132)
213 213  
214 214 # Return
215 215 return
216 216  
217 217 # Check result file
218   - def _check_result_file(self, filename, events=4921):
  218 + def _check_result_file(self, filename, events=126):
219 219 """
220 220 Check result file
221 221 """
... ... @@ -223,7 +223,7 @@ class Test(test):
223 223 cube = gammalib.GCTAEventCube(filename)
224 224  
225 225 # Check counts cube
226   - self.test_value(cube.size(), 800000, 'Check for number of cube bins')
  226 + self.test_value(cube.size(), 2000, 'Check for number of cube bins')
227 227 self.test_value(cube.number(), events, 'Check for number of events')
228 228  
229 229 # Return
... ...
test/test_ctedispcube.py
... ... @@ -70,7 +70,7 @@ class Test(test):
70 70 ' incube="NONE"'+ \
71 71 ' outcube="ctedispcube_cmd1.fits"'+ \
72 72 ' caldb="'+self._caldb+'" irf="'+self._irf+'"'+ \
73   - ' ebinalg="LOG" emin=0.1 emax=100.0 enumbins=20'+ \
  73 + ' ebinalg="LOG" emin=1.0 emax=100.0 enumbins=5'+ \
74 74 ' nxpix=10 nypix=10 binsz=0.4'+ \
75 75 ' coordsys="CEL" proj="CAR" xref=83.63 yref=22.01'+ \
76 76 ' migramax=2.0 migrabins=10'+ \
... ... @@ -88,7 +88,7 @@ class Test(test):
88 88 ' incube="NONE"'+ \
89 89 ' outcube="ctedispcube_cmd2.fits"'+ \
90 90 ' caldb="'+self._caldb+'" irf="'+self._irf+'"'+ \
91   - ' ebinalg="LOG" emin=0.1 emax=100.0 enumbins=20'+ \
  91 + ' ebinalg="LOG" emin=1.0 emax=100.0 enumbins=5'+ \
92 92 ' nxpix=10 nypix=10 binsz=0.4'+ \
93 93 ' coordsys="CEL" proj="CAR" xref=83.63 yref=22.01'+ \
94 94 ' migramax=2.0 migrabins=10'+ \
... ... @@ -133,9 +133,9 @@ class Test(test):
133 133 edispcube['caldb'] = self._caldb
134 134 edispcube['irf'] = self._irf
135 135 edispcube['ebinalg'] = 'LOG'
136   - edispcube['emin'] = 0.1
  136 + edispcube['emin'] = 1.0
137 137 edispcube['emax'] = 100.0
138   - edispcube['enumbins'] = 20
  138 + edispcube['enumbins'] = 5
139 139 edispcube['nxpix'] = 10
140 140 edispcube['nypix'] = 10
141 141 edispcube['binsz'] = 0.4
... ... @@ -175,7 +175,7 @@ class Test(test):
175 175 cpy_edispcube.execute()
176 176  
177 177 # Check result file
178   - self._check_result_file('ctedispcube_py2.fits', nenergies=23)
  178 + self._check_result_file('ctedispcube_py2.fits', nenergies=8)
179 179  
180 180 # Now clear copy of ctedispcube tool
181 181 cpy_edispcube.clear()
... ... @@ -193,9 +193,9 @@ class Test(test):
193 193 edispcube['caldb'] = self._caldb
194 194 edispcube['irf'] = self._irf
195 195 edispcube['ebinalg'] = 'LOG'
196   - edispcube['emin'] = 0.1
  196 + edispcube['emin'] = 1.0
197 197 edispcube['emax'] = 100.0
198   - edispcube['enumbins'] = 20
  198 + edispcube['enumbins'] = 5
199 199 edispcube['nxpix'] = 10
200 200 edispcube['nypix'] = 10
201 201 edispcube['binsz'] = 0.4
... ... @@ -221,7 +221,7 @@ class Test(test):
221 221 return
222 222  
223 223 # Check result file
224   - def _check_result_file(self, filename, nenergies=21):
  224 + def _check_result_file(self, filename, nenergies=6):
225 225 """
226 226 Check result file
227 227  
... ... @@ -242,7 +242,7 @@ class Test(test):
242 242 return
243 243  
244 244 # Check energy dispersion cube
245   - def _check_cube(self, cube, nenergies=21, nmigras=10):
  245 + def _check_cube(self, cube, nenergies=6, nmigras=10):
246 246 """
247 247 Check energy dispersion cube
248 248  
... ...
test/test_cterror.py
... ... @@ -257,31 +257,41 @@ class Test(test):
257 257 # Check number of models
258 258 self.test_value(models.size(), nmodels, 'Check number of models')
259 259  
  260 + # Set reference values
  261 + prefactor = 3.65452317573063e-16
  262 + prefactor_error = 1.12697923756417e-16
  263 + index = 2.39356360626209
  264 + index_error = 0.131093571504494
  265 + pre_background = 1.01409721534593
  266 + pre_background_error = 0.122650321517162
  267 + index_background = 0.0436264224948547
  268 + index_background_error = 0.110703165254809
  269 +
260 270 # If there are models in the container then check them
261 271 if nmodels > 0:
262 272 self.test_value(models['Crab']['Prefactor'].value(),
263   - 5.6530206356786e-16, 1.0e-4 * 5.6530206356786e-16,
  273 + prefactor, 1.0e-4 * prefactor,
264 274 'Check fitted Crab Prefactor')
265 275 self.test_value(models['Crab']['Prefactor'].error(),
266   - 2.45970361827369e-17, 1.0e-3 * 2.45970361827369e-17,
  276 + prefactor_error, 1.0e-3 * prefactor_error,
267 277 'Check Crab Prefactor error')
268 278 self.test_value(models['Crab']['Index'].value(),
269   - -2.45716228083265, 1.0e-4 * 2.45716228083265,
  279 + -index, 1.0e-4 * index,
270 280 'Check fitted Crab Index')
271 281 self.test_value(models['Crab']['Index'].error(),
272   - 0.0366617454398694, 1.0e-3 * 0.0366617454398694,
  282 + index_error, 1.0e-3 * index_error,
273 283 'Check Crab Index error')
274 284 self.test_value(models['Background']['Prefactor'].value(),
275   - 1.01525433446138, 1.0e-4 * 1.01525433446138,
  285 + pre_background, 1.0e-4 * pre_background,
276 286 'Check fitted background Prefactor')
277 287 self.test_value(models['Background']['Prefactor'].error(),
278   - 0.0334412516391298, 1.0e-4 * 0.0334412516391298,
  288 + pre_background_error, 1.0e-4 * pre_background_error,
279 289 'Check background Prefactor error')
280 290 self.test_value(models['Background']['Index'].value(),
281   - -0.005132848897274, 1.0e-3 * 0.005132848897274,
  291 + index_background, 1.0e-3 * index_background,
282 292 'Check fitted background Index')
283 293 self.test_value(models['Background']['Index'].error(),
284   - 0.0200624490548333, 1.0e-4 * 0.0200624490548333,
  294 + index_background_error, 1.0e-4 * index_background_error,
285 295 'Check background Index error')
286 296  
287 297 # Return
... ...
test/test_ctexpcube.py
... ... @@ -70,8 +70,8 @@ class Test(test):
70 70 ' incube="NONE"'+ \
71 71 ' outcube="ctexpcube_cmd1.fits"'+ \
72 72 ' caldb="'+self._caldb+'" irf="'+self._irf+'"'+ \
73   - ' ebinalg="LOG" emin=0.1 emax=100.0 enumbins=20'+ \
74   - ' nxpix=200 nypix=200 binsz=0.02'+ \
  73 + ' ebinalg="LOG" emin=1.0 emax=100.0 enumbins=5'+ \
  74 + ' nxpix=20 nypix=20 binsz=0.2'+ \
75 75 ' coordsys="CEL" proj="CAR" xref=83.63 yref=22.01'+ \
76 76 ' logfile="ctexpcube_cmd1.log" chatter=1'
77 77  
... ... @@ -87,8 +87,8 @@ class Test(test):
87 87 ' incube="NONE"'+ \
88 88 ' outcube="ctexpcube_cmd2.fits"'+ \
89 89 ' caldb="'+self._caldb+'" irf="'+self._irf+'"'+ \
90   - ' ebinalg="LOG" emin=0.1 emax=100.0 enumbins=20'+ \
91   - ' nxpix=200 nypix=200 binsz=0.02'+ \
  90 + ' ebinalg="LOG" emin=1.0 emax=100.0 enumbins=5'+ \
  91 + ' nxpix=20 nypix=20 binsz=0.2'+ \
92 92 ' coordsys="CEL" proj="CAR" xref=83.63 yref=22.01'+ \
93 93 ' logfile="ctexpcube_cmd2.log" debug=yes chatter=1'
94 94  
... ... @@ -131,12 +131,12 @@ class Test(test):
131 131 expcube['caldb'] = self._caldb
132 132 expcube['irf'] = self._irf
133 133 expcube['ebinalg'] = 'LOG'
134   - expcube['emin'] = 0.1
  134 + expcube['emin'] = 1.0
135 135 expcube['emax'] = 100.0
136   - expcube['enumbins'] = 20
137   - expcube['nxpix'] = 200
138   - expcube['nypix'] = 200
139   - expcube['binsz'] = 0.02
  136 + expcube['enumbins'] = 5
  137 + expcube['nxpix'] = 20
  138 + expcube['nypix'] = 20
  139 + expcube['binsz'] = 0.2
140 140 expcube['coordsys'] = 'CEL'
141 141 expcube['proj'] = 'CAR'
142 142 expcube['xref'] = 83.63
... ... @@ -172,7 +172,7 @@ class Test(test):
172 172 cpy_expcube.execute()
173 173  
174 174 # Check result file
175   - self._check_result_file('ctexpcube_py2.fits', nenergies=23)
  175 + self._check_result_file('ctexpcube_py2.fits', nenergies=8)
176 176  
177 177 # Now clear copy of ctexpcube tool
178 178 cpy_expcube.clear()
... ... @@ -189,12 +189,12 @@ class Test(test):
189 189 expcube['caldb'] = self._caldb
190 190 expcube['irf'] = self._irf
191 191 expcube['ebinalg'] = 'LOG'
192   - expcube['emin'] = 0.1
  192 + expcube['emin'] = 1.0
193 193 expcube['emax'] = 100.0
194   - expcube['enumbins'] = 20
195   - expcube['nxpix'] = 200
196   - expcube['nypix'] = 200
197   - expcube['binsz'] = 0.02
  194 + expcube['enumbins'] = 5
  195 + expcube['nxpix'] = 20
  196 + expcube['nypix'] = 20
  197 + expcube['binsz'] = 0.2
198 198 expcube['coordsys'] = 'CEL'
199 199 expcube['proj'] = 'CAR'
200 200 expcube['xref'] = 83.63
... ... @@ -214,7 +214,7 @@ class Test(test):
214 214 return
215 215  
216 216 # Check result file
217   - def _check_result_file(self, filename, nenergies=21):
  217 + def _check_result_file(self, filename, nenergies=6):
218 218 """
219 219 Check result file
220 220  
... ... @@ -235,7 +235,7 @@ class Test(test):
235 235 return
236 236  
237 237 # Check exposure cube
238   - def _check_cube(self, cube, nenergies=21):
  238 + def _check_cube(self, cube, nenergies=6):
239 239 """
240 240 Check exposure cube
241 241  
... ...
test/test_ctlike.py
... ... @@ -247,31 +247,41 @@ class Test(test):
247 247 # Check number of models
248 248 self.test_value(models.size(), nmodels, 'Check number of models')
249 249  
  250 + # Set reference values
  251 + prefactor = 3.65452317573063e-16
  252 + prefactor_error = 1.07582291031224e-16
  253 + index = 2.39356360626209
  254 + index_error = 0.126492171703747
  255 + pre_background = 1.01409721534593
  256 + pre_background_error = 0.122650321517162
  257 + index_background = 0.0436264224948547
  258 + index_background_error = 0.110703165254809
  259 +
250 260 # If there are models in the container then check them
251 261 if nmodels > 0:
252 262 self.test_value(models['Crab']['Prefactor'].value(),
253   - 5.6530206356786e-16, 1.0e-4 * 5.6530206356786e-16,
  263 + prefactor, 1.0e-4 * prefactor,
254 264 'Check fitted Crab Prefactor')
255 265 self.test_value(models['Crab']['Prefactor'].error(),
256   - 2.48304276536022e-17, 1.0e-4 * 2.48304276536022e-17,
  266 + prefactor_error, 1.0e-4 * prefactor_error,
257 267 'Check Crab Prefactor error')
258 268 self.test_value(models['Crab']['Index'].value(),
259   - -2.45716228083265, 1.0e-4 * 2.45716228083265,
  269 + -index, 1.0e-4 * index,
260 270 'Check fitted Crab Index')
261 271 self.test_value(models['Crab']['Index'].error(),
262   - 0.0386777873333435, 1.0e-4 * 0.0386777873333435,
  272 + index_error, 1.0e-4 * index_error,
263 273 'Check Crab Index error')
264 274 self.test_value(models['Background']['Prefactor'].value(),
265   - 1.01525433446138, 1.0e-4 * 1.01525433446138,
  275 + pre_background, 1.0e-4 * pre_background,
266 276 'Check fitted background Prefactor')
267 277 self.test_value(models['Background']['Prefactor'].error(),
268   - 0.0334412516391298, 1.0e-4 * 0.0334412516391298,
  278 + pre_background_error, 1.0e-4 * pre_background_error,
269 279 'Check background Prefactor error')
270 280 self.test_value(models['Background']['Index'].value(),
271   - -0.005132848897274, 1.0e-3 * 0.005132848897274,
  281 + index_background, 1.0e-3 * index_background,
272 282 'Check fitted background Index')
273 283 self.test_value(models['Background']['Index'].error(),
274   - 0.0200624490548333, 1.0e-4 * 0.0200624490548333,
  284 + index_background_error, 1.0e-4 * index_background_error,
275 285 'Check background Index error')
276 286  
277 287 # Return
... ...
test/test_ctmapcube.py
... ... @@ -72,8 +72,8 @@ class Test(test):
72 72 # Setup ctmapcube command
73 73 cmd = ctmapcube+' inmodel="'+self._model+'"'+ \
74 74 ' outcube="ctmapcube_cmd1.fits"'+\
75   - ' emin=0.1 emax=100.0 enumbins=10 ebinalg=LOG'+ \
76   - ' nxpix=100 nypix=100 binsz=0.04 coordsys=CEL'+ \
  75 + ' emin=1.0 emax=100.0 enumbins=5 ebinalg=LOG'+ \
  76 + ' nxpix=20 nypix=20 binsz=0.2 coordsys=CEL'+ \
77 77 ' xref=83.63 yref=22.01 proj=CAR'+ \
78 78 ' logfile="ctmapcube_cmd1.log" chatter=1'
79 79  
... ... @@ -87,8 +87,8 @@ class Test(test):
87 87 # Setup ctmapcube command
88 88 cmd = ctmapcube+' inmodel="events_that_do_not_exist.fits"'+ \
89 89 ' outcube="ctmapcube_cmd2.fits"'+\
90   - ' emin=0.1 emax=100.0 enumbins=10 ebinalg=LOG'+ \
91   - ' nxpix=100 nypix=100 binsz=0.04 coordsys=CEL'+ \
  90 + ' emin=1.0 emax=100.0 enumbins=5 ebinalg=LOG'+ \
  91 + ' nxpix=20 nypix=20 binsz=0.2 coordsys=CEL'+ \
92 92 ' xref=83.63 yref=22.01 proj=CAR'+ \
93 93 ' logfile="ctmapcube_cmd2.log" debug=yes '
94 94  
... ... @@ -128,12 +128,12 @@ class Test(test):
128 128 # Now set ctmapcube parameters
129 129 mapcube['inmodel'] = self._model
130 130 mapcube['ebinalg'] = 'LOG'
131   - mapcube['emin'] = 0.1
  131 + mapcube['emin'] = 1.0
132 132 mapcube['emax'] = 100.0
133   - mapcube['enumbins'] = 10
134   - mapcube['nxpix'] = 100
135   - mapcube['nypix'] = 100
136   - mapcube['binsz'] = 0.04
  133 + mapcube['enumbins'] = 5
  134 + mapcube['nxpix'] = 20
  135 + mapcube['nypix'] = 20
  136 + mapcube['binsz'] = 0.2
137 137 mapcube['coordsys'] = 'CEL'
138 138 mapcube['proj'] = 'CAR'
139 139 mapcube['xref'] = 83.63
... ... @@ -181,12 +181,12 @@ class Test(test):
181 181 mapcube = ctools.ctmapcube()
182 182 mapcube.models(gammalib.GModels(self._model))
183 183 mapcube['ebinalg'] = 'LIN'
184   - mapcube['emin'] = 0.1
  184 + mapcube['emin'] = 1.0
185 185 mapcube['emax'] = 100.0
186   - mapcube['enumbins'] = 10
187   - mapcube['nxpix'] = 100
188   - mapcube['nypix'] = 100
189   - mapcube['binsz'] = 0.04
  186 + mapcube['enumbins'] = 5
  187 + mapcube['nxpix'] = 20
  188 + mapcube['nypix'] = 20
  189 + mapcube['binsz'] = 0.2
190 190 mapcube['coordsys'] = 'CEL'
191 191 mapcube['proj'] = 'CAR'
192 192 mapcube['xref'] = 83.63
... ... @@ -229,7 +229,7 @@ class Test(test):
229 229 return
230 230  
231 231 # Check map cube
232   - def _check_cube(self, cube, nmaps=11, npixels=10000):
  232 + def _check_cube(self, cube, nmaps=6, npixels=400):
233 233 """
234 234 Check map cube
235 235  
... ...
test/test_ctmodel.py
... ... @@ -72,7 +72,7 @@ class Test(test):
72 72 ' inmodel="'+self._model+'"'+ \
73 73 ' caldb="'+self._caldb+'" irf="'+self._irf+'"'+ \
74 74 ' rad=5.0 ra=83.63 dec=22.01 tmin=0.0 tmax=1800'+ \
75   - ' emin=0.1 emax=100.0 enumbins=10 ebinalg="LOG"'+ \
  75 + ' emin=1.0 emax=100.0 enumbins=5 ebinalg="LOG"'+ \
76 76 ' nxpix=40 nypix=40'+ \
77 77 ' binsz=0.1 coordsys="CEL" proj="CAR"'+ \
78 78 ' xref=83.63 yref=22.01'+ \
... ... @@ -92,7 +92,7 @@ class Test(test):
92 92 ' inmodel="model_that_does_not_exist.xml"'+ \
93 93 ' caldb="'+self._caldb+'" irf="'+self._irf+'"'+ \
94 94 ' rad=5.0 ra=83.63 dec=22.01 tmin=0.0 tmax=1800'+ \
95   - ' emin=0.1 emax=100.0 enumbins=10 ebinalg="LOG"'+ \
  95 + ' emin=1.0 emax=100.0 enumbins=5 ebinalg="LOG"'+ \
96 96 ' nxpix=40 nypix=40'+ \
97 97 ' binsz=0.1 coordsys="CEL" proj="CAR"'+ \
98 98 ' xref=83.63 yref=22.01'+ \
... ... @@ -145,9 +145,9 @@ class Test(test):
145 145 model['tmin'] = 0
146 146 model['tmax'] = 1800
147 147 model['ebinalg'] = 'LOG'
148   - model['emin'] = 0.1
  148 + model['emin'] = 1.0
149 149 model['emax'] = 100.0
150   - model['enumbins'] = 10
  150 + model['enumbins'] = 5
151 151 model['nxpix'] = 40
152 152 model['nypix'] = 40
153 153 model['binsz'] = 0.1
... ... @@ -213,7 +213,7 @@ class Test(test):
213 213 model.execute()
214 214  
215 215 # Check result file
216   - self._check_result_file('ctmodel_py3.fits', nx=200, ny=200, nebins=20)
  216 + self._check_result_file('ctmodel_py3.fits', nx=20, ny=20, nebins=5)
217 217  
218 218 # Publish with name
219 219 model.publish('My model')
... ... @@ -222,7 +222,7 @@ class Test(test):
222 222 return
223 223  
224 224 # Check result file
225   - def _check_result_file(self, filename, nx=40, ny=40, nebins=10):
  225 + def _check_result_file(self, filename, nx=40, ny=40, nebins=5):
226 226 """
227 227 Check result file
228 228  
... ... @@ -247,7 +247,7 @@ class Test(test):
247 247 return
248 248  
249 249 # Check model cube
250   - def _check_cube(self, cube, nx=40, ny=40, nebins=10):
  250 + def _check_cube(self, cube, nx=40, ny=40, nebins=5):
251 251 """
252 252 Check model cube
253 253  
... ...
test/test_ctobssim.py
... ... @@ -74,10 +74,10 @@ class Test(test):
74 74 cmd = ctobssim+' inmodel="'+self._model+'" '+ \
75 75 ' outevents="ctobssim_cmd1.fits"'+ \
76 76 ' caldb="'+self._caldb+'" irf="'+self._irf+'" '+ \
77   - ' ra=83.63 dec=22.01 rad=3.0'+ \
  77 + ' ra=83.63 dec=22.01 rad=2.0'+ \
78 78 ' tmin="2020-01-01T00:00:00"'+ \
79 79 ' tmax="2020-01-01T00:05:00"'+ \
80   - ' emin=0.1 emax=100.0'+ \
  80 + ' emin=1.0 emax=100.0'+ \
81 81 ' logfile="ctobssim_cmd1.log" chatter=1'
82 82  
83 83 # Check if execution was successful
... ... @@ -86,16 +86,16 @@ class Test(test):
86 86  
87 87 # Load counts cube and check content.
88 88 evt = gammalib.GCTAEventList('ctobssim_cmd1.fits')
89   - self._test_list(evt, 3775)
  89 + self._test_list(evt, 253)
90 90  
91 91 # Setup ctobssim command
92 92 cmd = ctobssim+' inmodel="model_that_does_not_exist.xml"'+ \
93 93 ' outevents="ctobssim_cmd2.fits"'+ \
94 94 ' caldb="'+self._caldb+'" irf="'+self._irf+'" '+ \
95   - ' ra=83.63 dec=22.01 rad=3.0'+ \
  95 + ' ra=83.63 dec=22.01 rad=2.0'+ \
96 96 ' tmin="2020-01-01T00:00:00"'+ \
97 97 ' tmax="2020-01-01T00:05:00"'+ \
98   - ' emin=0.1 emax=100.0'+ \
  98 + ' emin=1.0 emax=100.0'+ \
99 99 ' logfile="ctobssim_cmd2.log" debug=yes chatter=1'
100 100  
101 101 # Check if execution failed
... ... @@ -137,10 +137,10 @@ class Test(test):
137 137 sim['irf'] = self._irf
138 138 sim['ra'] = 83.63
139 139 sim['dec'] = 22.01
140   - sim['rad'] = 3.0
  140 + sim['rad'] = 2.0
141 141 sim['tmin'] = '2020-01-01T00:00:00'
142 142 sim['tmax'] = '2020-01-01T00:05:00'
143   - sim['emin'] = 0.1
  143 + sim['emin'] = 1.0
144 144 sim['emax'] = 100.0
145 145 sim['outevents'] = 'ctobssim_py1.fits'
146 146 sim['logfile'] = 'ctobssim_py1.log'
... ... @@ -152,21 +152,21 @@ class Test(test):
152 152  
153 153 # Check content of observation
154 154 self._test_observation(sim)
155   - self._test_list(sim.obs()[0].events(), 3775)
  155 + self._test_list(sim.obs()[0].events(), 253)
156 156  
157 157 # Save events
158 158 sim.save()
159 159  
160 160 # Load counts cube and check content.
161 161 evt = gammalib.GCTAEventList('ctobssim_py1.fits')
162   - self._test_list(evt, 3775)
  162 + self._test_list(evt, 253)
163 163  
164 164 # Copy ctobssim tool
165 165 cpy_sim = sim.copy()
166 166  
167 167 # Retrieve observation and check content of copy
168 168 self._test_observation(cpy_sim)
169   - self._test_list(cpy_sim.obs()[0].events(), 3775)
  169 + self._test_list(cpy_sim.obs()[0].events(), 253)
170 170  
171 171 # Execute copy of ctobssim tool again, now with a higher chatter
172 172 # level than before
... ... @@ -179,7 +179,7 @@ class Test(test):
179 179  
180 180 # Load counts cube and check content.
181 181 evt = gammalib.GCTAEventList('ctobssim_py2.fits')
182   - self._test_list(evt, 3775)
  182 + self._test_list(evt, 253)
183 183  
184 184 # Set-up observation container
185 185 pnts = [{'ra': 83.63, 'dec': 21.01},
... ...
test/test_ctphase.py
... ... @@ -248,7 +248,7 @@ class Test(test):
248 248 return
249 249  
250 250 # Check result file
251   - def _check_result_file(self, filename, nevents=3736):
  251 + def _check_result_file(self, filename, nevents=253):
252 252 """
253 253 Check result file
254 254  
... ...
test/test_ctprob.py
... ... @@ -202,7 +202,7 @@ class Test(test):
202 202 return
203 203  
204 204 # Check result file
205   - def _check_result_file(self, filename, nevents=3736):
  205 + def _check_result_file(self, filename, nevents=253):
206 206 """
207 207 Check result file
208 208  
... ... @@ -232,7 +232,7 @@ class Test(test):
232 232 return
233 233  
234 234 # Check observation and event list
235   - def _check_obs(self, obs, nobs=1, nevents=22220):
  235 + def _check_obs(self, obs, nobs=1, nevents=253):
236 236 """
237 237 Check observation and event list
238 238  
... ... @@ -257,7 +257,7 @@ class Test(test):
257 257 return
258 258  
259 259 # Check events
260   - def _check_events(self, events, nevents=22220):
  260 + def _check_events(self, events, nevents=253):
261 261 """
262 262 Check event list
263 263  
... ...
test/test_ctpsfcube.py
... ... @@ -70,8 +70,8 @@ class Test(test):
70 70 ' incube="NONE"'+ \
71 71 ' outcube="ctpsfcube_cmd1.fits"'+ \
72 72 ' caldb="'+self._caldb+'" irf="'+self._irf+'"'+ \
73   - ' ebinalg="LOG" emin=0.1 emax=100.0 enumbins=20'+ \
74   - ' nxpix=200 nypix=200 binsz=0.02'+ \
  73 + ' ebinalg="LOG" emin=1.0 emax=100.0 enumbins=5'+ \
  74 + ' nxpix=20 nypix=20 binsz=0.2'+ \
75 75 ' coordsys="CEL" proj="CAR" xref=83.63 yref=22.01'+ \
76 76 ' amax=0.3 anumbins=10'+ \
77 77 ' logfile="ctpsfcube_cmd1.log" chatter=1'
... ... @@ -88,8 +88,8 @@ class Test(test):
88 88 ' incube="NONE"'+ \
89 89 ' outcube="ctpsfcube_cmd2.fits"'+ \
90 90 ' caldb="'+self._caldb+'" irf="'+self._irf+'"'+ \
91   - ' ebinalg="LOG" emin=0.1 emax=100.0 enumbins=20'+ \
92   - ' nxpix=200 nypix=200 binsz=0.02'+ \
  91 + ' ebinalg="LOG" emin=1.0 emax=100.0 enumbins=5'+ \
  92 + ' nxpix=20 nypix=20 binsz=0.2'+ \
93 93 ' coordsys="CEL" proj="CAR" xref=83.63 yref=22.01'+ \
94 94 ' amax=0.3 anumbins=10'+ \
95 95 ' logfile="ctpsfcube_cmd2.log" debug=yes chatter=1'
... ... @@ -133,9 +133,9 @@ class Test(test):
133 133 psfcube['caldb'] = self._caldb
134 134 psfcube['irf'] = self._irf
135 135 psfcube['ebinalg'] = 'LOG'
136   - psfcube['emin'] = 0.1
  136 + psfcube['emin'] = 1.0
137 137 psfcube['emax'] = 100
138   - psfcube['enumbins'] = 20
  138 + psfcube['enumbins'] = 5
139 139 psfcube['nxpix'] = 10
140 140 psfcube['nypix'] = 10
141 141 psfcube['binsz'] = 0.4
... ... @@ -175,7 +175,7 @@ class Test(test):
175 175 cpy_psfcube.execute()
176 176  
177 177 # Check result file
178   - self._check_result_file('ctpsfcube_py2.fits', nenergies=23)
  178 + self._check_result_file('ctpsfcube_py2.fits', nenergies=8)
179 179  
180 180 # Now clear copy of ctpsfcube tool
181 181 cpy_psfcube.clear()
... ... @@ -192,17 +192,6 @@ class Test(test):
192 192 psfcube['incube'] = self._cntcube
193 193 psfcube['caldb'] = self._caldb
194 194 psfcube['irf'] = self._irf
195   - #psfcube['ebinalg'] = 'LOG'
196   - #psfcube['emin'] = 0.1
197   - #psfcube['emax'] = 100
198   - #psfcube['enumbins'] = 20
199   - #psfcube['nxpix'] = 10
200   - #psfcube['nypix'] = 10
201   - #psfcube['binsz'] = 0.4
202   - #psfcube['coordsys'] = 'CEL'
203   - #psfcube['proj'] = 'CAR'
204   - #psfcube['xref'] = 83.63
205   - #psfcube['yref'] = 22.01
206 195 psfcube['amax'] = 0.3
207 196 psfcube['anumbins'] = 10
208 197 psfcube['addbounds'] = True
... ... @@ -221,7 +210,7 @@ class Test(test):
221 210 return
222 211  
223 212 # Check result file
224   - def _check_result_file(self, filename, nenergies=21):
  213 + def _check_result_file(self, filename, nenergies=6):
225 214 """
226 215 Check result file
227 216  
... ... @@ -242,7 +231,7 @@ class Test(test):
242 231 return
243 232  
244 233 # Check PSF cube
245   - def _check_cube(self, cube, nenergies=21):
  234 + def _check_cube(self, cube, nenergies=6):
246 235 """
247 236 Check PSF cube
248 237  
... ...
test/test_ctselect.py
... ... @@ -72,9 +72,9 @@ class Test(test):
72 72 # Setup ctselect command
73 73 cmd = ctselect+' inobs="'+self._events+'"'+ \
74 74 ' outobs="ctselect_cmd1.fits"'+ \
75   - ' rad=2.0'+ \
  75 + ' rad=1.0'+ \
76 76 ' tmin=2020-01-01T00:01:10 tmax=2020-01-01T00:03:40'+ \
77   - ' emin=0.2 emax=80.0'+ \
  77 + ' emin=2.0 emax=80.0'+ \
78 78 ' logfile="ctselect_cmd1.log" chatter=1'
79 79  
80 80 # Check if execution was successful
... ... @@ -87,9 +87,9 @@ class Test(test):
87 87 # Setup ctselect command
88 88 cmd = ctselect+' inobs="event_file_that_does_not_exist.fits"'+ \
89 89 ' outobs="ctselect_cmd2.fits"'+ \
90   - ' rad=2.0'+ \
  90 + ' rad=1.0'+ \
91 91 ' tmin=2020-01-01T00:01:10 tmax=2020-01-01T00:03:40'+ \
92   - ' emin=0.2 emax=80.0'+ \
  92 + ' emin=2.0 emax=80.0'+ \
93 93 ' logfile="ctselect_cmd2.log" debug=yes chatter=1'
94 94  
95 95 # Check if execution failed
... ... @@ -126,10 +126,10 @@ class Test(test):
126 126  
127 127 # Now set ctselect parameters
128 128 select['inobs'] = self._events
129   - select['rad'] = 2.0
  129 + select['rad'] = 1.0
130 130 select['tmin'] = '2020-01-01T00:01:10'
131 131 select['tmax'] = '2020-01-01T00:03:40'
132   - select['emin'] = 0.2
  132 + select['emin'] = 2.0
133 133 select['emax'] = 80.0
134 134 select['outobs'] = 'ctselect_py1.fits'
135 135 select['logfile'] = 'ctselect_py1.log'
... ... @@ -176,7 +176,7 @@ class Test(test):
176 176 cpy_select['ra'] = 83.63
177 177 cpy_select['dec'] = 22.01
178 178 cpy_select['tmin'] = '2020-01-01T00:01:10'
179   - cpy_select['emin'] = 0.2
  179 + cpy_select['emin'] = 2.0
180 180 cpy_select['usethres'] = 'USER'
181 181 cpy_select['outobs'] = 'ctselect_py3.fits'
182 182 cpy_select['logfile'] = 'ctselect_py3.log'
... ... @@ -205,7 +205,7 @@ class Test(test):
205 205 # beyond the energies covered in the event file is specified, hence
206 206 # an empty event list will be saved.
207 207 select = ctools.ctselect(obs)
208   - select['rad'] = 2.0
  208 + select['rad'] = 1.0
209 209 select['tmin'] = '2020-01-01T00:01:10'
210 210 select['tmax'] = '2020-01-01T00:03:40'
211 211 select['emin'] = 120.0
... ... @@ -226,10 +226,10 @@ class Test(test):
226 226 # Setup ctselect tool for an invalid event file
227 227 select = ctools.ctselect()
228 228 select['inobs'] = self._invalid_events
229   - select['rad'] = 2.0
  229 + select['rad'] = 1.0
230 230 select['tmin'] = '2020-01-01T00:01:10'
231 231 select['tmax'] = '2020-01-01T00:03:40'
232   - select['emin'] = 0.2
  232 + select['emin'] = 2.0
233 233 select['emax'] = 80.0
234 234 select['outobs'] = 'ctselect_py5.fits'
235 235 select['logfile'] = 'ctselect_py5.log'
... ... @@ -248,10 +248,10 @@ class Test(test):
248 248 # value should be ignored.
249 249 select = ctools.ctselect()
250 250 select['inobs'] = self._events+'[EVENTS]'
251   - select['rad'] = 2.0
  251 + select['rad'] = 1.0
252 252 select['tmin'] = '2020-01-01T00:01:10'
253 253 select['tmax'] = '2020-01-01T00:03:40'
254   - select['emin'] = 0.2
  254 + select['emin'] = 2.0
255 255 select['emax'] = 0.0 # Signals that "emax" should be ignored
256 256 select['outobs'] = 'ctselect_py6.fits'
257 257 select['logfile'] = 'ctselect_py6.log'
... ... @@ -267,7 +267,7 @@ class Test(test):
267 267 # Now ignore the "emin" value.
268 268 select = ctools.ctselect()
269 269 select['inobs'] = self._events+'[EVENTS]'
270   - select['rad'] = 2.0
  270 + select['rad'] = 1.0
271 271 select['tmin'] = '2020-01-01T00:01:10'
272 272 select['tmax'] = '2020-01-01T00:03:40'
273 273 select['emin'] = 0.0 # Signals that "emin" should be ignored
... ... @@ -281,7 +281,7 @@ class Test(test):
281 281 select.execute()
282 282  
283 283 # Check result file
284   - self._check_result_file('ctselect_py7.fits', nevents=1504)
  284 + self._check_result_file('ctselect_py7.fits', nevents=60)
285 285  
286 286 # Now set "emin > emax"
287 287 select['emin'] = 150.0
... ... @@ -304,10 +304,10 @@ class Test(test):
304 304 select['usepnt'] = False
305 305 select['ra'] = 83.63
306 306 select['dec'] = 24.01
307   - select['rad'] = 3.0
  307 + select['rad'] = 2.0
308 308 select['tmin'] = '2020-01-01T00:01:10'
309 309 select['tmax'] = '2020-01-01T00:03:40'
310   - select['emin'] = 0.2
  310 + select['emin'] = 2.0
311 311 select['emax'] = 80.0
312 312 select['outobs'] = 'ctselect_py9.fits'
313 313 select['logfile'] = 'ctselect_py9.log'
... ... @@ -332,21 +332,20 @@ class Test(test):
332 332 select.execute()
333 333  
334 334 # Check result file
335   - self._check_result_file('ctselect_py10.fits', nevents=833, rad=3.)
  335 + self._check_result_file('ctselect_py10.fits', nevents=31, rad=2.0)
336 336  
337   - # Finally test a custom defined RoI
338   - # enclosed in the original one
  337 + # Finally test a custom defined RoI enclosed in the original one
339 338 select = ctools.ctselect()
340   - select['inobs'] = self._events
341   - select['usepnt'] = False
342   - select['ra'] = 83.63
343   - select['dec'] = 24.01
344   - select['rad'] = 1.0
345   - select['tmin'] = '2020-01-01T00:01:10'
346   - select['tmax'] = '2020-01-01T00:03:40'
347   - select['emin'] = 0.2
348   - select['emax'] = 80.0
349   - select['outobs'] = 'ctselect_py11.fits'
  339 + select['inobs'] = self._events
  340 + select['usepnt'] = False
  341 + select['ra'] = 83.63
  342 + select['dec'] = 24.01
  343 + select['rad'] = 0.4
  344 + select['tmin'] = '2020-01-01T00:01:10'
  345 + select['tmax'] = '2020-01-01T00:03:40'
  346 + select['emin'] = 2.0
  347 + select['emax'] = 80.0
  348 + select['outobs'] = 'ctselect_py11.fits'
350 349 select['logfile'] = 'ctselect_py11.log'
351 350 select['chatter'] = 3
352 351  
... ... @@ -355,15 +354,15 @@ class Test(test):
355 354 select.execute()
356 355  
357 356 # Check result file
358   - self._check_result_file('ctselect_py11.fits', nevents=117, dec=24.01, rad=1.)
  357 + self._check_result_file('ctselect_py11.fits', nevents=1, dec=24.01, rad=0.4)
359 358  
360 359 # Now test phase cut
361 360 select = ctools.ctselect()
362 361 select['inobs'] = self._phased_events
363   - select['rad'] = 2.0
  362 + select['rad'] = 1.0
364 363 select['tmin'] = 'INDEF'
365 364 select['tmax'] = 'INDEF'
366   - select['emin'] = 0.1
  365 + select['emin'] = 1.0
367 366 select['emax'] = 100.0
368 367 select['phase'] = '0.1:0.4,0.6:0.8'
369 368 select['outobs'] = 'ctselect_py12.fits'
... ... @@ -375,15 +374,15 @@ class Test(test):
375 374 select.execute()
376 375  
377 376 # Check result file
378   - self._check_result_file('ctselect_py12.fits', nevents=1909, dec = 22.01)
  377 + self._check_result_file('ctselect_py12.fits', nevents=365, dec=22.01)
379 378  
380 379 # Now test another phase cut
381 380 select = ctools.ctselect()
382 381 select['inobs'] = self._phased_events
383   - select['rad'] = 2.0
  382 + select['rad'] = 1.0
384 383 select['tmin'] = 'INDEF'
385 384 select['tmax'] = 'INDEF'
386   - select['emin'] = 0.1
  385 + select['emin'] = 1.0
387 386 select['emax'] = 100.0
388 387 select['phase'] = '0.8:0.3'
389 388 select['outobs'] = 'ctselect_py13.fits'
... ... @@ -395,7 +394,7 @@ class Test(test):
395 394 select.execute()
396 395  
397 396 # Check result file
398   - self._check_result_file('ctselect_py13.fits', nevents=1995, dec = 22.01)
  397 + self._check_result_file('ctselect_py13.fits', nevents=395, dec=22.01)
399 398  
400 399 # Test invalid minimum phase value
401 400 self.test_try('Test invalid minimum phase value')
... ... @@ -485,7 +484,7 @@ class Test(test):
485 484 return
486 485  
487 486 # Check result file
488   - def _check_result_file(self, filename, nevents=744, dec=22.51, rad=2.0):
  487 + def _check_result_file(self, filename, nevents=28, dec=22.51, rad=1.0):
489 488 """
490 489 Check result file
491 490  
... ... @@ -510,7 +509,7 @@ class Test(test):
510 509 return
511 510  
512 511 # Check observation and event list
513   - def _check_obs(self, obs, nobs=1, nevents=744):
  512 + def _check_obs(self, obs, nobs=1, nevents=28):
514 513 """
515 514 Check observation and event list
516 515  
... ... @@ -535,7 +534,7 @@ class Test(test):
535 534 return
536 535  
537 536 # Check events
538   - def _check_events(self, events, nevents=744, dec=22.51, rad=2.0):
  537 + def _check_events(self, events, nevents=28, dec=22.51, rad=1.0):
539 538 """
540 539 Check event list
541 540  
... ...
test/test_ctulimit.py
... ... @@ -137,12 +137,17 @@ class Test(test):
137 137 ulimit.run()
138 138 ulimit.save()
139 139  
  140 + # Set reference value
  141 + ref_diff = 2.7504120441004e-17
  142 + ref_flux = 1.66909538876204e-11
  143 + ref_eflux = 6.46471558856293e-11
  144 +
140 145 # Check results
141   - self.test_value(ulimit.diff_ulimit(), 3.11978988143113e-17, 1.0e-21,
  146 + self.test_value(ulimit.diff_ulimit(), ref_diff, 1.0e-21,
142 147 'Check differential upper limit')
143   - self.test_value(ulimit.flux_ulimit(), 2.11102478123946e-11, 1.0e-16,
  148 + self.test_value(ulimit.flux_ulimit(), ref_flux, 1.0e-16,
144 149 'Check upper limit on photon flux')
145   - self.test_value(ulimit.eflux_ulimit(), 9.32520808361777e-11, 1.0e-16,
  150 + self.test_value(ulimit.eflux_ulimit(), ref_eflux, 1.0e-16,
146 151 'Check upper limit on energy flux')
147 152  
148 153 # Check obs() method
... ... @@ -156,19 +161,19 @@ class Test(test):
156 161 cpy_ulimit = ulimit.copy()
157 162  
158 163 # Check results of copy
159   - self.test_value(cpy_ulimit.diff_ulimit(), 3.11978988143113e-17, 1.0e-21,
  164 + self.test_value(cpy_ulimit.diff_ulimit(), ref_diff, 1.0e-21,
160 165 'Check differential upper limit')
161   - self.test_value(cpy_ulimit.flux_ulimit(), 2.11102478123946e-11, 1.0e-16,
  166 + self.test_value(cpy_ulimit.flux_ulimit(), ref_flux, 1.0e-16,
162 167 'Check upper limit on photon flux')
163   - self.test_value(cpy_ulimit.eflux_ulimit(), 9.32520808361777e-11, 1.0e-16,
  168 + self.test_value(cpy_ulimit.eflux_ulimit(), ref_eflux, 1.0e-16,
164 169 'Check upper limit on energy flux')
165 170  
166 171 # Check results
167   - self.test_value(cpy_ulimit.diff_ulimit(), 3.11978988143113e-17, 1.0e-21,
  172 + self.test_value(cpy_ulimit.diff_ulimit(), ref_diff, 1.0e-21,
168 173 'Check differential upper limit')
169   - self.test_value(cpy_ulimit.flux_ulimit(), 2.11102478123946e-11, 1.0e-16,
  174 + self.test_value(cpy_ulimit.flux_ulimit(), ref_flux, 1.0e-16,
170 175 'Check upper limit on photon flux')
171   - self.test_value(cpy_ulimit.eflux_ulimit(), 9.32520808361777e-11, 1.0e-16,
  176 + self.test_value(cpy_ulimit.eflux_ulimit(), ref_eflux, 1.0e-16,
172 177 'Check upper limit on energy flux')
173 178  
174 179 # Now clear copy of ctulimit tool
... ... @@ -203,11 +208,11 @@ class Test(test):
203 208 ulimit.execute()
204 209  
205 210 # Check results
206   - self.test_value(ulimit.diff_ulimit(), 3.11978988143113e-17, 1.0e-21,
  211 + self.test_value(ulimit.diff_ulimit(), ref_diff, 1.0e-21,
207 212 'Check differential upper limit')
208   - self.test_value(ulimit.flux_ulimit(), 2.11102478123946e-11, 1.0e-16,
  213 + self.test_value(ulimit.flux_ulimit(), ref_flux, 1.0e-16,
209 214 'Check upper limit on photon flux')
210   - self.test_value(ulimit.eflux_ulimit(), 9.32520808361777e-11, 1.0e-16,
  215 + self.test_value(ulimit.eflux_ulimit(), ref_eflux, 1.0e-16,
211 216 'Check upper limit on energy flux')
212 217  
213 218 # Test invalid model name
... ...
test/test_pipelines.py
... ... @@ -2,7 +2,7 @@
2 2 # ==========================================================================
3 3 # This scripts performs tests processing pipelines
4 4 #
5   -# Copyright (C) 2014-2016 Juergen Knoedlseder
  5 +# Copyright (C) 2014-2018 Juergen Knoedlseder
6 6 #
7 7 # This program is free software: you can redistribute it and/or modify
8 8 # it under the terms of the GNU General Public License as published by
... ... @@ -77,11 +77,11 @@ class Test(gammalib.GPythonTestSuite):
77 77 result_name = 'results.xml'
78 78 ra = 83.63
79 79 dec = 22.01
80   - rad_sim = 10.0
81   - rad_select = 3.0
  80 + rad_sim = 3.0
  81 + rad_select = 2.0
82 82 tstart = 0.0
83 83 tstop = 300.0
84   - emin = 0.1
  84 + emin = 1.0
85 85 emax = 100.0
86 86  
87 87 # Simulate events
... ... @@ -132,11 +132,11 @@ class Test(gammalib.GPythonTestSuite):
132 132 # Set script parameters
133 133 ra = 83.63
134 134 dec = 22.01
135   - rad_sim = 10.0
136   - rad_select = 3.0
  135 + rad_sim = 3.0
  136 + rad_select = 2.0
137 137 tstart = 0.0
138 138 tstop = 300.0
139   - emin = 0.1
  139 + emin = 1.0
140 140 emax = 100.0
141 141  
142 142 # Simulate events
... ...