From d063ccd141601b3d2af918ffceff2c002c00d817 Mon Sep 17 00:00:00 2001 From: Michael Mayer Date: Wed, 11 Mar 2015 11:01:03 +0100 Subject: [PATCH] adjust interface of ctools to properly load binned response. Modified ctbkgcube accordingly --- pyext/ctbkgcube.i | 1 + scripts/cspull.py | 6 +++--- src/ctbkgcube/ctbkgcube.cpp | 99 +++++++++++++++++++++++++++++++++++++++++---------------------------------------------------------- src/ctbkgcube/ctbkgcube.hpp | 17 ++++++++++++++++- src/ctbkgcube/ctbkgcube.par | 4 ++-- src/ctbutterfly/ctbutterfly.par | 1 + src/ctlike/ctlike.par | 1 + src/ctmodel/ctmodel.par | 1 + src/cttsmap/cttsmap.par | 1 + src/ctulimit/ctulimit.par | 1 + src/support/ctool.cpp | 11 +++++++---- test/data/model_background_cube.xml | 13 ------------- test/data/model_background_cube_const.xml | 11 ----------- test/data/model_cube_background.xml | 10 ++++++++++ test/data/test_cube.fits | Bin 66240 -> 0 bytes test/test_ctools.sh | 439 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 16 files changed, 290 insertions(+), 326 deletions(-) delete mode 100644 test/data/model_background_cube.xml delete mode 100644 test/data/model_background_cube_const.xml create mode 100644 test/data/model_cube_background.xml delete mode 100644 test/data/test_cube.fits diff --git a/pyext/ctbkgcube.i b/pyext/ctbkgcube.i index 33e1f11..bc950b9 100644 --- a/pyext/ctbkgcube.i +++ b/pyext/ctbkgcube.i @@ -47,6 +47,7 @@ public: void clear(void); void run(void); void save(void); + const GCTACubeBackground& bgcube(void) const; const GCTAEventCube& cube(void) const; const GModels& models(void) const; }; diff --git a/scripts/cspull.py b/scripts/cspull.py index f2972b6..f6cb8fb 100755 --- a/scripts/cspull.py +++ b/scripts/cspull.py @@ -107,8 +107,8 @@ class cspull(ctools.cscript): pars.append(gammalib.GApplicationPar("tmin","r","h","0.0","","","Start time (MET in s)")) pars.append(gammalib.GApplicationPar("tmax","r","a","1800.0","","","Duration (in s)")) pars.append(gammalib.GApplicationPar("enumbins","i","a","0","","","Number of energy bins (0=unbinned)")) - pars.append(gammalib.GApplicationPar("npix","i","h","200","","","Number of pixels for binned")) - pars.append(gammalib.GApplicationPar("binsz","r","h","0.05","","","Pixel size for binned (deg/pixel)")) + pars.append(gammalib.GApplicationPar("npix","i","a","200","","","Number of pixels for binned")) + pars.append(gammalib.GApplicationPar("binsz","r","a","0.05","","","Pixel size for binned (deg/pixel)")) pars.append(gammalib.GApplicationPar("deadc","r","h","0.95","0","1","Deadtime correction factor")) pars.append(gammalib.GApplicationPar("rad","r","h","5.0","0","180","Radius of ROI (deg)")) pars.append(gammalib.GApplicationPar("pattern","s","h","single","","","Observation pattern (single/four)")) @@ -140,7 +140,7 @@ class cspull(ctools.cscript): # Get number of energy bins self.m_enumbins = self["enumbins"].integer() - + # Read parameters for binned if requested if not self.m_enumbins == 0: self.m_npix = self["npix"].integer() diff --git a/src/ctbkgcube/ctbkgcube.cpp b/src/ctbkgcube/ctbkgcube.cpp index 56d8647..43718b4 100644 --- a/src/ctbkgcube/ctbkgcube.cpp +++ b/src/ctbkgcube/ctbkgcube.cpp @@ -360,18 +360,28 @@ void ctbkgcube::run(void) log << n_observations << std::endl; } - // Create a background model for output background cube and append + // Set cube background response + m_background.set(m_bkgcube.map(), m_bkgcube.ebounds()); + + // Create a background model for the output background cube and append // that model to the input model in place of the original - // background model - GEnergies energies; - for (int i = 0; i < m_bkgcube.ebins(); ++i) { - energies.append(m_bkgcube.energy(i)); - } - GModelSpatialDiffuseCube spatial(m_bkgcube.map(), energies, 1.0); - GModelSpectralPlaw spectral(1.0, 0.0, GEnergy(1.0, "TeV")); - GCTAModelCubeBackground model(spatial, spectral); - model.name("ctbkgcube default background model"); - m_cube_model = m_outmdl.size(); // Store the slot number for save() + // background models + // Todo: We might think of creating the spectral model via user parameter + GCTAModelCubeBackground model(GModelSpectralConst(1.0)); + + // Set model name + model.name("BackgroundModel"); + + // Set model instrument + // Todo: Account for possibility to have observations from different + // IACTs in the same container + model.instruments("CTA,HESS,MAGIC,VERITAS"); + + // Set model identifier to "0". This is coupled to ctbin, where the binned output + // observation id is set to 0. + model.ids("0"); + + // Append model to output container m_outmdl.append(model); // Log output model @@ -399,47 +409,19 @@ void ctbkgcube::save(void) log.header1("Save background cube"); } - // Create energies container from energy boundaries - GEnergies energies; - for (int i = 0; i < m_ebounds.size(); ++i) { - energies.append(m_ebounds.elogmean(i)); - } // Get output filenames std::string outfile = (*this)["outcube"].filename(); std::string outmodel = (*this)["outmodel"].filename(); - // Create empty FITS file - GFits fits; - - // Write background cube - m_bkgcube.map().write(fits); - - // Write energies - energies.write(fits); - - // Save FITS file - fits.saveto(outfile, clobber()); + // Save background cube + m_background.save(outfile, clobber()); // Write output models if filename is valid if ((outmodel.length() > 0) && (gammalib::tolower(outmodel) != "none")) { - // Set filename of map cube. - if (m_cube_model >= 0) { - GCTAModelCubeBackground* model = - dynamic_cast(m_outmdl[m_cube_model]); - if (model != NULL) { - GModelSpatialDiffuseCube* spatial = - dynamic_cast(model->spatial()); - if (spatial != NULL) { - spatial->filename(outfile); - } - } - } - - // Save output model container + // Save output model for binned analyses m_outmdl.save(outmodel); - } // Return @@ -463,6 +445,7 @@ void ctbkgcube::init_members(void) m_outmodel.clear(); m_obs.clear(); m_bkgcube.clear(); + m_background.clear(); m_bkgmdl.clear(); m_outmdl.clear(); m_ebounds.clear(); @@ -486,6 +469,7 @@ void ctbkgcube::copy_members(const ctbkgcube& app) m_outcube = app.m_outcube; m_obs = app.m_obs; m_bkgcube = app.m_bkgcube; + m_background = app.m_background; m_bkgmdl = app.m_bkgmdl; m_outmdl = app.m_outmdl; m_ebounds = app.m_ebounds; @@ -530,22 +514,6 @@ void ctbkgcube::get_parameters(void) } // endif: there was no observation in the container - - // If there are no models associated with the observations then load now - // the model definition from the XML file - if (m_obs.models().size() == 0) { - if ((*this)["inmodel"].is_undefined()) { - std::string msg = "No model definition XML file specified. " - "Please set the \"inmodel\" parameter to the " - "XML file that contains the background model " - "definition."; - throw GException::invalid_value(G_GET_PARAMETERS, msg); - } - std::string inmodel = (*this)["inmodel"].filename(); - GModels models(inmodel); - m_obs.models(models); - } - // Get the incube filename std::string incube = (*this)["incube"].filename(); @@ -574,6 +542,21 @@ void ctbkgcube::get_parameters(void) } // endelse: cube was loaded from file + // If there are no models associated with the observations then load now + // the model definition from the XML file + if (m_obs.models().size() == 0) { + if ((*this)["inmodel"].is_undefined()) { + std::string msg = "No model definition XML file specified. " + "Please set the \"inmodel\" parameter to the " + "XML file that contains the background model " + "definition."; + throw GException::invalid_value(G_GET_PARAMETERS, msg); + } + std::string inmodel = (*this)["inmodel"].filename(); + GModels models(inmodel); + m_obs.models(models); + } + // Get energy definition m_ebounds = m_bkgcube.ebounds(); diff --git a/src/ctbkgcube/ctbkgcube.hpp b/src/ctbkgcube/ctbkgcube.hpp index dae4042..1a1306e 100644 --- a/src/ctbkgcube/ctbkgcube.hpp +++ b/src/ctbkgcube/ctbkgcube.hpp @@ -59,6 +59,7 @@ public: void clear(void); void run(void); void save(void); + const GCTACubeBackground& bgcube(void) const; const GCTAEventCube& cube(void) const; const GModels& models(void) const; @@ -74,7 +75,8 @@ protected: std::string m_outcube; //!< Filename of output cube std::string m_outmodel; //!< Filename of output XML model GObservations m_obs; //!< Observation container - GCTAEventCube m_bkgcube; //!< Background cube + GCTAEventCube m_bkgcube; //!< Background event cube + GCTACubeBackground m_background; //!< Background cube response GModels m_bkgmdl; //!< CTA background models GModels m_outmdl; //!< Output models GEbounds m_ebounds; //!< Energy boundaries @@ -95,6 +97,19 @@ const GCTAEventCube& ctbkgcube::cube(void) const return (m_bkgcube); } +/***********************************************************************//** + * @brief Return background response cube containing background rate + * + * @return Background response cube. + ***************************************************************************/ +inline +const GCTACubeBackground& ctbkgcube::bgcube(void) const +{ + // Return background cube + return (m_background); +} + + /***********************************************************************//** * @brief Return background model container diff --git a/src/ctbkgcube/ctbkgcube.par b/src/ctbkgcube/ctbkgcube.par index 272d150..400642d 100644 --- a/src/ctbkgcube/ctbkgcube.par +++ b/src/ctbkgcube/ctbkgcube.par @@ -18,10 +18,10 @@ # Observational parameters #=================== inobs, f, a, "NONE",,, "Input event list or observation definition file" -inmodel, f, a, "NONE",,, "Input (background) model XML file" +inmodel, f, a, "NONE",,, "Input model XML file" incube, f, a, "NONE",,, "Counts cube for background cube definition" outcube, f, a, "bkgcube.fits",,, "Output background cube file" -outmodel, f, a, "NONE",,, "Output (background) model XML file" +outmodel, f, a, "NONE",,, "Output model XML file" caldb, s, a, "dummy",,, "Calibration database" irf, s, a, "cta_dummy_irf",,, "Instrument response function" # diff --git a/src/ctbutterfly/ctbutterfly.par b/src/ctbutterfly/ctbutterfly.par index b823d03..3b655d4 100644 --- a/src/ctbutterfly/ctbutterfly.par +++ b/src/ctbutterfly/ctbutterfly.par @@ -22,6 +22,7 @@ inmodel, f, a, "$CTOOLS/share/models/crab.xml",,, "Source model" srcname, s, a, "Crab",,,"Source of interest" expcube, f, a, "NONE",,, "Exposure cube file (only needed for stacked analysis)" psfcube, f, a, "NONE",,, "PSF cube file (only needed for stacked analysis)" +bgcube, f, a, "NONE",,, "Background cube file (only needed for stacked analysis)" caldb, s, a, "dummy",,, "Calibration database" irf, s, a, "cta_dummy_irf",,, "Instrument response function" outfile, f, a, "butterfly.txt",,, "Output ascii file" diff --git a/src/ctlike/ctlike.par b/src/ctlike/ctlike.par index 19dc39f..0ebd173 100644 --- a/src/ctlike/ctlike.par +++ b/src/ctlike/ctlike.par @@ -21,6 +21,7 @@ inobs, f, a, "events.fits",,, "Event list, counts cube or observation definit inmodel, f, a, "$CTOOLS/share/models/crab.xml",,, "Source model" expcube, f, a, "NONE",,, "Exposure cube file (only needed for stacked analysis)" psfcube, f, a, "NONE",,, "PSF cube file (only needed for stacked analysis)" +bgcube, f, a, "NONE",,, "Background cube file (only needed for stacked analysis)" caldb, s, a, "dummy",,, "Calibration database" irf, s, a, "cta_dummy_irf",,, "Instrument response function" outmodel, f, a, "crab_results.xml",,, "Source model output file" diff --git a/src/ctmodel/ctmodel.par b/src/ctmodel/ctmodel.par index 9cd20a9..e8d5a6a 100644 --- a/src/ctmodel/ctmodel.par +++ b/src/ctmodel/ctmodel.par @@ -27,6 +27,7 @@ edisp, b, h, no,,, "Apply energy dispersion?" inobs, f, a, "NONE",,, "Event list, counts cube or observation definition file" expcube, f, a, "NONE",,, "Exposure cube file (only needed for stacked analysis)" psfcube, f, a, "NONE",,, "PSF cube file (only needed for stacked analysis)" +bgcube, f, a, "NONE",,, "Background cube file (only needed for stacked analysis)" caldb, s, a, "dummy",,, "Calibration database" irf, s, a, "cta_dummy_irf",,, "Instrument response function" ra, r, a, 83.63,0,360, "RA of pointing (degrees)" diff --git a/src/cttsmap/cttsmap.par b/src/cttsmap/cttsmap.par index 862c497..53d1626 100644 --- a/src/cttsmap/cttsmap.par +++ b/src/cttsmap/cttsmap.par @@ -22,6 +22,7 @@ inmodel, f, a, "$CTOOLS/share/models/crab.xml",,, "Source model" srcname, s, a, "Crab",,, "Test source" expcube, f, a, "NONE",,, "Exposure cube file (only needed for stacked analysis)" psfcube, f, a, "NONE",,, "PSF cube file (only needed for stacked analysis)" +bgcube, f, a, "NONE",,, "Background cube file (only needed for stacked analysis)" caldb, s, a, "dummy",,, "Calibration database" irf, s, a, "cta_dummy_irf",,, "Instrument response function" outmap, f, a, "tsmap.fits",,, "Output Test Statistic map" diff --git a/src/ctulimit/ctulimit.par b/src/ctulimit/ctulimit.par index d3cf453..1869ac5 100644 --- a/src/ctulimit/ctulimit.par +++ b/src/ctulimit/ctulimit.par @@ -22,6 +22,7 @@ inmodel, f, a, "$CTOOLS/share/models/crab.xml",,, "Source model" srcname, s, a, "Crab",,, "Source of interest" expcube, f, a, "NONE",,, "Exposure cube file (only needed for stacked analysis)" psfcube, f, a, "NONE",,, "PSF cube file (only needed for stacked analysis)" +bgcube, f, a, "NONE",,, "Background cube file (only needed for stacked analysis)" caldb, s, a, "dummy",,, "Calibration database" irf, s, a, "cta_dummy_irf",,, "Instrument response function" diff --git a/src/support/ctool.cpp b/src/support/ctool.cpp index 8ff4d8e..6d3dc11 100644 --- a/src/support/ctool.cpp +++ b/src/support/ctool.cpp @@ -731,23 +731,26 @@ void ctool::set_obs_response(GCTAObservation* obs) // If the observation contains a counts cube, then first check whether // the expcube and psfcube parameters exist and are not NONE if (dynamic_cast(obs->events()) != NULL) { - if (has_par("expcube") && has_par("psfcube")) { + if (has_par("expcube") && has_par("psfcube") && has_par("bgcube")) { // Get filenames std::string expcube = (*this)["expcube"].filename(); std::string psfcube = (*this)["psfcube"].filename(); + std::string bgcube = (*this)["bgcube"].filename(); // Extract response information if available - if ((expcube != "NONE") && (psfcube != "NONE") && + if ((expcube != "NONE") && (psfcube != "NONE") && (bgcube != "NONE") && (gammalib::strip_whitespace(expcube) != "") && - (gammalib::strip_whitespace(psfcube) != "")) { + (gammalib::strip_whitespace(psfcube) != "") && + (gammalib::strip_whitespace(bgcube) != "")) { // Get exposure and PSF cubes GCTACubeExposure exposure(expcube); GCTACubePsf psf(psfcube); + GCTACubeBackground background(bgcube); // Set reponse - obs->response(exposure, psf); + obs->response(exposure, psf, background); // Signal response availability has_response = true; diff --git a/test/data/model_background_cube.xml b/test/data/model_background_cube.xml deleted file mode 100644 index 6491db6..0000000 --- a/test/data/model_background_cube.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff --git a/test/data/model_background_cube_const.xml b/test/data/model_background_cube_const.xml deleted file mode 100644 index b337a8f..0000000 --- a/test/data/model_background_cube_const.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/test/data/model_cube_background.xml b/test/data/model_cube_background.xml new file mode 100644 index 0000000..2cea6fe --- /dev/null +++ b/test/data/model_cube_background.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/test/data/test_cube.fits b/test/data/test_cube.fits deleted file mode 100644 index 0d7988d..0000000 Binary files a/test/data/test_cube.fits and /dev/null differ diff --git a/test/test_ctools.sh b/test/test_ctools.sh index aa51ca1..302de80 100755 --- a/test/test_ctools.sh +++ b/test/test_ctools.sh @@ -91,27 +91,6 @@ else echo " events.fits file is not found" exit 1 fi -# -# Run 2 -$ctobssim inmodel="data/model_background_cube.xml" \ - outevents="events2.fits" \ - caldb="irf" \ - irf="cta_dummy_irf" \ - ra=84.17263 \ - dec=22.01444 \ - rad=1.0 \ - tmin=0.0 \ - tmax=1.0 \ - emin=0.3 \ - emax=8.0 chatter=4 -$ECHO -n "." -if [ -s "events2.fits" ] -then - $ECHO -n "." -else - echo " events2.fits file is not found" - exit 1 -fi $ECHO " ok" @@ -148,7 +127,7 @@ $ECHO -n "Test ctbin: " # # Run 1 $ctbin inobs="events.fits" \ - outcube="cntmap.fits" \ + outcube="cntmap1.fits" \ emin=0.1 \ emax=100.0 \ enumbins=20 \ @@ -161,27 +140,27 @@ $ctbin inobs="events.fits" \ yref=22.01 \ proj="CAR" $ECHO -n "." -if [ -s "cntmap.fits" ] +if [ -s "cntmap1.fits" ] then $ECHO -n "." else - $ECHO " cntmap.fits file is not found" + $ECHO " cntmap1.fits file is not found" exit 1 fi # # Run 2 -$ctbin inobs="events2.fits" \ +$ctbin inobs="events.fits" \ outcube="cntmap2.fits" \ emin=0.3 \ emax=8.0 \ - enumbins=10 \ + enumbins=7 \ ebinalg="LOG" \ - nxpix=50 \ - nypix=50 \ - binsz=0.02 \ + nxpix=30 \ + nypix=30 \ + binsz=0.05 \ coordsys="CEL" \ - xref=84.17263 \ - yref=22.01444 \ + xref=86.63 \ + yref=22.01 \ proj="CAR" $ECHO -n "." if [ -s "cntmap2.fits" ] @@ -193,6 +172,168 @@ else fi $ECHO " ok" +# +# Test ctexpcube +# ============== +$ECHO -n "Test ctexpcube: " +# +# Run 1 +$ctexpcube inobs="data/crab_events.fits" \ +incube="NONE" \ +outcube="expcube1.fits" \ +caldb="irf" \ +irf="cta_dummy_irf" \ +emin=0.1 \ +emax=100.0 \ +enumbins=20 \ +nxpix=200 \ +nypix=200 \ +binsz=0.02 \ +coordsys="CEL" \ +xref=83.63 \ +yref=22.01 \ +proj="CAR" +$ECHO -n "." +if [ -s "expcube1.fits" ] +then +$ECHO -n "." +else +$ECHO " expcube1.fits file is not found" +exit 1 +fi +# +# Run 2 +$ctexpcube inobs="events.fits" \ +incube="cntmap2.fits" \ +outcube="expcube2.fits" \ +caldb="irf" \ +irf="cta_dummy_irf" +$ECHO -n "." +if [ -s "expcube2.fits" ] +then +$ECHO -n "." +else +$ECHO " expcube2.fits file is not found" +exit 1 +fi +$ECHO " ok" + + +# +# Test ctpsfcube +# ============== +$ECHO -n "Test ctpsfcube: " +# +# Run 1 +$ctpsfcube inobs="data/crab_events.fits" \ +incube="NONE" \ +outcube="psfcube1.fits" \ +caldb="irf" \ +irf="cta_dummy_irf" \ +emin=0.1 \ +emax=100.0 \ +enumbins=20 \ +nxpix=10 \ +nypix=10 \ +binsz=0.4 \ +coordsys="CEL" \ +xref=83.63 \ +yref=22.01 \ +proj="CAR" \ +amax=0.3 \ +anumbins=10 +$ECHO -n "." +if [ -s "psfcube1.fits" ] +then +$ECHO -n "." +else +$ECHO " psfcube1.fits file is not found" +exit 1 +fi +# +# Run 2 +$ctpsfcube inobs="events.fits" \ +incube="cntmap2.fits" \ +outcube="psfcube2.fits" \ +caldb="irf" \ +irf="cta_dummy_irf" \ +amax=0.3 \ +anumbins=2 +$ECHO -n "." +if [ -s "psfcube2.fits" ] +then +$ECHO -n "." +else +$ECHO " psfcube2.fits file is not found" +exit 1 +fi +$ECHO " ok" + + +# +# Test ctbkgcube +# ============== +$ECHO -n "Test ctbkgcube: " +# +# Run 1 +$ctbkgcube inobs="data/crab_events.fits" \ +inmodel="data/crab.xml" \ +incube="NONE" \ +outcube="bkgcube1.fits" \ +outmodel="bkgcube1.xml" \ +caldb="irf" \ +irf="cta_dummy_irf" \ +emin=0.1 \ +emax=100.0 \ +enumbins=20 \ +nxpix=10 \ +nypix=10 \ +binsz=0.4 \ +coordsys="CEL" \ +xref=83.63 \ +yref=22.01 \ +proj="CAR" +$ECHO -n "." +if [ -s "bkgcube1.fits" ] +then +$ECHO -n "." +else +$ECHO " bkgcube1.fits file is not found" +exit 1 +fi +if [ -s "bkgcube1.xml" ] +then +$ECHO -n "." +else +$ECHO " bkgcube1.xml file is not found" +exit 1 +fi +# +# Run 2 +$ctbkgcube inobs="events.fits" \ +inmodel="data/crab.xml" \ +incube="cntmap2.fits" \ +caldb="irf" \ +irf="cta_dummy_irf" \ +outcube="bkgcube2.fits" \ +outmodel="bkgcube2.xml" +$ECHO -n "." +if [ -s "bkgcube2.fits" ] +then +$ECHO -n "." +else +$ECHO " bkgcube2.fits file is not found" +exit 1 +fi +if [ -s "bkgcube2.fits" ] +then +$ECHO -n "." +else +$ECHO " bkgcube2.xml file is not found" +exit 1 +fi +$ECHO " ok" + # @@ -201,11 +342,12 @@ $ECHO " ok" $ECHO -n "Test ctmodel: " # # Run 1 -$ctmodel inobs="cntmap.fits" \ - incube="cntmap.fits" \ +$ctmodel inobs="cntmap1.fits" \ + incube="cntmap1.fits" \ outcube="modmap1.fits" \ expcube="NONE" \ psfcube="NONE" \ + bgcube="NONE" \ caldb="irf" \ irf="cta_dummy_irf" \ inmodel="data/crab.xml" @@ -218,6 +360,26 @@ else exit 1 fi # +# Run 2 +$ctmodel inobs="cntmap2.fits" \ +incube="cntmap2.fits" \ +outcube="modmap2.fits" \ +expcube="expcube2.fits" \ +psfcube="psfcube2.fits" \ +bgcube="bkgcube2.fits" \ +caldb="irf" \ +irf="cta_dummy_irf" \ +inmodel="bkgcube2.xml" +$ECHO -n "." +if [ -s "modmap2.fits" ] +then +$ECHO -n "." +else +$ECHO " modmap2.fits file is not found" +exit 1 +fi + +# # Run 3 $ctmodel inobs="NONE" \ incube="NONE" \ @@ -248,24 +410,6 @@ else $ECHO " modmap3.fits file is not found" exit 1 fi -# -# Run 2 -$ctmodel inobs="cntmap2.fits" \ - incube="cntmap2.fits" \ - outcube="modmap2.fits" \ - expcube="NONE" \ - psfcube="NONE" \ - caldb="irf" \ - irf="cta_dummy_irf" \ - inmodel="data/model_background_cube.xml" -$ECHO -n "." -if [ -s "modmap2.fits" ] -then - $ECHO -n "." -else - $ECHO " modmap2.fits file is not found" - exit 1 -fi $ECHO " ok" @@ -299,11 +443,12 @@ $ECHO " ok" $ECHO -n "Test ctlike: " # # Run 1 -$ctlike inobs="cntmap.fits" \ +$ctlike inobs="cntmap1.fits" \ inmodel="data/crab.xml" \ outmodel="results_binned.xml" \ expcube="NONE" \ psfcube="NONE" \ + bgcube="NONE" \ caldb="irf" \ irf="cta_dummy_irf" $ECHO -n "." @@ -329,36 +474,23 @@ else $ECHO " results_unbinned.xml file is not found" exit 1 fi + # # Run 3 -$ctlike inobs="events2.fits" \ - inmodel="data/model_background_cube.xml" \ - outmodel="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 found" - exit 1 -fi -# -# Run 4 $ctlike inobs="cntmap2.fits" \ - inmodel="data/model_background_cube.xml" \ - outmodel="results_binned_background_cube.xml" \ - expcube="NONE" \ - psfcube="NONE" \ + inmodel="bkgcube2.xml" \ + outmodel="results_binned_cube_background.xml" \ + expcube="expcube2.fits" \ + psfcube="psfcube2.fits" \ + bgcube="bkgcube2.fits" \ caldb="irf" \ irf="cta_dummy_irf" $ECHO -n "." -if [ -s "results_binned_background_cube.xml" ] +if [ -s "results_binned_cube_background.xml" ] then $ECHO -n "." else - $ECHO " results_binned_background_cube.xml file is not found" + $ECHO " results_binned_cube_background.xml file is not found" exit 1 fi $ECHO " ok" @@ -392,167 +524,6 @@ fi $ECHO " ok" -# -# Test ctexpcube -# ============== -$ECHO -n "Test ctexpcube: " -# -# Run 1 -$ctexpcube inobs="data/crab_events.fits" \ - incube="NONE" \ - outcube="expcube1.fits" \ - caldb="irf" \ - irf="cta_dummy_irf" \ - emin=0.1 \ - emax=100.0 \ - enumbins=20 \ - nxpix=200 \ - nypix=200 \ - binsz=0.02 \ - coordsys="CEL" \ - xref=83.63 \ - yref=22.01 \ - proj="CAR" -$ECHO -n "." -if [ -s "expcube1.fits" ] -then - $ECHO -n "." -else - $ECHO " expcube1.fits file is not found" - exit 1 -fi -# -# Run 2 -$ctexpcube inobs="data/crab_events.fits" \ - incube="data/crab_cntmap.fits" \ - outcube="expcube2.fits" \ - caldb="irf" \ - irf="cta_dummy_irf" -$ECHO -n "." -if [ -s "expcube2.fits" ] -then - $ECHO -n "." -else - $ECHO " expcube2.fits file is not found" - exit 1 -fi -$ECHO " ok" - - -# -# Test ctpsfcube -# ============== -$ECHO -n "Test ctpsfcube: " -# -# Run 1 -$ctpsfcube inobs="data/crab_events.fits" \ - incube="NONE" \ - outcube="psfcube1.fits" \ - caldb="irf" \ - irf="cta_dummy_irf" \ - emin=0.1 \ - emax=100.0 \ - enumbins=20 \ - nxpix=10 \ - nypix=10 \ - binsz=0.4 \ - coordsys="CEL" \ - xref=83.63 \ - yref=22.01 \ - proj="CAR" \ - amax=0.3 \ - anumbins=10 -$ECHO -n "." -if [ -s "psfcube1.fits" ] -then - $ECHO -n "." -else - $ECHO " psfcube1.fits file is not found" - exit 1 -fi -# -# Run 2 -$ctpsfcube inobs="data/crab_events.fits" \ - incube="data/crab_cntmap.fits" \ - outcube="psfcube2.fits" \ - caldb="irf" \ - irf="cta_dummy_irf" \ - amax=0.3 \ - anumbins=2 -$ECHO -n "." -if [ -s "psfcube2.fits" ] -then - $ECHO -n "." -else - $ECHO " psfcube2.fits file is not found" - exit 1 -fi -$ECHO " ok" - - -# -# Test ctbkgcube -# ============== -$ECHO -n "Test ctbkgcube: " -# -# Run 1 -$ctbkgcube inobs="data/crab_events.fits" \ - inmodel="data/crab.xml" \ - incube="NONE" \ - outcube="bkgcube1.fits" \ - outmodel="bkgcube1.xml" \ - caldb="irf" \ - irf="cta_dummy_irf" \ - emin=0.1 \ - emax=100.0 \ - enumbins=20 \ - nxpix=10 \ - nypix=10 \ - binsz=0.4 \ - coordsys="CEL" \ - xref=83.63 \ - yref=22.01 \ - proj="CAR" -$ECHO -n "." -if [ -s "bkgcube1.fits" ] -then - $ECHO -n "." -else - $ECHO " bkgcube1.fits file is not found" - exit 1 -fi -if [ -s "bkgcube1.xml" ] -then - $ECHO -n "." -else - $ECHO " bkgcube1.xml file is not found" - exit 1 -fi -# -# Run 2 -$ctbkgcube inobs="data/crab_events.fits" \ - inmodel="data/crab.xml" \ - incube="data/crab_cntmap.fits" \ - caldb="irf" \ - irf="cta_dummy_irf" \ - outcube="bkgcube2.fits" \ - outmodel="bkgcube2.xml" -$ECHO -n "." -if [ -s "bkgcube2.fits" ] -then - $ECHO -n "." -else - $ECHO " bkgcube2.fits file is not found" - exit 1 -fi -if [ -s "bkgcube2.fits" ] -then - $ECHO -n "." -else - $ECHO " bkgcube2.xml file is not found" - exit 1 -fi -$ECHO " ok" # -- libgit2 0.21.4