diff --git a/ChangeLog b/ChangeLog index 33ef792..298e43c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,10 +1,10 @@ -2016-01-06 Juergen Knoedlseder +2016-01-11 Juergen Knoedlseder * Version 1.1.0 released ======================== -2016-01-06 Juergen Knoedlseder +2016-01-11 Juergen Knoedlseder * Bug fix version 1.0.1 released ================================ diff --git a/NEWS b/NEWS index 8d31438..2cdbceb 100644 --- a/NEWS +++ b/NEWS @@ -2,7 +2,7 @@ New Features and Important Changes in ctools 1.1.0 Author(s) : Juergen Knoedlseder -6 January 2016 +11 January 2016 1. Introduction diff --git a/README b/README index 3b7b633..38435cc 100644 --- a/README +++ b/README @@ -1,6 +1,6 @@ ctools information ================== -Version: 1.1.0dev (6 January 2016) +Version: 1.1.0dev (11 January 2016) Author: Juergen Knodlseder (jurgen.knodlseder@irap.omp.eu) GammaLib dependency: 1.1.0dev diff --git a/doc/source/reference_manual/csresmap.rst b/doc/source/reference_manual/csresmap.rst index b0fa577..d4d0f0c 100644 --- a/doc/source/reference_manual/csresmap.rst +++ b/doc/source/reference_manual/csresmap.rst @@ -31,18 +31,33 @@ General parameters ``inobs [file]`` Input event list, counts cube or observation definition XML file. +``modcube [file]`` + Input model cube file (generated with ctmodel). + +``expcube [file]`` + Input exposure cube file (only needed for stacked analysis). + +``psfcube [file]`` + Input PSF cube file (only needed for stacked analysis). + +``bkgcube [file]`` + Input background cube file (only needed for stacked analysis). + ``inmodel [file]`` Input model XML file. -``outmap [file]`` - Output residual counts map file. - ``caldb [string]`` Calibration database. ``irf [string]`` Instrument response function. +``(edisp = no) [boolean]`` + Apply energy dispersion? + +``outmap [file]`` + Output residual counts map file. + ``(ebinalg = LOG) [string]`` Algorithm for defining energy bins. @@ -58,27 +73,27 @@ General parameters ``(ebinfile = NONE) [file]`` Name of the file containing the energy bin definition. -``nxpix [integer]`` - Number of cube bins in Right Ascension or Galactic longitude. - -``nypix [integer]`` - Number of cube bins in Declination or Galactic latitude. - -``binsz [real]`` - Cube bin size (in degrees/pixel). - ``coordsys [string]`` Coordinate system (CEL - celestial, GAL - galactic). +``proj [string]`` + Projection method. + ``xref [real]`` Right Ascension / Galactic longitude of cube centre (J2000, in degrees). ``yref [real]`` Declination / Galactic latitude of cube centre (J2000, in degrees). -``proj [string]`` - Projection method. - +``nxpix [integer]`` + Number of cube bins in Right Ascension or Galactic longitude. + +``nypix [integer]`` + Number of cube bins in Declination or Galactic latitude. + +``binsz [real]`` + Cube bin size (in degrees/pixel). + ``(algorithm = SUBDIV) [string]`` Algorithm used to generate the residual map. diff --git a/src/ctmodel/ctmodel.cpp b/src/ctmodel/ctmodel.cpp index 8351883..fa0ae9d 100644 --- a/src/ctmodel/ctmodel.cpp +++ b/src/ctmodel/ctmodel.cpp @@ -284,7 +284,7 @@ void ctmodel::run(void) // Fill cube and leave loop if we are binned mode (meaning we // only have one binned observation) - if (m_binned && m_obs.size() == 1) { + if (m_binned) { fill_cube(obs); break; } @@ -464,13 +464,16 @@ void ctmodel::get_parameters(void) m_append_cube = false; // If there are no observations in container then load them via user - // parameters + // parameters. if (m_obs.size() == 0) { get_obs(); } - // Check if we got excactly one binned CTA observation - if (m_obs.size() == 1) { + // If we have now excactly one CTA observation (but no cube has yet been + // appended to the observation) then check whether this observation + // is a binned observation, and if yes, extract the counts cube for + // model generation + if ((m_obs.size() == 1) && (m_append_cube == false)) { // Get CTA observation GCTAObservation* obs = dynamic_cast(m_obs[0]); @@ -498,7 +501,6 @@ void ctmodel::get_parameters(void) } // endif: had exactly one observation - // Read model definition file if required if (m_obs.models().size() == 0) { @@ -513,7 +515,9 @@ void ctmodel::get_parameters(void) // Get energy dispersion flag parameters m_apply_edisp = (*this)["edisp"].boolean(); - // Optionally get input counts cube for model cube definition + // If we do not have yet a counts cube for model computation then check + // whether we should read it from the "incube" parameter or whether we + // should create it from scratch using the task parameters if (!m_has_cube) { // Read cube definition file @@ -544,18 +548,21 @@ void ctmodel::get_parameters(void) // Signal that cube has been set m_has_cube = true; - } + + } // endif: we had no cube yet // Read optionally output cube filenames if (read_ahead()) { - m_outcube = (*this)["outcube"].filename(); + m_outcube = (*this)["outcube"].filename(); } // If cube should be appended to first observation then do that now. // This is a kluge that makes sure that the cube is passed as part // of the observation in case that a cube response is used. The kluge // is needed because the GCTACubeSourceDiffuse::set method needs to - // get the full event cube from the observation. + // get the full event cube from the observation. It is also at this + // step that the GTI, which may just be a dummy GTI when create_cube() + // has been used, will be set. if (m_append_cube) { //TODO: Check that energy boundaries are compatible @@ -588,6 +595,11 @@ void ctmodel::get_parameters(void) * If no file names are specified for the "expcube", "psfcube" or "bkgcube" * parameters, the method reads the necessary parameters to build a CTA * observation from scratch. + * + * The method sets m_append_cube = true and m_binned = true in case that + * a stacked observation is requested (as detected by the presence of the + * "expcube", "psfcube", and "bkgcube" parameters). In that case, it appended + * a dummy event cube to the observation. ***************************************************************************/ void ctmodel::get_obs(void) { @@ -620,7 +632,6 @@ void ctmodel::get_obs(void) // Create dummy sky map cube GSkyMap map("CAR","GAL",0.0,0.0,1.0,1.0,1,1,ebounds.size()); - m_append_cube = true; // Create event cube GCTAEventCube cube(map, ebounds, exposure.gti()); @@ -633,6 +644,12 @@ void ctmodel::get_obs(void) // Append observation to container m_obs.append(cta); + // Signal that we are in binned mode + m_binned = true; + + // Signal that we appended a cube + m_append_cube = true; + } // endif: cube response information was available // ... otherwise build an observation from IRF response information @@ -646,7 +663,7 @@ void ctmodel::get_obs(void) // Append observation to container m_obs.append(cta); - + } } // endif: filename was "NONE" or "" diff --git a/src/support/ctool.cpp b/src/support/ctool.cpp index 9efd517..fc6e872 100644 --- a/src/support/ctool.cpp +++ b/src/support/ctool.cpp @@ -652,7 +652,7 @@ GCTAObservation ctool::create_cta_obs(void) list.gti(gti); list.ebounds(ebounds); - // Attach event list to CTA observation + // Attach empty event list to CTA observation obs.events(list); // Set observation ontime, livetime and deadtime correction factor