Commit caae47aa5fc7ec4815dd29db0b00d36315896606
Merge branch 'pull-request-1991-ctprob-modified-GCTAEventList' into integration
Showing
6 changed files
with
54 additions
and
3 deletions
AUTHORS
| @@ -3,6 +3,7 @@ François Brun (brun@cenbg.in2p3.fr) | @@ -3,6 +3,7 @@ François Brun (brun@cenbg.in2p3.fr) | ||
| 3 | Joshua Cardenzana (jcardenzana@irap.omp.eu) | 3 | Joshua Cardenzana (jcardenzana@irap.omp.eu) |
| 4 | Jean-Baptiste Cayrou (cayrou@etud.insa-toulouse.fr) | 4 | Jean-Baptiste Cayrou (cayrou@etud.insa-toulouse.fr) |
| 5 | Christoph Deil (Christoph.Deil@mpi-hd.mpg.de) | 5 | Christoph Deil (Christoph.Deil@mpi-hd.mpg.de) |
| 6 | +Leonardo Di Venere (leonardo.divenere@ba.infn.it) | ||
| 6 | Alex Donath (Axel.Donath@mpi-hd.mpg.de) | 7 | Alex Donath (Axel.Donath@mpi-hd.mpg.de) |
| 7 | Stefan Eschbach (stefan.eschbach@fau.de) | 8 | Stefan Eschbach (stefan.eschbach@fau.de) |
| 8 | Florent Forest (florent.forest@isae.fr) | 9 | Florent Forest (florent.forest@isae.fr) |
ChangeLog
| 1 | -2017-04-10 | 1 | +2017-04-11 |
| 2 | 2 | ||
| 3 | * Version 1.3.0 released | 3 | * Version 1.3.0 released |
| 4 | ========================= | 4 | ========================= |
| 5 | 5 | ||
| 6 | + Add GEventList::append_column() method (#1991) | ||
| 6 | Add scalar addition and subtraction operators to matrix classes (#1990) | 7 | Add scalar addition and subtraction operators to matrix classes (#1990) |
| 7 | Allow fitting of scale parameter in composite models (#1992) | 8 | Allow fitting of scale parameter in composite models (#1992) |
| 8 | Add GCTAAeff::ebounds() method (#1989) | 9 | Add GCTAAeff::ebounds() method (#1989) |
NEWS
| 1 | New Features and Important Changes in GammaLib 1.3.0.dev1 | 1 | New Features and Important Changes in GammaLib 1.3.0.dev1 |
| 2 | 2 | ||
| 3 | -10 April 2017 | 3 | +11 April 2017 |
| 4 | 4 | ||
| 5 | 5 | ||
| 6 | 1. Introduction | 6 | 1. Introduction |
| @@ -47,6 +47,7 @@ The following methods have been added: | @@ -47,6 +47,7 @@ The following methods have been added: | ||
| 47 | - GCTAAeff2D::ebounds() | 47 | - GCTAAeff2D::ebounds() |
| 48 | - GCTAAeffArf::ebounds() | 48 | - GCTAAeffArf::ebounds() |
| 49 | - GCTAAeffPerfTable::ebounds() | 49 | - GCTAAeffPerfTable::ebounds() |
| 50 | +- GCTAEventList::append_column(GFitsTableCol&) | ||
| 50 | 51 | ||
| 51 | The following methods have been removed: | 52 | The following methods have been removed: |
| 52 | - ... | 53 | - ... |
| @@ -212,6 +213,11 @@ effective area returned is always zero. A counter has been added that leads to | @@ -212,6 +213,11 @@ effective area returned is always zero. A counter has been added that leads to | ||
| 212 | the exit of the loop in case that 1000 subsequent zero values are returned | 213 | the exit of the loop in case that 1000 subsequent zero values are returned |
| 213 | (#1988). | 214 | (#1988). |
| 214 | 215 | ||
| 216 | +A GCTAEventList::append_column() method has been added to allow appending of | ||
| 217 | +FITS columns to an event list. The method checks whether the length of the | ||
| 218 | +FITS column is compatible with the number of events that are present in the | ||
| 219 | +event list (#1991). | ||
| 220 | + | ||
| 215 | 221 | ||
| 216 | 21. COMPTEL interface | 222 | 21. COMPTEL interface |
| 217 | --------------------- | 223 | --------------------- |
inst/cta/include/GCTAEventList.hpp
| @@ -40,6 +40,7 @@ class GFilename; | @@ -40,6 +40,7 @@ class GFilename; | ||
| 40 | class GFitsHDU; | 40 | class GFitsHDU; |
| 41 | class GFitsTable; | 41 | class GFitsTable; |
| 42 | class GFitsBinTable; | 42 | class GFitsBinTable; |
| 43 | +class GFitsTableCol; | ||
| 43 | 44 | ||
| 44 | /* __ Constants __________________________________________________________ */ | 45 | /* __ Constants __________________________________________________________ */ |
| 45 | namespace gammalib { | 46 | namespace gammalib { |
| @@ -85,6 +86,7 @@ public: | @@ -85,6 +86,7 @@ public: | ||
| 85 | 86 | ||
| 86 | // Implement other methods | 87 | // Implement other methods |
| 87 | void append(const GCTAEventAtom& event); | 88 | void append(const GCTAEventAtom& event); |
| 89 | + void append_column(const GFitsTableCol& column); | ||
| 88 | void reserve(const int& number); | 90 | void reserve(const int& number); |
| 89 | void remove(const int& index, const int& number = 1); | 91 | void remove(const int& index, const int& number = 1); |
| 90 | void write(GFits& fits, const std::string& evtname, | 92 | void write(GFits& fits, const std::string& evtname, |
inst/cta/pyext/GCTAEventList.i
| 1 | /*************************************************************************** | 1 | /*************************************************************************** |
| 2 | * GCTAEventList.i - CTA event list class * | 2 | * GCTAEventList.i - CTA event list class * |
| 3 | * ----------------------------------------------------------------------- * | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2011-2016 by Juergen Knoedlseder * | 4 | + * copyright (C) 2011-2017 by Juergen Knoedlseder * |
| 5 | * ----------------------------------------------------------------------- * | 5 | * ----------------------------------------------------------------------- * |
| 6 | * * | 6 | * * |
| 7 | * This program is free software: you can redistribute it and/or modify * | 7 | * This program is free software: you can redistribute it and/or modify * |
| @@ -59,6 +59,7 @@ public: | @@ -59,6 +59,7 @@ public: | ||
| 59 | 59 | ||
| 60 | // Implement other methods | 60 | // Implement other methods |
| 61 | void append(const GCTAEventAtom& event); | 61 | void append(const GCTAEventAtom& event); |
| 62 | + void append_column(const GFitsTableCol& column); | ||
| 62 | void reserve(const int& number); | 63 | void reserve(const int& number); |
| 63 | void remove(const int& index, const int& number = 1); | 64 | void remove(const int& index, const int& number = 1); |
| 64 | void write(GFits& fits, const std::string& evtname, | 65 | void write(GFits& fits, const std::string& evtname, |
inst/cta/src/GCTAEventList.cpp
| @@ -35,6 +35,7 @@ | @@ -35,6 +35,7 @@ | ||
| 35 | #include "GFits.hpp" | 35 | #include "GFits.hpp" |
| 36 | #include "GFitsTable.hpp" | 36 | #include "GFitsTable.hpp" |
| 37 | #include "GFitsBinTable.hpp" | 37 | #include "GFitsBinTable.hpp" |
| 38 | +#include "GFitsTableCol.hpp" | ||
| 38 | #include "GFitsTableFloatCol.hpp" | 39 | #include "GFitsTableFloatCol.hpp" |
| 39 | #include "GFitsTableDoubleCol.hpp" | 40 | #include "GFitsTableDoubleCol.hpp" |
| 40 | #include "GFitsTableULongCol.hpp" | 41 | #include "GFitsTableULongCol.hpp" |
| @@ -46,6 +47,7 @@ | @@ -46,6 +47,7 @@ | ||
| 46 | /* __ Method name definitions ____________________________________________ */ | 47 | /* __ Method name definitions ____________________________________________ */ |
| 47 | #define G_OPERATOR "GCTAEventList::operator[](int&)" | 48 | #define G_OPERATOR "GCTAEventList::operator[](int&)" |
| 48 | #define G_ROI "GCTAEventList::roi(GRoi&)" | 49 | #define G_ROI "GCTAEventList::roi(GRoi&)" |
| 50 | +#define G_APPEND_COLUMN "GCTAEventList::append_column(GFitsTableCol&)" | ||
| 49 | #define G_FETCH "GCTAEventList::fetch()" | 51 | #define G_FETCH "GCTAEventList::fetch()" |
| 50 | 52 | ||
| 51 | /* __ Macros _____________________________________________________________ */ | 53 | /* __ Macros _____________________________________________________________ */ |
| @@ -575,6 +577,44 @@ void GCTAEventList::append(const GCTAEventAtom& event) | @@ -575,6 +577,44 @@ void GCTAEventList::append(const GCTAEventAtom& event) | ||
| 575 | } | 577 | } |
| 576 | 578 | ||
| 577 | 579 | ||
| 580 | + | ||
| 581 | +/***********************************************************************//** | ||
| 582 | + * @brief Append FITS table column to event list | ||
| 583 | + * | ||
| 584 | + * @param[in] column FITS table column to be appended. | ||
| 585 | + * | ||
| 586 | + * @exception GException::invalid_argument | ||
| 587 | + * FITS column has incompatible length. | ||
| 588 | + * | ||
| 589 | + * Appends a FITS table column to the event list. The length of the FITS | ||
| 590 | + * column must be identical to the number of events in the event list. | ||
| 591 | + ***************************************************************************/ | ||
| 592 | +void GCTAEventList::append_column(const GFitsTableCol& column) | ||
| 593 | +{ | ||
| 594 | + // Throw an exception if the column has an incompatible length | ||
| 595 | + if (size() != column.length()) { | ||
| 596 | + std::string msg = "Incompatible column length. Attempt to append a " | ||
| 597 | + "column of length "+gammalib::str(column.length())+ | ||
| 598 | + " to an event list with "+gammalib::str(size())+ | ||
| 599 | + " events. Please specify a column of length "+ | ||
| 600 | + gammalib::str(size())+"."; | ||
| 601 | + throw GException::invalid_argument(G_APPEND_COLUMN, msg); | ||
| 602 | + } | ||
| 603 | + | ||
| 604 | + // Make sure that the events are online | ||
| 605 | + fetch(); | ||
| 606 | + | ||
| 607 | + // Clone the FITS column. De-allocation is done when the object is free'd | ||
| 608 | + GFitsTableCol* ptr = column.clone(); | ||
| 609 | + | ||
| 610 | + // Append the column | ||
| 611 | + m_columns.push_back(ptr); | ||
| 612 | + | ||
| 613 | + // Return | ||
| 614 | + return; | ||
| 615 | +} | ||
| 616 | + | ||
| 617 | + | ||
| 578 | /***********************************************************************//** | 618 | /***********************************************************************//** |
| 579 | * @brief Remove events from event list | 619 | * @brief Remove events from event list |
| 580 | * | 620 | * |