Commit ba197c905c9c38f808f0bce26b94bc723366972b

Authored by Jürgen Knödlseder
1 parent 587d5c24

Integrate code

@@ -14,6 +14,7 @@ Chia-Chun Lu (Chia-Chun.Lu@mpi-hd.mpg.de) @@ -14,6 +14,7 @@ Chia-Chun Lu (Chia-Chun.Lu@mpi-hd.mpg.de)
14 Pierrick Martin (pierrick.martin@irap.omp.eu) 14 Pierrick Martin (pierrick.martin@irap.omp.eu)
15 Michael Mayer (michael.mayer@physik.hu-berlin.de) 15 Michael Mayer (michael.mayer@physik.hu-berlin.de)
16 Stefan Ohm (stefan.ohm81@gmail.com) 16 Stefan Ohm (stefan.ohm81@gmail.com)
  17 +Iftach Sadeh (iftach.sadeh@desy.de)
17 David Sanchez (david.sanchez@lapp.in2p3.fr) 18 David Sanchez (david.sanchez@lapp.in2p3.fr)
18 Hubert Siejkowski (h.siejkowski@cyfronet.pl) 19 Hubert Siejkowski (h.siejkowski@cyfronet.pl)
19 Andreas Specovius (andreas.specovius@fau.de) 20 Andreas Specovius (andreas.specovius@fau.de)
ChangeLog
1 -2021-04-30 1 +2021-05-07
2 2
3 * Version 2.0.0 released 3 * Version 2.0.0 released
4 ======================== 4 ========================
5 5
  6 + Use test source position in cssens (#3555)
6 Add ASCL shields to "About" page (#3630) 7 Add ASCL shields to "About" page (#3630)
7 Use file function constructor in csspec (#3626) 8 Use file function constructor in csspec (#3626)
8 Add BINS method to csspec (#3606) 9 Add BINS method to csspec (#3606)
1 New Features and Important Changes in ctools 2.0.0 1 New Features and Important Changes in ctools 2.0.0
2 2
3 -30 April 2021 3 +7 May 2021
4 4
5 5
6 Introduction 6 Introduction
@@ -282,7 +282,9 @@ the width, height and position angle of the rectangular sky regions (#3248). @@ -282,7 +282,9 @@ the width, height and position angle of the rectangular sky regions (#3248).
282 282
283 cssens - Computes sensitivity curve 283 cssens - Computes sensitivity curve
284 ----------------------------------- 284 -----------------------------------
285 -None 285 +The test source position is now used as pointing direction, eventually offset
  286 +in galactic latitude by a number of degrees specified using the "offset"
  287 +parameter (#3555).
286 288
287 289
288 csspec - Generates Spectral Energy Distribution 290 csspec - Generates Spectral Energy Distribution
README.md
1 ctools information 1 ctools information
2 ================== 2 ==================
3 -* Version: 2.0.0.dev (30 April 2021) 3 +* Version: 2.0.0.dev (7 May 2021)
4 * GammaLib dependency: 2.0.0.dev 4 * GammaLib dependency: 2.0.0.dev
5 5
6 [![Build Status](https://cta-jenkins.irap.omp.eu/buildStatus/icon?job=ctools-integrate-os)](https://cta-jenkins.irap.omp.eu/job/ctools-integrate-os/) 6 [![Build Status](https://cta-jenkins.irap.omp.eu/buildStatus/icon?job=ctools-integrate-os)](https://cta-jenkins.irap.omp.eu/job/ctools-integrate-os/)
@@ -63,6 +63,7 @@ The following scripts are available: @@ -63,6 +63,7 @@ The following scripts are available:
63 cscaldb - lists available instrument response functions 63 cscaldb - lists available instrument response functions
64 csebins - generates energy boundaries for stacked analysis 64 csebins - generates energy boundaries for stacked analysis
65 cslightcrv - computes light curve 65 cslightcrv - computes light curve
  66 + csinfo - checks ctools and GammaLib installations
66 csmodelinfo - shows model container content 67 csmodelinfo - shows model container content
67 csmodelmerge - merges several model containers into one file 68 csmodelmerge - merges several model containers into one file
68 csmodelselect - select models from model definition file 69 csmodelselect - select models from model definition file
@@ -76,6 +77,7 @@ The following scripts are available: @@ -76,6 +77,7 @@ The following scripts are available:
76 csresmap - generates residual map 77 csresmap - generates residual map
77 csresspec - generates residual spectrum 78 csresspec - generates residual spectrum
78 csroot2caldb - creates a caldb entry from a ROOT file 79 csroot2caldb - creates a caldb entry from a ROOT file
  80 + csscs - Performs spectral component separation
79 cssens - computes CTA sensitivity 81 cssens - computes CTA sensitivity
80 csspec - computes spectral points 82 csspec - computes spectral points
81 cssrcdetect - detects sources in sky map 83 cssrcdetect - detects sources in sky map
@@ -159,8 +161,8 @@ The `make check` command will run an extensive unit test to verify that @@ -159,8 +161,8 @@ The `make check` command will run an extensive unit test to verify that
159 ctools was correctly built. Make sure that all tests were successful. 161 ctools was correctly built. Make sure that all tests were successful.
160 162
161 163
162 -Macintosh OS X Installation  
163 -============================ 164 +Macintosh OS Installation
  165 +==========================
164 ctools is known to work on various flavors of Mac OS. To cope with 166 ctools is known to work on various flavors of Mac OS. To cope with
165 different system versions and architectures, there are two Mac 167 different system versions and architectures, there are two Mac
166 specific configure options: 168 specific configure options:
cscripts/cssens.py
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 # ========================================================================== 2 # ==========================================================================
3 # Computes the array sensitivity using the Test Statistic for a test source 3 # Computes the array sensitivity using the Test Statistic for a test source
4 # 4 #
5 -# Copyright (C) 2011-2019 Juergen Knoedlseder 5 +# Copyright (C) 2011-2021 Juergen Knoedlseder
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
8 # it under the terms of the GNU General Public License as published by 8 # it under the terms of the GNU General Public License as published by
@@ -189,16 +189,38 @@ class cssens(ctools.csobservation): @@ -189,16 +189,38 @@ class cssens(ctools.csobservation):
189 189
190 # ... otherwise allocate a single observation 190 # ... otherwise allocate a single observation
191 else: 191 else:
192 - # set the coordinates of the test source model  
193 - if lpnt is None and bpnt is None:  
194 - container = gammalib.GModels(self['inmodel'].filename())  
195 - src_model = container[self['srcname'].string()]  
196 192
197 - pntdir = gammalib.GSkyDir()  
198 - pntdir.radec_deg(src_model['RA'].value(), src_model['DEC'].value()) 193 + # If no pointing is specified and if the test source has a position
  194 + # then set the pointing to the position of the test source
  195 + if lpnt is None and bpnt is None:
  196 + models = gammalib.GModels(self['inmodel'].filename())
  197 + source = models[self['srcname'].string()]
  198 + if source.has_par('RA') and source.has_par('DEC'):
  199 + pntdir = gammalib.GSkyDir()
  200 + pntdir.radec_deg(source['RA'].value(), source['DEC'].value())
  201 + lpnt = pntdir.l_deg()
  202 + bpnt = pntdir.b_deg()
  203 + elif source.has_par('GLON') and source.has_par('GLAT'):
  204 + lpnt = source['GLON'].value()
  205 + bpnt = source['GLAT'].value()
  206 + else:
  207 + lpnt = 0.0
  208 + bpnt = 0.0
199 209
200 - lpnt = pntdir.l_deg()  
201 - bpnt = pntdir.b_deg() 210 + # Set source position
  211 + srcdir = gammalib.GSkyDir()
  212 + srcdir.lb_deg(lpnt, bpnt)
  213 + self._ra = srcdir.ra_deg()
  214 + self._dec = srcdir.dec_deg()
  215 +
  216 + # Set pointing direction offset in galactic latitude
  217 + offset = self['offset'].real()
  218 + bpnt += offset
  219 + if bpnt > 90.0:
  220 + bpnt = 180.0 - bpnt
  221 + lpnt += 180.0
  222 + pntdir = gammalib.GSkyDir()
  223 + pntdir.lb_deg(lpnt, bpnt)
202 224
203 # Read relevant user parameters 225 # Read relevant user parameters
204 caldb = self['caldb'].string() 226 caldb = self['caldb'].string()
@@ -210,10 +232,6 @@ class cssens(ctools.csobservation): @@ -210,10 +232,6 @@ class cssens(ctools.csobservation):
210 # Allocate observation container 232 # Allocate observation container
211 obs = gammalib.GObservations() 233 obs = gammalib.GObservations()
212 234
213 - # Set single pointing  
214 - pntdir = gammalib.GSkyDir()  
215 - pntdir.lb_deg(lpnt, bpnt)  
216 -  
217 # Create CTA observation 235 # Create CTA observation
218 run = obsutils.set_obs(pntdir, caldb=caldb, irf=irf, 236 run = obsutils.set_obs(pntdir, caldb=caldb, irf=irf,
219 duration=duration, deadc=deadc, 237 duration=duration, deadc=deadc,
@@ -222,12 +240,6 @@ class cssens(ctools.csobservation): @@ -222,12 +240,6 @@ class cssens(ctools.csobservation):
222 # Append observation to container 240 # Append observation to container
223 obs.append(run) 241 obs.append(run)
224 242
225 - # Set source position  
226 - offset = self['offset'].real()  
227 - pntdir.lb_deg(lpnt, bpnt+offset)  
228 - self._ra = pntdir.ra_deg()  
229 - self._dec = pntdir.dec_deg()  
230 -  
231 # Return observation container 243 # Return observation container
232 return obs 244 return obs
233 245
@@ -632,7 +644,7 @@ class cssens(ctools.csobservation): @@ -632,7 +644,7 @@ class cssens(ctools.csobservation):
632 def _e_bin(self, ieng): 644 def _e_bin(self, ieng):
633 """ 645 """
634 Determines sensivity in energy bin 646 Determines sensivity in energy bin
635 - 647 +
636 Parameters 648 Parameters
637 ---------- 649 ----------
638 ieng : int 650 ieng : int
doc/source/admin/release_history/2.0.rst
1 .. _2.0: 1 .. _2.0:
2 2
3 -ctools 2.0 release (30 April 2021)  
4 -================================== 3 +ctools 2.0 release (7 May 2021)
  4 +===============================
5 5
6 Overview 6 Overview
7 -------- 7 --------
@@ -24,6 +24,8 @@ Bug fixes @@ -24,6 +24,8 @@ Bug fixes
24 Improvements 24 Improvements
25 ------------ 25 ------------
26 26
  27 +* [`3555 <https://cta-redmine.irap.omp.eu/issues/3555>`_] -
  28 + Use test source position in :ref:`cssens`
27 * [`3630 <https://cta-redmine.irap.omp.eu/issues/3630>`_] - 29 * [`3630 <https://cta-redmine.irap.omp.eu/issues/3630>`_] -
28 Add ASCL shields to **About** page 30 Add ASCL shields to **About** page
29 * [`3626 <https://cta-redmine.irap.omp.eu/issues/3626>`_] - 31 * [`3626 <https://cta-redmine.irap.omp.eu/issues/3626>`_] -