Commit 1319dc961c0bf03fc0c28eabe04834ffc975ee7d
1 parent
7acb69d5
Add csspec WSTAT unit test
Showing
3 changed files
with
29 additions
and
16 deletions
configure.ac
| ... | ... | @@ -32,8 +32,8 @@ AC_INIT([ctools], [1.5.0.dev1], [jurgen.knodlseder@irap.omp.eu], [ctools]) |
| 32 | 32 | AC_CONFIG_SRCDIR([src/ctselect/ctselect.cpp]) |
| 33 | 33 | AC_CONFIG_MACRO_DIR([m4]) |
| 34 | 34 | #AM_INIT_AUTOMAKE([gnu no-dependencies foreign]) |
| 35 | -#AM_INIT_AUTOMAKE([gnu -Wno-portability foreign]) | |
| 36 | -AM_INIT_AUTOMAKE([gnu -Wno-portability foreign serial-tests]) | |
| 35 | +AM_INIT_AUTOMAKE([gnu -Wno-portability foreign]) | |
| 36 | +#AM_INIT_AUTOMAKE([gnu -Wno-portability foreign serial-tests]) | |
| 37 | 37 | AC_CONFIG_HEADER([config.h]) |
| 38 | 38 | |
| 39 | 39 | ... | ... |
test/test_cscript.py
| ... | ... | @@ -152,12 +152,8 @@ class ctobservation_test(ctools.csobservation): |
| 152 | 152 | """ |
| 153 | 153 | Constructor |
| 154 | 154 | """ |
| 155 | - # Set name | |
| 156 | - self._name = 'ctobservation_test' | |
| 157 | - self._version = ctools.__version__ | |
| 158 | - | |
| 159 | 155 | # Initialise application by calling the appropriate class constructor |
| 160 | - self._init_csobservation(argv) | |
| 156 | + self._init_csobservation('ctobservation_test', ctools.__version__, argv) | |
| 161 | 157 | |
| 162 | 158 | # Return |
| 163 | 159 | return |
| ... | ... | @@ -183,12 +179,8 @@ class ctlikelihood_test(ctools.cslikelihood): |
| 183 | 179 | """ |
| 184 | 180 | Constructor |
| 185 | 181 | """ |
| 186 | - # Set name | |
| 187 | - self._name = 'ctlikelihood_test' | |
| 188 | - self._version = ctools.__version__ | |
| 189 | - | |
| 190 | 182 | # Initialise application by calling the appropriate class constructor |
| 191 | - self._init_cslikelihood(argv) | |
| 183 | + self._init_cslikelihood('ctlikelihood_test', ctools.__version__, argv) | |
| 192 | 184 | |
| 193 | 185 | # Return |
| 194 | 186 | return | ... | ... |
test/test_csspec.py
| ... | ... | @@ -128,12 +128,12 @@ class Test(test): |
| 128 | 128 | spec['srcname'] = 'Crab' |
| 129 | 129 | spec['caldb'] = self._caldb |
| 130 | 130 | spec['irf'] = self._irf |
| 131 | - spec['outfile'] = 'csspec_py1.fits' | |
| 132 | 131 | spec['method'] = 'AUTO' |
| 133 | 132 | spec['ebinalg'] = 'LOG' |
| 134 | 133 | spec['enumbins'] = 5 |
| 135 | 134 | spec['emin'] = 0.1 |
| 136 | 135 | spec['emax'] = 100.0 |
| 136 | + spec['outfile'] = 'csspec_py1.fits' | |
| 137 | 137 | spec['logfile'] = 'csspec_py1.log' |
| 138 | 138 | spec['chatter'] = 2 |
| 139 | 139 | spec['publish'] = True |
| ... | ... | @@ -155,12 +155,12 @@ class Test(test): |
| 155 | 155 | spec['bkgcube'] = self._bkgcube |
| 156 | 156 | spec['inmodel'] = self._model |
| 157 | 157 | spec['srcname'] = 'Crab' |
| 158 | - spec['outfile'] = 'csspec_py2.fits' | |
| 159 | 158 | spec['method'] = 'AUTO' |
| 160 | 159 | spec['ebinalg'] = 'LOG' |
| 161 | 160 | spec['enumbins'] = 2 |
| 162 | 161 | spec['emin'] = 0.1 |
| 163 | 162 | spec['emax'] = 100.0 |
| 163 | + spec['outfile'] = 'csspec_py2.fits' | |
| 164 | 164 | spec['logfile'] = 'csspec_py2.log' |
| 165 | 165 | spec['chatter'] = 3 |
| 166 | 166 | spec['publish'] = False |
| ... | ... | @@ -176,12 +176,12 @@ class Test(test): |
| 176 | 176 | spec['inobs'] = self._inonoff |
| 177 | 177 | spec['inmodel'] = self._onoff_model |
| 178 | 178 | spec['srcname'] = 'Crab' |
| 179 | - spec['outfile'] = 'csspec_py3.fits' | |
| 180 | 179 | spec['method'] = 'AUTO' |
| 181 | 180 | spec['ebinalg'] = 'LOG' |
| 182 | 181 | spec['enumbins'] = 10 |
| 183 | 182 | spec['emin'] = 0.1 |
| 184 | 183 | spec['emax'] = 10.0 |
| 184 | + spec['outfile'] = 'csspec_py3.fits' | |
| 185 | 185 | spec['logfile'] = 'csspec_py3.log' |
| 186 | 186 | spec['chatter'] = 4 |
| 187 | 187 | spec['publish'] = False |
| ... | ... | @@ -197,12 +197,12 @@ class Test(test): |
| 197 | 197 | spec['inobs'] = self._inonoff |
| 198 | 198 | spec['inmodel'] = self._onoff_model |
| 199 | 199 | spec['srcname'] = 'Crab' |
| 200 | - spec['outfile'] = 'csspec_py4.fits' | |
| 201 | 200 | spec['method'] = 'NODES' |
| 202 | 201 | spec['ebinalg'] = 'LOG' |
| 203 | 202 | spec['enumbins'] = 10 |
| 204 | 203 | spec['emin'] = 0.1 |
| 205 | 204 | spec['emax'] = 10.0 |
| 205 | + spec['outfile'] = 'csspec_py4.fits' | |
| 206 | 206 | spec['logfile'] = 'csspec_py4.log' |
| 207 | 207 | spec['chatter'] = 4 |
| 208 | 208 | spec['publish'] = False |
| ... | ... | @@ -213,6 +213,27 @@ class Test(test): |
| 213 | 213 | # Check result file |
| 214 | 214 | self._check_result_file('csspec_py4.fits', 10) |
| 215 | 215 | |
| 216 | + # Set-up On/Off csspec using WSTAT | |
| 217 | + spec = cscripts.csspec() | |
| 218 | + spec['inobs'] = self._inonoff | |
| 219 | + spec['inmodel'] = self._onoff_model | |
| 220 | + spec['srcname'] = 'Crab' | |
| 221 | + spec['method'] = 'AUTO' | |
| 222 | + spec['statistic'] = 'WSTAT' | |
| 223 | + spec['ebinalg'] = 'LOG' | |
| 224 | + spec['enumbins'] = 10 | |
| 225 | + spec['emin'] = 0.1 | |
| 226 | + spec['emax'] = 10.0 | |
| 227 | + spec['outfile'] = 'csspec_py5.fits' | |
| 228 | + spec['logfile'] = 'csspec_py5.log' | |
| 229 | + spec['chatter'] = 2 | |
| 230 | + | |
| 231 | + # Execute csspec script | |
| 232 | + spec.execute() | |
| 233 | + | |
| 234 | + # Check result file | |
| 235 | + self._check_result_file('csspec_py5.fits', 10) | |
| 236 | + | |
| 216 | 237 | # Return |
| 217 | 238 | return |
| 218 | 239 | ... | ... |