diff --git a/ChangeLog b/ChangeLog index d3a2efd..15eae6e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,8 +1,9 @@ -2020-12-02 +2021-01-14 * Version 2.0.0 released ======================== + Fix response cache removal for vector cache (#3499) Add GModelAssociation and GModelAssociations classes (#3469) Add GSkyMap::correlate() method (#3461) Add GModels::eval() vector evaluation method (#3455) diff --git a/NEWS b/NEWS index 2b9ddcd..f6586e3 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,6 @@ New Features and Important Changes in GammaLib 2.0.0 -2 December 2020 +14 January 2021 1. Introduction @@ -136,6 +136,9 @@ of functions (#3328). 10. Observation module ---------------------- +Add source removal from vector cache to GResponse::remove_response_cache() +method (#3499). + The GResponseVectorCache class was added to handle caching of the vector response. Only non-zero IRF values are stored by the class. The class was integrated in the GResponse class (#3403). diff --git a/README.md b/README.md index 22d5ff3..c684457 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ GammaLib information ==================== -* Version: 2.0.0.dev (2 December 2020) +* Version: 2.0.0.dev (14 January 2021) [![Build Status](https://cta-jenkins.irap.omp.eu/buildStatus/icon?job=gammalib-integrate-os)](https://cta-jenkins.irap.omp.eu/job/gammalib-integrate-os/) diff --git a/doc/source/admin/release_history/2.0.rst b/doc/source/admin/release_history/2.0.rst index 892c5fd..1fd000f 100644 --- a/doc/source/admin/release_history/2.0.rst +++ b/doc/source/admin/release_history/2.0.rst @@ -1,7 +1,7 @@ .. _2.0: -GammaLib 2.0 release (27 November 2020) -======================================= +GammaLib 2.0 release (14 January 2021) +====================================== Overview -------- @@ -17,6 +17,8 @@ In particular, this release provides: Bug fixes --------- +* [`3499 `_] - + Fix response cache removal for vector cache * Fix ``GSkyMap::stack_maps()`` method for WCS maps * [`3417 `_] - Correct application elapsed CPU time for OpenMP diff --git a/inst/com/src/GCOMObservation.cpp b/inst/com/src/GCOMObservation.cpp index 6fdcbfa..8695c01 100644 --- a/inst/com/src/GCOMObservation.cpp +++ b/inst/com/src/GCOMObservation.cpp @@ -1,7 +1,7 @@ /*************************************************************************** * GCOMObservation.cpp - COMPTEL Observation class * * ----------------------------------------------------------------------- * - * copyright (C) 2012-2020 by Juergen Knoedlseder * + * copyright (C) 2012-2021 by Juergen Knoedlseder * * ----------------------------------------------------------------------- * * * * This program is free software: you can redistribute it and/or modify * @@ -734,6 +734,12 @@ void GCOMObservation::remove_response_cache(const std::string& name) m_drms.erase(m_drms.begin()+index); } + // Build model name + std::string model_name = id() + ":" + name; + + // Remove response cache + const_cast(this->response())->remove_response_cache(model_name); + // Return return; } diff --git a/inst/cta/include/GCTAObservation.hpp b/inst/cta/include/GCTAObservation.hpp index 5027930..4199e6a 100644 --- a/inst/cta/include/GCTAObservation.hpp +++ b/inst/cta/include/GCTAObservation.hpp @@ -1,7 +1,7 @@ /*************************************************************************** * GCTAObservation.hpp - CTA Observation class * * ----------------------------------------------------------------------- * - * copyright (C) 2010-2019 by Juergen Knoedlseder * + * copyright (C) 2010-2021 by Juergen Knoedlseder * * ----------------------------------------------------------------------- * * * * This program is free software: you can redistribute it and/or modify * @@ -97,9 +97,6 @@ public: virtual void write(GXmlElement& xml) const; virtual std::string print(const GChatter& chatter = NORMAL) const; - // Implement virtual methods - virtual void remove_response_cache(const std::string& name); - // Other methods void instrument(const std::string& instrument); bool has_response(void) const; diff --git a/inst/cta/pyext/GCTAObservation.i b/inst/cta/pyext/GCTAObservation.i index 927257e..6946993 100644 --- a/inst/cta/pyext/GCTAObservation.i +++ b/inst/cta/pyext/GCTAObservation.i @@ -1,7 +1,7 @@ /*************************************************************************** * GCTAObservation.i - CTA Observation class interface * * ----------------------------------------------------------------------- * - * copyright (C) 2010-2019 by Juergen Knoedlseder * + * copyright (C) 2010-2021 by Juergen Knoedlseder * * ----------------------------------------------------------------------- * * * * This program is free software: you can redistribute it and/or modify * @@ -64,9 +64,6 @@ public: virtual void read(const GXmlElement& xml); virtual void write(GXmlElement& xml) const; - // Implement virtual methods - virtual void remove_response_cache(const std::string& name); - // Other methods void instrument(const std::string& instrument); bool has_response(void) const; diff --git a/inst/cta/src/GCTAObservation.cpp b/inst/cta/src/GCTAObservation.cpp index 38f0f5a..5aff2fc 100644 --- a/inst/cta/src/GCTAObservation.cpp +++ b/inst/cta/src/GCTAObservation.cpp @@ -1,7 +1,7 @@ /*************************************************************************** * GCTAObservation.cpp - CTA Observation class * * ----------------------------------------------------------------------- * - * copyright (C) 2010-2019 by Juergen Knoedlseder * + * copyright (C) 2010-2021 by Juergen Knoedlseder * * ----------------------------------------------------------------------- * * * * This program is free software: you can redistribute it and/or modify * @@ -1419,26 +1419,6 @@ void GCTAObservation::dispose_events(void) /***********************************************************************//** - * @brief Remove response cache for model - * - * @param[in] name Model name. - * - * Remove response cache for model @p name from response cache. - ***************************************************************************/ -void GCTAObservation::remove_response_cache(const std::string& name) -{ - // Build model name - std::string model_name = id() + "::" + name; - - // Remove response cache - const_cast(this->response())->remove_response_cache(model_name); - - // Return - return; -} - - -/***********************************************************************//** * @brief Print CTA observation information * * @param[in] chatter Chattiness. diff --git a/src/obs/GObservation.cpp b/src/obs/GObservation.cpp index 88a4f1d..afd51d4 100644 --- a/src/obs/GObservation.cpp +++ b/src/obs/GObservation.cpp @@ -1,7 +1,7 @@ /*************************************************************************** * GObservation.cpp - Abstract observation base class * * ----------------------------------------------------------------------- * - * copyright (C) 2008-2020 by Juergen Knoedlseder * + * copyright (C) 2008-2021 by Juergen Knoedlseder * * ----------------------------------------------------------------------- * * * * This program is free software: you can redistribute it and/or modify * @@ -1181,13 +1181,16 @@ double GObservation::npred_grad(const GModel& model, const GModelPar& par) const * * @param[in] name Model name. * - * This is a response cache removal hook that is called by the - * GObservations::remove_response_cache() methods and that can be used to - * remove the model @p name from a response cache, if implemented in the - * derived class. + * Remove response cache for model @p name from response cache. ***************************************************************************/ void GObservation::remove_response_cache(const std::string& name) { + // Build model name + std::string model_name = id() + ":" + name; + + // Remove response cache + const_cast(this->response())->remove_response_cache(model_name); + // Return return; } diff --git a/src/obs/GResponse.cpp b/src/obs/GResponse.cpp index b5e5968..8360c3c 100644 --- a/src/obs/GResponse.cpp +++ b/src/obs/GResponse.cpp @@ -1,7 +1,7 @@ /*************************************************************************** * GResponse.cpp - Abstract response base class * * ----------------------------------------------------------------------- * - * copyright (C) 2008-2020 by Juergen Knoedlseder * + * copyright (C) 2008-2021 by Juergen Knoedlseder * * ----------------------------------------------------------------------- * * * * This program is free software: you can redistribute it and/or modify * @@ -736,6 +736,7 @@ void GResponse::remove_response_cache(const std::string& name) // Remove model from response caches m_irf_cache.remove(name); m_nroi_cache.remove(name); + m_irf_vector_cache.remove(name); // Return return;