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 14 Pierrick Martin (pierrick.martin@irap.omp.eu)
15 15 Michael Mayer (michael.mayer@physik.hu-berlin.de)
16 16 Stefan Ohm (stefan.ohm81@gmail.com)
  17 +Iftach Sadeh (iftach.sadeh@desy.de)
17 18 David Sanchez (david.sanchez@lapp.in2p3.fr)
18 19 Hubert Siejkowski (h.siejkowski@cyfronet.pl)
19 20 Andreas Specovius (andreas.specovius@fau.de)
... ...
ChangeLog
1   -2021-04-30
  1 +2021-05-07
2 2  
3 3 * Version 2.0.0 released
4 4 ========================
5 5  
  6 + Use test source position in cssens (#3555)
6 7 Add ASCL shields to "About" page (#3630)
7 8 Use file function constructor in csspec (#3626)
8 9 Add BINS method to csspec (#3606)
... ...
1 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 6 Introduction
... ... @@ -282,7 +282,9 @@ the width, height and position angle of the rectangular sky regions (#3248).
282 282  
283 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 290 csspec - Generates Spectral Energy Distribution
... ...
README.md
1 1 ctools information
2 2 ==================
3   -* Version: 2.0.0.dev (30 April 2021)
  3 +* Version: 2.0.0.dev (7 May 2021)
4 4 * GammaLib dependency: 2.0.0.dev
5 5  
6 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 63 cscaldb - lists available instrument response functions
64 64 csebins - generates energy boundaries for stacked analysis
65 65 cslightcrv - computes light curve
  66 + csinfo - checks ctools and GammaLib installations
66 67 csmodelinfo - shows model container content
67 68 csmodelmerge - merges several model containers into one file
68 69 csmodelselect - select models from model definition file
... ... @@ -76,6 +77,7 @@ The following scripts are available:
76 77 csresmap - generates residual map
77 78 csresspec - generates residual spectrum
78 79 csroot2caldb - creates a caldb entry from a ROOT file
  80 + csscs - Performs spectral component separation
79 81 cssens - computes CTA sensitivity
80 82 csspec - computes spectral points
81 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 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 166 ctools is known to work on various flavors of Mac OS. To cope with
165 167 different system versions and architectures, there are two Mac
166 168 specific configure options:
... ...
cscripts/cssens.py
... ... @@ -2,7 +2,7 @@
2 2 # ==========================================================================
3 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 7 # This program is free software: you can redistribute it and/or modify
8 8 # it under the terms of the GNU General Public License as published by
... ... @@ -189,16 +189,38 @@ class cssens(ctools.csobservation):
189 189  
190 190 # ... otherwise allocate a single observation
191 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 225 # Read relevant user parameters
204 226 caldb = self['caldb'].string()
... ... @@ -210,10 +232,6 @@ class cssens(ctools.csobservation):
210 232 # Allocate observation container
211 233 obs = gammalib.GObservations()
212 234  
213   - # Set single pointing
214   - pntdir = gammalib.GSkyDir()
215   - pntdir.lb_deg(lpnt, bpnt)
216   -
217 235 # Create CTA observation
218 236 run = obsutils.set_obs(pntdir, caldb=caldb, irf=irf,
219 237 duration=duration, deadc=deadc,
... ... @@ -222,12 +240,6 @@ class cssens(ctools.csobservation):
222 240 # Append observation to container
223 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 243 # Return observation container
232 244 return obs
233 245  
... ... @@ -632,7 +644,7 @@ class cssens(ctools.csobservation):
632 644 def _e_bin(self, ieng):
633 645 """
634 646 Determines sensivity in energy bin
635   -
  647 +
636 648 Parameters
637 649 ----------
638 650 ieng : int
... ...
doc/source/admin/release_history/2.0.rst
1 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 6 Overview
7 7 --------
... ... @@ -24,6 +24,8 @@ Bug fixes
24 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 29 * [`3630 <https://cta-redmine.irap.omp.eu/issues/3630>`_] -
28 30 Add ASCL shields to **About** page
29 31 * [`3626 <https://cta-redmine.irap.omp.eu/issues/3626>`_] -
... ...