Commit 5043f2ad282ec34849d79cb60dfaddda6f1c0401
Merge branch 'bugfix-1.0.1' into integration
# Conflicts: # NEWS # README
Showing
6 changed files
with
63 additions
and
31 deletions
ChangeLog
| 1 | -2016-01-06 Juergen Knoedlseder <jurgen.knodlseder@irap.omp.eu> | 1 | +2016-01-11 Juergen Knoedlseder <jurgen.knodlseder@irap.omp.eu> |
| 2 | 2 | ||
| 3 | * Version 1.1.0 released | 3 | * Version 1.1.0 released |
| 4 | ======================== | 4 | ======================== |
| 5 | 5 | ||
| 6 | 6 | ||
| 7 | -2016-01-06 Juergen Knoedlseder <jurgen.knodlseder@irap.omp.eu> | 7 | +2016-01-11 Juergen Knoedlseder <jurgen.knodlseder@irap.omp.eu> |
| 8 | 8 | ||
| 9 | * Bug fix version 1.0.1 released | 9 | * Bug fix version 1.0.1 released |
| 10 | ================================ | 10 | ================================ |
NEWS
README
| 1 | ctools information | 1 | ctools information |
| 2 | ================== | 2 | ================== |
| 3 | -Version: 1.1.0dev (6 January 2016) | 3 | +Version: 1.1.0dev (11 January 2016) |
| 4 | Author: Juergen Knodlseder (jurgen.knodlseder@irap.omp.eu) | 4 | Author: Juergen Knodlseder (jurgen.knodlseder@irap.omp.eu) |
| 5 | GammaLib dependency: 1.1.0dev | 5 | GammaLib dependency: 1.1.0dev |
| 6 | 6 |
doc/source/reference_manual/csresmap.rst
| @@ -31,18 +31,33 @@ General parameters | @@ -31,18 +31,33 @@ General parameters | ||
| 31 | ``inobs [file]`` | 31 | ``inobs [file]`` |
| 32 | Input event list, counts cube or observation definition XML file. | 32 | Input event list, counts cube or observation definition XML file. |
| 33 | 33 | ||
| 34 | +``modcube [file]`` | ||
| 35 | + Input model cube file (generated with ctmodel). | ||
| 36 | + | ||
| 37 | +``expcube [file]`` | ||
| 38 | + Input exposure cube file (only needed for stacked analysis). | ||
| 39 | + | ||
| 40 | +``psfcube [file]`` | ||
| 41 | + Input PSF cube file (only needed for stacked analysis). | ||
| 42 | + | ||
| 43 | +``bkgcube [file]`` | ||
| 44 | + Input background cube file (only needed for stacked analysis). | ||
| 45 | + | ||
| 34 | ``inmodel [file]`` | 46 | ``inmodel [file]`` |
| 35 | Input model XML file. | 47 | Input model XML file. |
| 36 | 48 | ||
| 37 | -``outmap [file]`` | ||
| 38 | - Output residual counts map file. | ||
| 39 | - | ||
| 40 | ``caldb [string]`` | 49 | ``caldb [string]`` |
| 41 | Calibration database. | 50 | Calibration database. |
| 42 | 51 | ||
| 43 | ``irf [string]`` | 52 | ``irf [string]`` |
| 44 | Instrument response function. | 53 | Instrument response function. |
| 45 | 54 | ||
| 55 | +``(edisp = no) [boolean]`` | ||
| 56 | + Apply energy dispersion? | ||
| 57 | + | ||
| 58 | +``outmap [file]`` | ||
| 59 | + Output residual counts map file. | ||
| 60 | + | ||
| 46 | ``(ebinalg = LOG) <FILE|LIN|LOG> [string]`` | 61 | ``(ebinalg = LOG) <FILE|LIN|LOG> [string]`` |
| 47 | Algorithm for defining energy bins. | 62 | Algorithm for defining energy bins. |
| 48 | 63 | ||
| @@ -58,27 +73,27 @@ General parameters | @@ -58,27 +73,27 @@ General parameters | ||
| 58 | ``(ebinfile = NONE) [file]`` | 73 | ``(ebinfile = NONE) [file]`` |
| 59 | Name of the file containing the energy bin definition. | 74 | Name of the file containing the energy bin definition. |
| 60 | 75 | ||
| 61 | -``nxpix [integer]`` | ||
| 62 | - Number of cube bins in Right Ascension or Galactic longitude. | ||
| 63 | - | ||
| 64 | -``nypix [integer]`` | ||
| 65 | - Number of cube bins in Declination or Galactic latitude. | ||
| 66 | - | ||
| 67 | -``binsz [real]`` | ||
| 68 | - Cube bin size (in degrees/pixel). | ||
| 69 | - | ||
| 70 | ``coordsys <CEL|GAL> [string]`` | 76 | ``coordsys <CEL|GAL> [string]`` |
| 71 | Coordinate system (CEL - celestial, GAL - galactic). | 77 | Coordinate system (CEL - celestial, GAL - galactic). |
| 72 | 78 | ||
| 79 | +``proj <AIT|AZP|CAR|MER|MOL|STG|TAN> [string]`` | ||
| 80 | + Projection method. | ||
| 81 | + | ||
| 73 | ``xref [real]`` | 82 | ``xref [real]`` |
| 74 | Right Ascension / Galactic longitude of cube centre (J2000, in degrees). | 83 | Right Ascension / Galactic longitude of cube centre (J2000, in degrees). |
| 75 | 84 | ||
| 76 | ``yref [real]`` | 85 | ``yref [real]`` |
| 77 | Declination / Galactic latitude of cube centre (J2000, in degrees). | 86 | Declination / Galactic latitude of cube centre (J2000, in degrees). |
| 78 | 87 | ||
| 79 | -``proj <AIT|AZP|CAR|MER|MOL|STG|TAN> [string]`` | ||
| 80 | - Projection method. | ||
| 81 | - | 88 | +``nxpix [integer]`` |
| 89 | + Number of cube bins in Right Ascension or Galactic longitude. | ||
| 90 | + | ||
| 91 | +``nypix [integer]`` | ||
| 92 | + Number of cube bins in Declination or Galactic latitude. | ||
| 93 | + | ||
| 94 | +``binsz [real]`` | ||
| 95 | + Cube bin size (in degrees/pixel). | ||
| 96 | + | ||
| 82 | ``(algorithm = SUBDIV) <SUB|SUBDIV|SUBDIVSQRT> [string]`` | 97 | ``(algorithm = SUBDIV) <SUB|SUBDIV|SUBDIVSQRT> [string]`` |
| 83 | Algorithm used to generate the residual map. | 98 | Algorithm used to generate the residual map. |
| 84 | 99 |
src/ctmodel/ctmodel.cpp
| @@ -284,7 +284,7 @@ void ctmodel::run(void) | @@ -284,7 +284,7 @@ void ctmodel::run(void) | ||
| 284 | 284 | ||
| 285 | // Fill cube and leave loop if we are binned mode (meaning we | 285 | // Fill cube and leave loop if we are binned mode (meaning we |
| 286 | // only have one binned observation) | 286 | // only have one binned observation) |
| 287 | - if (m_binned && m_obs.size() == 1) { | 287 | + if (m_binned) { |
| 288 | fill_cube(obs); | 288 | fill_cube(obs); |
| 289 | break; | 289 | break; |
| 290 | } | 290 | } |
| @@ -464,13 +464,16 @@ void ctmodel::get_parameters(void) | @@ -464,13 +464,16 @@ void ctmodel::get_parameters(void) | ||
| 464 | m_append_cube = false; | 464 | m_append_cube = false; |
| 465 | 465 | ||
| 466 | // If there are no observations in container then load them via user | 466 | // If there are no observations in container then load them via user |
| 467 | - // parameters | 467 | + // parameters. |
| 468 | if (m_obs.size() == 0) { | 468 | if (m_obs.size() == 0) { |
| 469 | get_obs(); | 469 | get_obs(); |
| 470 | } | 470 | } |
| 471 | 471 | ||
| 472 | - // Check if we got excactly one binned CTA observation | ||
| 473 | - if (m_obs.size() == 1) { | 472 | + // If we have now excactly one CTA observation (but no cube has yet been |
| 473 | + // appended to the observation) then check whether this observation | ||
| 474 | + // is a binned observation, and if yes, extract the counts cube for | ||
| 475 | + // model generation | ||
| 476 | + if ((m_obs.size() == 1) && (m_append_cube == false)) { | ||
| 474 | 477 | ||
| 475 | // Get CTA observation | 478 | // Get CTA observation |
| 476 | GCTAObservation* obs = dynamic_cast<GCTAObservation*>(m_obs[0]); | 479 | GCTAObservation* obs = dynamic_cast<GCTAObservation*>(m_obs[0]); |
| @@ -498,7 +501,6 @@ void ctmodel::get_parameters(void) | @@ -498,7 +501,6 @@ void ctmodel::get_parameters(void) | ||
| 498 | 501 | ||
| 499 | } // endif: had exactly one observation | 502 | } // endif: had exactly one observation |
| 500 | 503 | ||
| 501 | - | ||
| 502 | // Read model definition file if required | 504 | // Read model definition file if required |
| 503 | if (m_obs.models().size() == 0) { | 505 | if (m_obs.models().size() == 0) { |
| 504 | 506 | ||
| @@ -513,7 +515,9 @@ void ctmodel::get_parameters(void) | @@ -513,7 +515,9 @@ void ctmodel::get_parameters(void) | ||
| 513 | // Get energy dispersion flag parameters | 515 | // Get energy dispersion flag parameters |
| 514 | m_apply_edisp = (*this)["edisp"].boolean(); | 516 | m_apply_edisp = (*this)["edisp"].boolean(); |
| 515 | 517 | ||
| 516 | - // Optionally get input counts cube for model cube definition | 518 | + // If we do not have yet a counts cube for model computation then check |
| 519 | + // whether we should read it from the "incube" parameter or whether we | ||
| 520 | + // should create it from scratch using the task parameters | ||
| 517 | if (!m_has_cube) { | 521 | if (!m_has_cube) { |
| 518 | 522 | ||
| 519 | // Read cube definition file | 523 | // Read cube definition file |
| @@ -544,18 +548,21 @@ void ctmodel::get_parameters(void) | @@ -544,18 +548,21 @@ void ctmodel::get_parameters(void) | ||
| 544 | 548 | ||
| 545 | // Signal that cube has been set | 549 | // Signal that cube has been set |
| 546 | m_has_cube = true; | 550 | m_has_cube = true; |
| 547 | - } | 551 | + |
| 552 | + } // endif: we had no cube yet | ||
| 548 | 553 | ||
| 549 | // Read optionally output cube filenames | 554 | // Read optionally output cube filenames |
| 550 | if (read_ahead()) { | 555 | if (read_ahead()) { |
| 551 | - m_outcube = (*this)["outcube"].filename(); | 556 | + m_outcube = (*this)["outcube"].filename(); |
| 552 | } | 557 | } |
| 553 | 558 | ||
| 554 | // If cube should be appended to first observation then do that now. | 559 | // If cube should be appended to first observation then do that now. |
| 555 | // This is a kluge that makes sure that the cube is passed as part | 560 | // This is a kluge that makes sure that the cube is passed as part |
| 556 | // of the observation in case that a cube response is used. The kluge | 561 | // of the observation in case that a cube response is used. The kluge |
| 557 | // is needed because the GCTACubeSourceDiffuse::set method needs to | 562 | // is needed because the GCTACubeSourceDiffuse::set method needs to |
| 558 | - // get the full event cube from the observation. | 563 | + // get the full event cube from the observation. It is also at this |
| 564 | + // step that the GTI, which may just be a dummy GTI when create_cube() | ||
| 565 | + // has been used, will be set. | ||
| 559 | if (m_append_cube) { | 566 | if (m_append_cube) { |
| 560 | 567 | ||
| 561 | //TODO: Check that energy boundaries are compatible | 568 | //TODO: Check that energy boundaries are compatible |
| @@ -588,6 +595,11 @@ void ctmodel::get_parameters(void) | @@ -588,6 +595,11 @@ void ctmodel::get_parameters(void) | ||
| 588 | * If no file names are specified for the "expcube", "psfcube" or "bkgcube" | 595 | * If no file names are specified for the "expcube", "psfcube" or "bkgcube" |
| 589 | * parameters, the method reads the necessary parameters to build a CTA | 596 | * parameters, the method reads the necessary parameters to build a CTA |
| 590 | * observation from scratch. | 597 | * observation from scratch. |
| 598 | + * | ||
| 599 | + * The method sets m_append_cube = true and m_binned = true in case that | ||
| 600 | + * a stacked observation is requested (as detected by the presence of the | ||
| 601 | + * "expcube", "psfcube", and "bkgcube" parameters). In that case, it appended | ||
| 602 | + * a dummy event cube to the observation. | ||
| 591 | ***************************************************************************/ | 603 | ***************************************************************************/ |
| 592 | void ctmodel::get_obs(void) | 604 | void ctmodel::get_obs(void) |
| 593 | { | 605 | { |
| @@ -620,7 +632,6 @@ void ctmodel::get_obs(void) | @@ -620,7 +632,6 @@ void ctmodel::get_obs(void) | ||
| 620 | 632 | ||
| 621 | // Create dummy sky map cube | 633 | // Create dummy sky map cube |
| 622 | GSkyMap map("CAR","GAL",0.0,0.0,1.0,1.0,1,1,ebounds.size()); | 634 | GSkyMap map("CAR","GAL",0.0,0.0,1.0,1.0,1,1,ebounds.size()); |
| 623 | - m_append_cube = true; | ||
| 624 | 635 | ||
| 625 | // Create event cube | 636 | // Create event cube |
| 626 | GCTAEventCube cube(map, ebounds, exposure.gti()); | 637 | GCTAEventCube cube(map, ebounds, exposure.gti()); |
| @@ -633,6 +644,12 @@ void ctmodel::get_obs(void) | @@ -633,6 +644,12 @@ void ctmodel::get_obs(void) | ||
| 633 | // Append observation to container | 644 | // Append observation to container |
| 634 | m_obs.append(cta); | 645 | m_obs.append(cta); |
| 635 | 646 | ||
| 647 | + // Signal that we are in binned mode | ||
| 648 | + m_binned = true; | ||
| 649 | + | ||
| 650 | + // Signal that we appended a cube | ||
| 651 | + m_append_cube = true; | ||
| 652 | + | ||
| 636 | } // endif: cube response information was available | 653 | } // endif: cube response information was available |
| 637 | 654 | ||
| 638 | // ... otherwise build an observation from IRF response information | 655 | // ... otherwise build an observation from IRF response information |
| @@ -646,7 +663,7 @@ void ctmodel::get_obs(void) | @@ -646,7 +663,7 @@ void ctmodel::get_obs(void) | ||
| 646 | 663 | ||
| 647 | // Append observation to container | 664 | // Append observation to container |
| 648 | m_obs.append(cta); | 665 | m_obs.append(cta); |
| 649 | - | 666 | + |
| 650 | } | 667 | } |
| 651 | 668 | ||
| 652 | } // endif: filename was "NONE" or "" | 669 | } // endif: filename was "NONE" or "" |
src/support/ctool.cpp
| @@ -652,7 +652,7 @@ GCTAObservation ctool::create_cta_obs(void) | @@ -652,7 +652,7 @@ GCTAObservation ctool::create_cta_obs(void) | ||
| 652 | list.gti(gti); | 652 | list.gti(gti); |
| 653 | list.ebounds(ebounds); | 653 | list.ebounds(ebounds); |
| 654 | 654 | ||
| 655 | - // Attach event list to CTA observation | 655 | + // Attach empty event list to CTA observation |
| 656 | obs.events(list); | 656 | obs.events(list); |
| 657 | 657 | ||
| 658 | // Set observation ontime, livetime and deadtime correction factor | 658 | // Set observation ontime, livetime and deadtime correction factor |