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 | 3 | Joshua Cardenzana (jcardenzana@irap.omp.eu) |
| 4 | 4 | Jean-Baptiste Cayrou (cayrou@etud.insa-toulouse.fr) |
| 5 | 5 | Christoph Deil (Christoph.Deil@mpi-hd.mpg.de) |
| 6 | +Leonardo Di Venere (leonardo.divenere@ba.infn.it) | |
| 6 | 7 | Alex Donath (Axel.Donath@mpi-hd.mpg.de) |
| 7 | 8 | Stefan Eschbach (stefan.eschbach@fau.de) |
| 8 | 9 | Florent Forest (florent.forest@isae.fr) | ... | ... |
ChangeLog
| 1 | -2017-04-10 | |
| 1 | +2017-04-11 | |
| 2 | 2 | |
| 3 | 3 | * Version 1.3.0 released |
| 4 | 4 | ========================= |
| 5 | 5 | |
| 6 | + Add GEventList::append_column() method (#1991) | |
| 6 | 7 | Add scalar addition and subtraction operators to matrix classes (#1990) |
| 7 | 8 | Allow fitting of scale parameter in composite models (#1992) |
| 8 | 9 | Add GCTAAeff::ebounds() method (#1989) | ... | ... |
NEWS
| 1 | 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 | 6 | 1. Introduction |
| ... | ... | @@ -47,6 +47,7 @@ The following methods have been added: |
| 47 | 47 | - GCTAAeff2D::ebounds() |
| 48 | 48 | - GCTAAeffArf::ebounds() |
| 49 | 49 | - GCTAAeffPerfTable::ebounds() |
| 50 | +- GCTAEventList::append_column(GFitsTableCol&) | |
| 50 | 51 | |
| 51 | 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 | 213 | the exit of the loop in case that 1000 subsequent zero values are returned |
| 213 | 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 | 222 | 21. COMPTEL interface |
| 217 | 223 | --------------------- | ... | ... |
inst/cta/include/GCTAEventList.hpp
| ... | ... | @@ -40,6 +40,7 @@ class GFilename; |
| 40 | 40 | class GFitsHDU; |
| 41 | 41 | class GFitsTable; |
| 42 | 42 | class GFitsBinTable; |
| 43 | +class GFitsTableCol; | |
| 43 | 44 | |
| 44 | 45 | /* __ Constants __________________________________________________________ */ |
| 45 | 46 | namespace gammalib { |
| ... | ... | @@ -85,6 +86,7 @@ public: |
| 85 | 86 | |
| 86 | 87 | // Implement other methods |
| 87 | 88 | void append(const GCTAEventAtom& event); |
| 89 | + void append_column(const GFitsTableCol& column); | |
| 88 | 90 | void reserve(const int& number); |
| 89 | 91 | void remove(const int& index, const int& number = 1); |
| 90 | 92 | void write(GFits& fits, const std::string& evtname, | ... | ... |
inst/cta/pyext/GCTAEventList.i
| 1 | 1 | /*************************************************************************** |
| 2 | 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 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -59,6 +59,7 @@ public: |
| 59 | 59 | |
| 60 | 60 | // Implement other methods |
| 61 | 61 | void append(const GCTAEventAtom& event); |
| 62 | + void append_column(const GFitsTableCol& column); | |
| 62 | 63 | void reserve(const int& number); |
| 63 | 64 | void remove(const int& index, const int& number = 1); |
| 64 | 65 | void write(GFits& fits, const std::string& evtname, | ... | ... |
inst/cta/src/GCTAEventList.cpp
| ... | ... | @@ -35,6 +35,7 @@ |
| 35 | 35 | #include "GFits.hpp" |
| 36 | 36 | #include "GFitsTable.hpp" |
| 37 | 37 | #include "GFitsBinTable.hpp" |
| 38 | +#include "GFitsTableCol.hpp" | |
| 38 | 39 | #include "GFitsTableFloatCol.hpp" |
| 39 | 40 | #include "GFitsTableDoubleCol.hpp" |
| 40 | 41 | #include "GFitsTableULongCol.hpp" |
| ... | ... | @@ -46,6 +47,7 @@ |
| 46 | 47 | /* __ Method name definitions ____________________________________________ */ |
| 47 | 48 | #define G_OPERATOR "GCTAEventList::operator[](int&)" |
| 48 | 49 | #define G_ROI "GCTAEventList::roi(GRoi&)" |
| 50 | +#define G_APPEND_COLUMN "GCTAEventList::append_column(GFitsTableCol&)" | |
| 49 | 51 | #define G_FETCH "GCTAEventList::fetch()" |
| 50 | 52 | |
| 51 | 53 | /* __ Macros _____________________________________________________________ */ |
| ... | ... | @@ -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 | 619 | * @brief Remove events from event list |
| 580 | 620 | * | ... | ... |