Skip to content

Commit

Permalink
Allow determination of upper limits on spatial parameters in ctulimit…
Browse files Browse the repository at this point in the history
… (#4006)
  • Loading branch information
jknodlseder committed Mar 18, 2022
1 parent 3b80526 commit e8ba217
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 11 deletions.
3 changes: 2 additions & 1 deletion ChangeLog
Original file line number Diff line number Diff line change
@@ -1,8 1,9 @@
2022-02-25
2022-03-18

* Version 2.0.0 released
========================

Allow determination of upper limits on spatial parameters in ctulimit (#4006)
Add comgendb script (#3983)
Rename virtual abstract ctool::run() method to ctool::process() and
add non-abstract ctool::run() method (#3592) (#3592)
Expand Down
5 changes: 4 additions & 1 deletion NEWS
Original file line number Diff line number Diff line change
@@ -1,6 1,6 @@
New Features and Important Changes in ctools 2.0.0

25 February 2022
18 March 2022


Introduction
Expand Down Expand Up @@ -160,6 160,9 @@ model parameters (#3562).

ctulimit - Compute upper limit
------------------------------
The tool now accepts also spatial parameters as parname argument so that upper
limits can be determined on spatial parameters (#4006)

If the bisection results in a result that is incompatible with the previously
determine best maximum log-likelihood value or if the bisection interval tends
towards zero then update the best log-likelihood value with the current result
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 1,6 @@
ctools information
==================
* Version: 2.0.0.dev (25 February 2022)
* Version: 2.0.0.dev (18 March 2022)
* GammaLib dependency: 2.0.0.dev

[![Build Status](https://cta-jenkins.irap.omp.eu/buildStatus/icon?job=ctools-integrate-os)](https://cta-jenkins.irap.omp.eu/job/ctools-integrate-os/)
Expand Down
2 changes: 2 additions & 0 deletions doc/source/admin/release_history/2.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 25,8 @@ Bug fixes
Improvements
------------

* [`4006 <https://cta-redmine.irap.omp.eu/issues/4006>`_] -
Allow determination of upper limits on spatial parameters in :ref:`ctulimit`
* [`3592 <https://cta-redmine.irap.omp.eu/issues/3592>`_] -
Rename virtual abstract :doxy:`ctool::run` method to :doxy:`ctool::process` and add non-abstract :doxy:`ctool::run` method
* Add methods to access :ref:`ctlike` attributes
Expand Down
3 changes: 3 additions & 0 deletions doc/source/users/reference_manual/ctulimit.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 35,9 @@ General parameters
``srcname [string]``
Name of source model for which the upper flux limit should be computed.

``(parname = "") [string]``
Optional model parameter name (either a spatial or a spectral parameter)

``expcube [file]``
Input exposure cube file.

Expand Down
21 changes: 13 additions & 8 deletions src/ctulimit/ctulimit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -485,13 485,14 @@ void ctulimit::get_parameters(void)


/***********************************************************************//**
* @brief Get application parameters
* @brief Get model parameter
*
* @exception GException::invalid_value
* Did not find a valid model or model parameter
*
* Extracts a pointer to the sky model (m_skymodel) and a pointer to the
* relevant model parameter (m_model_par) from the model container. If no
* model parameter (m_model_par) that should be varied for the upper limit
* determination from the model container.
***************************************************************************/
void ctulimit::get_model_parameter(void)
{
Expand Down Expand Up @@ -528,15 529,19 @@ void ctulimit::get_model_parameter(void)

// If a parameter name was specified then use that parameter
if (!m_parname.empty()) {
if (m_skymodel->spectral()->has_par(m_parname)) {
if (m_skymodel->spatial()->has_par(m_parname)) {
m_model_par = &(m_skymodel->spatial()->operator[](m_parname));
}
else if (m_skymodel->spectral()->has_par(m_parname)) {
m_model_par = &(m_skymodel->spectral()->operator[](m_parname));
}
else {
std::string msg = "Spectral model of source \"" m_srcname "\" has "
"no parameter \"" m_parname "\". Please specify "
"a value parameter name of leave the parameter "
"name blank for autodetermination of an "
"intensity- or flux-like parameter.";
std::string msg = "Spatial or spectral model of source \""
m_srcname "\" has no parameter \"" m_parname
"\". Please specify a valid parameter name "
"or leave the parameter name blank for "
"autodetermination of an intensity- or "
"flux-like parameter.";
throw GException::invalid_value(G_GET_MODEL_PARAMETER, msg);
}
}
Expand Down

0 comments on commit e8ba217

Please sign in to comment.