Commit 39efcac2139059fa6c6f51798910348fdc1201cc

Authored by Jürgen Knödlseder
1 parent 2f8378ba

Add some unit tests

Showing 1 changed file with 78 additions and 4 deletions
test/test_ctools.sh
... ... @@ -93,8 +93,8 @@ $ctobssim infile="data/model_background_cube.xml" \
93 93 rad=1.0 \
94 94 tmin=0.0 \
95 95 tmax=1800.0 \
96   - emin=0.1 \
97   - emax=100.0
  96 + emin=0.3 \
  97 + emax=8.0
98 98 $ECHO -n "."
99 99 if [ -s "events2.fits" ]
100 100 then
... ... @@ -136,6 +136,8 @@ $ECHO " ok"
136 136 # Test ctbin
137 137 # ==========
138 138 $ECHO -n "Test ctbin: "
  139 +#
  140 +# Run 1
139 141 $ctbin evfile="events.fits" \
140 142 outfile="cntmap.fits" \
141 143 emin=0.1 \
... ... @@ -156,6 +158,28 @@ else
156 158 $ECHO " cntmap.fits file is not valid"
157 159 exit 1
158 160 fi
  161 +#
  162 +# Run 2
  163 +$ctbin evfile="events2.fits" \
  164 + outfile="cntmap2.fits" \
  165 + emin=0.3 \
  166 + emax=8.0 \
  167 + enumbins=10 \
  168 + nxpix=50 \
  169 + nypix=50 \
  170 + binsz=0.02 \
  171 + coordsys="CEL" \
  172 + xref=84.17263 \
  173 + yref=22.01444 \
  174 + proj="CAR"
  175 +$ECHO -n "."
  176 +if [ -s "cntmap2.fits" ]
  177 +then
  178 + $ECHO -n "."
  179 +else
  180 + $ECHO " cntmap2.fits file is not valid"
  181 + exit 1
  182 +fi
159 183 $ECHO " ok"
160 184  
161 185  
... ... @@ -179,9 +203,9 @@ else
179 203 exit 1
180 204 fi
181 205 #
182   -# Run 2
  206 +# Run 3
183 207 $ctmodel infile="NONE" \
184   - outfile="modmap2.fits" \
  208 + outfile="modmap3.fits" \
185 209 caldb="irf" \
186 210 irf="cta_dummy_irf" \
187 211 srcmdl="data/crab.xml" \
... ... @@ -200,6 +224,21 @@ $ctmodel infile="NONE" \
200 224 yref=22.01 \
201 225 proj="CAR"
202 226 $ECHO -n "."
  227 +if [ -s "modmap3.fits" ]
  228 +then
  229 + $ECHO -n "."
  230 +else
  231 + $ECHO " modmap3.fits file is not valid"
  232 + exit 1
  233 +fi
  234 +#
  235 +# Run 2
  236 +$ctmodel infile="cntmap2.fits" \
  237 + outfile="modmap2.fits" \
  238 + caldb="irf" \
  239 + irf="cta_dummy_irf" \
  240 + srcmdl="data/model_background_cube.xml"
  241 +$ECHO -n "."
203 242 if [ -s "modmap2.fits" ]
204 243 then
205 244 $ECHO -n "."
... ... @@ -238,6 +277,8 @@ $ECHO " ok"
238 277 # Test ctlike
239 278 # ===========
240 279 $ECHO -n "Test ctlike: "
  280 +#
  281 +# Run 1
241 282 $ctlike infile="cntmap.fits" \
242 283 srcmdl="data/crab.xml" \
243 284 outmdl="results_binned.xml" \
... ... @@ -251,6 +292,8 @@ else
251 292 $ECHO " results_binned.xml file is not valid"
252 293 exit 1
253 294 fi
  295 +#
  296 +# Run 2
254 297 $ctlike infile="selected_events.fits" \
255 298 srcmdl="data/crab.xml" \
256 299 outmdl="results_unbinned.xml" \
... ... @@ -264,4 +307,35 @@ else
264 307 $ECHO " results_unbinned.xml file is not valid"
265 308 exit 1
266 309 fi
  310 +#
  311 +# Run 3
  312 +$ctlike infile="events2.fits" \
  313 + srcmdl="data/model_background_cube.xml" \
  314 + outmdl="results_unbinned_background_cube.xml" \
  315 + caldb="irf" \
  316 + irf="cta_dummy_irf"
  317 +$ECHO -n "."
  318 +if [ -s "results_unbinned_background_cube.xml" ]
  319 +then
  320 + $ECHO -n "."
  321 +else
  322 + $ECHO " results_unbinned_background_cube.xml file is not valid"
  323 + exit 1
  324 +fi
  325 +#
  326 +# Run 4
  327 +$ctlike infile="cntmap2.fits" \
  328 + srcmdl="data/model_background_cube.xml" \
  329 + outmdl="results_binned_background_cube.xml" \
  330 + caldb="irf" \
  331 + irf="cta_dummy_irf"
  332 +$ECHO -n "."
  333 +if [ -s "results_binned_background_cube.xml" ]
  334 +then
  335 + $ECHO -n "."
  336 +else
  337 + $ECHO " results_binned_background_cube.xml file is not valid"
  338 + exit 1
  339 +fi
267 340 $ECHO " ok"
  341 +#sleep 100
268 342 \ No newline at end of file
... ...