#! /bin/sh # ========================================================================== # This script tests all cscripts that are shipped with ctools # # Copyright (C) 2011-2015 Juergen Knoedlseder # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # # ========================================================================== # # Get echo command (to circumvent built-in echo on some systems) # ECHO=`which echo` # # Print Header # $ECHO "" $ECHO "*****************" $ECHO "* Test cscripts *" $ECHO "*****************" # # Remove any existing result files # ================================ rm -rf *.fits *.xml *.dat # # Creates pfiles directory # ======================== rm -rf pfiles mkdir -p pfiles cp -r ../src/*/*.par pfiles/ export PFILES=pfiles # # Test csobsdef # ============= $ECHO -n "Test csobsdef: " chmod +x @abs_top_srcdir@/scripts/csobsdef.py @abs_top_srcdir@/scripts/csobsdef.py \ inpnt="data/pntdef.dat" \ outobs="obs.xml" \ caldb="irf" \ irf="cta_dummy_irf" \ emin=0.1 \ emax=100.0 \ duration=1800.0 \ rad=5.0 > csobsdef.log $ECHO -n "." if [ -s "obs.xml" ] then $ECHO -n "." else $ECHO " obs.xml file is not valid" exit 1 fi $ECHO " ok" # # Test cspull # =========== $ECHO -n "Test cspull: " chmod +x @abs_top_srcdir@/scripts/cspull.py @abs_top_srcdir@/scripts/cspull.py \ inmodel="data/crab.xml" \ outfile="pull.dat" \ ntrials="3" \ caldb="irf" \ irf="cta_dummy_irf" \ ra=83.6331 \ dec=22.0145 \ emin=0.1 \ emax=100.0 \ enumbins=0 \ tmax=1800.0 \ deadc=0.95 \ rad=5.0 \ npix=200 \ debug=yes \ binsz=0.05 > cspull.log $ECHO -n "." if [ -s "pull.dat" ] then $ECHO -n "." else $ECHO " pull.dat file is not valid" exit 1 fi $ECHO " ok" # # Test cssens # =========== $ECHO -n "Test cssens: " chmod +x @abs_top_srcdir@/scripts/cssens.py @abs_top_srcdir@/scripts/cssens.py \ inmodel="data/crab.xml" \ srcname="Crab" \ caldb="irf" \ irf="cta_dummy_irf" \ duration=1800.0 \ rad=3.0 \ emin=1.0 \ emax=10.0 \ bins=1 > cssens.log $ECHO -n "." if [ -s "sensitivity.dat" ] then $ECHO -n "." else $ECHO " sensitivity.dat file is not valid" exit 1 fi $ECHO " ok" # # Test cstsdist # ============= $ECHO -n "Test cstsdist: " chmod +x @abs_top_srcdir@/scripts/cstsdist.py @abs_top_srcdir@/scripts/cstsdist.py \ inmodel="data/crab.xml" \ srcname="Crab" \ outfile="ts.dat" \ ntrials="1" \ caldb="irf" \ irf="cta_dummy_irf" \ ra=83.63 \ dec=22.01 \ emin=0.1 \ emax=100.0 \ enumbins=0 \ tmax=1800.0 \ rad=5.0 \ npix=200 \ binsz=0.05 > cstsdist.log $ECHO -n "." if [ -s "ts.dat" ] then $ECHO -n "." else $ECHO " ts.dat file is not valid" exit 1 fi $ECHO " ok" # # Test csresmap # ============= $ECHO -n "Test csresmap: " chmod +x @abs_top_srcdir@/scripts/csresmap.py @abs_top_srcdir@/scripts/csresmap.py \ inobs="data/crab_events.fits" \ outmap="resmap.fits" \ inmodel="data/crab.xml" \ caldb="irf" \ irf="cta_dummy_irf" \ nxpix=50 \ nypix=50 \ binsz=0.02 \ coordsys="CEL" \ xref=83.63 \ yref=22.01 \ proj="CAR" \ binsz=0.05 \ algorithm="SUBDIV" > csresmap.log $ECHO -n "." if [ -s "resmap.fits" ] then $ECHO -n "." else $ECHO " resmap.fits file is not valid" exit 1 fi $ECHO " ok" # # Test csspec (unbinned) # ===================== $ECHO -n "Test csspec (unbinned): " chmod +x @abs_top_srcdir@/scripts/csspec.py @abs_top_srcdir@/scripts/csspec.py \ inobs="data/crab_events.fits" \ inmodel="data/crab.xml" \ caldb="irf" \ irf="cta_dummy_irf" \ enumbins=5 \ srcname="Crab" \ emin=0.1 \ emax=100.0 \ binned=no \ outfile="spectrum.fits" > csspec.log $ECHO -n "." if [ -s "spectrum.fits" ] then $ECHO -n "." else $ECHO " spectrum.fits file is not valid" exit 1 fi $ECHO " ok" # # Test csspec (binned) # ==================== $ECHO -n "Test csspec (binned): " chmod +x @abs_top_srcdir@/scripts/csspec.py @abs_top_srcdir@/scripts/csspec.py \ inobs="data/crab_events.fits" \ inmodel="data/crab.xml" \ caldb="irf" \ irf="cta_dummy_irf" \ enumbins=3 \ srcname="Crab" \ emin=0.1 \ emax=100.0 \ binned=yes \ nxpix=10 \ nypix=10 \ binsz=0.1 \ nebins=2 \ coordsys="CEL" \ xref=83.63 \ yref=22.01 \ proj="CAR" \ outfile="spectrum.fits" > csspec.log $ECHO -n "." if [ -s "spectrum.fits" ] then $ECHO -n "." else $ECHO " spectrum.fits file is not valid" exit 1 fi $ECHO " ok" # # Test cslightcrv (unbinned) # ========================== $ECHO -n "Test cslightcrv (unbinned): " chmod +x @abs_top_srcdir@/scripts/cslightcrv.py @abs_top_srcdir@/scripts/cslightcrv.py \ inobs="data/crab_events.fits" \ inmodel="data/crab.xml" \ srcname="Crab" \ caldb="irf" \ irf="cta_dummy_irf" \ tbinalg="LIN" \ tmin=51544.5 \ tmax=51544.53 \ tbins=3 \ enumbins=0 \ emin=0.1 \ emax=100.0 \ outfile="lightcurve.fits" > cslightcrv.log $ECHO -n "." if [ -s "lightcurve.fits" ] then $ECHO -n "." else $ECHO " lightcurve.fits file is not valid" exit 1 fi $ECHO " ok" # # Test cslightcrv (binned) # ======================== $ECHO -n "Test cslightcrv (binned): " chmod +x @abs_top_srcdir@/scripts/cslightcrv.py @abs_top_srcdir@/scripts/cslightcrv.py \ inobs="data/crab_events.fits" \ inmodel="data/crab.xml" \ srcname="Crab" \ caldb="irf" \ irf="cta_dummy_irf" \ tbinalg="GTI" \ enumbins=2 \ emin=0.1 \ emax=100.0 \ coordsys="CEL" \ proj="CAR" \ xref=83.63 \ yref=22.01 \ nxpix=10 \ nypix=10 \ binsz=0.1 \ outfile="lightcurve.fits" > cslightcrv.log $ECHO -n "." if [ -s "lightcurve.fits" ] then $ECHO -n "." else $ECHO " lightcurve.fits file is not valid" exit 1 fi $ECHO " ok"