From 39efcac2139059fa6c6f51798910348fdc1201cc Mon Sep 17 00:00:00 2001 From: Jürgen Knödlseder Date: Tue, 19 Nov 2013 01:25:47 +0100 Subject: [PATCH] Add some unit tests --- test/test_ctools.sh | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 78 insertions(+), 4 deletions(-) diff --git a/test/test_ctools.sh b/test/test_ctools.sh index 15e3498..97d1b20 100755 --- a/test/test_ctools.sh +++ b/test/test_ctools.sh @@ -93,8 +93,8 @@ $ctobssim infile="data/model_background_cube.xml" \ rad=1.0 \ tmin=0.0 \ tmax=1800.0 \ - emin=0.1 \ - emax=100.0 + emin=0.3 \ + emax=8.0 $ECHO -n "." if [ -s "events2.fits" ] then @@ -136,6 +136,8 @@ $ECHO " ok" # Test ctbin # ========== $ECHO -n "Test ctbin: " +# +# Run 1 $ctbin evfile="events.fits" \ outfile="cntmap.fits" \ emin=0.1 \ @@ -156,6 +158,28 @@ else $ECHO " cntmap.fits file is not valid" exit 1 fi +# +# Run 2 +$ctbin evfile="events2.fits" \ + outfile="cntmap2.fits" \ + emin=0.3 \ + emax=8.0 \ + enumbins=10 \ + nxpix=50 \ + nypix=50 \ + binsz=0.02 \ + coordsys="CEL" \ + xref=84.17263 \ + yref=22.01444 \ + proj="CAR" +$ECHO -n "." +if [ -s "cntmap2.fits" ] +then + $ECHO -n "." +else + $ECHO " cntmap2.fits file is not valid" + exit 1 +fi $ECHO " ok" @@ -179,9 +203,9 @@ else exit 1 fi # -# Run 2 +# Run 3 $ctmodel infile="NONE" \ - outfile="modmap2.fits" \ + outfile="modmap3.fits" \ caldb="irf" \ irf="cta_dummy_irf" \ srcmdl="data/crab.xml" \ @@ -200,6 +224,21 @@ $ctmodel infile="NONE" \ yref=22.01 \ proj="CAR" $ECHO -n "." +if [ -s "modmap3.fits" ] +then + $ECHO -n "." +else + $ECHO " modmap3.fits file is not valid" + exit 1 +fi +# +# Run 2 +$ctmodel infile="cntmap2.fits" \ + outfile="modmap2.fits" \ + caldb="irf" \ + irf="cta_dummy_irf" \ + srcmdl="data/model_background_cube.xml" +$ECHO -n "." if [ -s "modmap2.fits" ] then $ECHO -n "." @@ -238,6 +277,8 @@ $ECHO " ok" # Test ctlike # =========== $ECHO -n "Test ctlike: " +# +# Run 1 $ctlike infile="cntmap.fits" \ srcmdl="data/crab.xml" \ outmdl="results_binned.xml" \ @@ -251,6 +292,8 @@ else $ECHO " results_binned.xml file is not valid" exit 1 fi +# +# Run 2 $ctlike infile="selected_events.fits" \ srcmdl="data/crab.xml" \ outmdl="results_unbinned.xml" \ @@ -264,4 +307,35 @@ else $ECHO " results_unbinned.xml file is not valid" exit 1 fi +# +# Run 3 +$ctlike infile="events2.fits" \ + srcmdl="data/model_background_cube.xml" \ + outmdl="results_unbinned_background_cube.xml" \ + caldb="irf" \ + irf="cta_dummy_irf" +$ECHO -n "." +if [ -s "results_unbinned_background_cube.xml" ] +then + $ECHO -n "." +else + $ECHO " results_unbinned_background_cube.xml file is not valid" + exit 1 +fi +# +# Run 4 +$ctlike infile="cntmap2.fits" \ + srcmdl="data/model_background_cube.xml" \ + outmdl="results_binned_background_cube.xml" \ + caldb="irf" \ + irf="cta_dummy_irf" +$ECHO -n "." +if [ -s "results_binned_background_cube.xml" ] +then + $ECHO -n "." +else + $ECHO " results_binned_background_cube.xml file is not valid" + exit 1 +fi $ECHO " ok" +#sleep 100 \ No newline at end of file -- libgit2 0.21.4