Commit ea7f03e92aaa0af657465c6e0dcf9188de7b90e0

Authored by Jürgen Knödlseder
1 parent e6c67ef2

Add zenith and azimuth angles to CALDB information.

The zenith and azimuth angles are now parameters for csroot2caldb and these parameters are written into the CALDB. The calibration boundaries that existed before in the CALDB have been removed as they are not really useful.
ChangeLog
1   -2016-09-26
  1 +2016-10-04
2 2  
3 3 * Version 1.2.0 released
4 4 ========================
5 5  
  6 + Add zenith and azimuth angle information to IRF caldb (#1853)
6 7 Fix ctbin segfault bug for varying energy thresholds (#1850)
7 8 Make csresmap enumbins parameter hidden (#1844)
8 9 Rename ctskymap::map() to ctskymap::skymap() (#1828)
... ...
1 1 New Features and Important Changes in ctools 1.2.0
2 2  
3   -26 September 2016
  3 +4 October 2016
4 4  
5 5  
6 6 Introduction
... ... @@ -188,9 +188,12 @@ The class now derives from ctlikelihood (#1828).
188 188  
189 189 cscripts
190 190 --------
191   -Added the support modules "modutils" and "ioutils" to the cscripts module
192   -and removed the obsolete functions fit(), cterror(), cntmap() and modmap()
193   -from the "obsutils" module (#1830).
  191 +Added the support modules "modutils" and "ioutils" to the cscripts module and
  192 +removed the obsolete functions fit(), cterror(), cntmap() and modmap() from the
  193 +"obsutils" module (#1830).
  194 +
  195 +The csroot2caldb script now takes the zenith and azimuth angles as parameters
  196 +and writes them into the calibration database.
194 197  
195 198  
196 199 Examples
... ...
cscripts/csroot2caldb.par
... ... @@ -23,6 +23,8 @@ inst, s, a, prod3,,, "Instrument name"
23 23 id, s, a, South_50h,,, "Instrument Response Function identifier"
24 24 version, s, a, prod3,,, "Instrument Response Function version"
25 25 analysis, s, a, DESY,,, "Instrument Response Function analysis"
  26 +zenith, r, a, 20.0,0.0,90.0, "Zenith Angle (deg)"
  27 +azimuth, r, a, 0.0,0.0,360.0, "Azimuth Angle (deg)"
26 28 psftype, s, h, Gauss,Gauss|King,, "Point spread function type"
27 29 split, b, h, no,,, "Split IRF components into different files"
28 30 norm1d, b, h, no,,, "Normalize on 1D histograms"
... ...
cscripts/csroot2caldb.py
... ... @@ -21,6 +21,7 @@
21 21 import os
22 22 import sys
23 23 import math
  24 +import copy
24 25 from datetime import datetime
25 26 import gammalib
26 27 import ctools
... ... @@ -69,6 +70,8 @@ class csroot2caldb(ctools.cscript):
69 70 self['inst'].string()
70 71 self['id'].string()
71 72 self['analysis'].string()
  73 + self['zenith'].real()
  74 + self['azimuth'].real()
72 75 self['version'].string()
73 76 self['psftype'].string()
74 77 self['split'].boolean()
... ... @@ -102,6 +105,10 @@ class csroot2caldb(ctools.cscript):
102 105 cal_version = 'VERSION('+self['version'].string()+')'
103 106 cal_cut = 'CLASS(BEST)'
104 107 cal_analysis = 'ANALYSIS('+self['analysis'].string()+')'
  108 + cal_zenith = 'ZENITH(%.3f)deg' % self['zenith'].real()
  109 + cal_azimuth = 'AZIMUTH(%.3f)deg' % self['azimuth'].real()
  110 + cal_bounds = [cal_name, cal_version, cal_cut, cal_analysis, \
  111 + cal_zenith, cal_azimuth]
105 112  
106 113 # Set IRF information
107 114 irf['CAL_TEL'] = 'CTA'
... ... @@ -118,19 +125,19 @@ class csroot2caldb(ctools.cscript):
118 125 irf['REF_TIME'] = 51544.0
119 126 irf['EA_NAME'] = 'EFF_AREA'
120 127 irf['EA_DOC'] = 'CAL/GEN/92-019'
121   - irf['EA_BOUNDS'] = [cal_name, cal_version, cal_cut, cal_analysis]
  128 + irf['EA_BOUNDS'] = copy.deepcopy(cal_bounds)
122 129 irf['EA_DESC'] = 'CTA effective area'
123 130 irf['PSF_NAME'] = 'RPSF'
124 131 irf['PSF_DOC'] = 'CAL/GEN/92-020'
125   - irf['PSF_BOUNDS'] = [cal_name, cal_version, cal_cut, cal_analysis]
  132 + irf['PSF_BOUNDS'] = copy.deepcopy(cal_bounds)
126 133 irf['PSF_DESC'] = 'CTA point spread function'
127 134 irf['EDISP_NAME'] = 'EDISP'
128 135 irf['EDISP_DOC'] = '???'
129   - irf['EDISP_BOUNDS'] = [cal_name, cal_version, cal_cut, cal_analysis]
  136 + irf['EDISP_BOUNDS'] = copy.deepcopy(cal_bounds)
130 137 irf['EDISP_DESC'] = 'CTA energy dispersion'
131 138 irf['BGD_NAME'] = 'BGD'
132 139 irf['BGD_DOC'] = '???'
133   - irf['BGD_BOUNDS'] = [cal_name, cal_version, cal_cut, cal_analysis]
  140 + irf['BGD_BOUNDS'] = copy.deepcopy(cal_bounds)
134 141 irf['BGD_DESC'] = 'CTA background'
135 142  
136 143 # Return metadata
... ... @@ -590,9 +597,9 @@ class csroot2caldb(ctools.cscript):
590 597 ereco.SetBinContent(ieng+1,ioff+1,value)
591 598  
592 599 # Set boundaries (use Ereco boundaries)
593   - bounds = self._make_2D(ereco, ds['HDU_EA'], None, 'm2')
594   - for b in bounds:
595   - irf['EA_BOUNDS'].append(b)
  600 + #bounds = self._make_2D(ereco, ds['HDU_EA'], None, 'm2')
  601 + #for b in bounds:
  602 + # irf['EA_BOUNDS'].append(b)
596 603  
597 604 # Write boundary keywords
598 605 self._set_cif_keywords(ds['HDU_EA'], irf['EA_NAME'],
... ... @@ -689,9 +696,9 @@ class csroot2caldb(ctools.cscript):
689 696 zero.SetBinContent(ieng+1,ioff+1,0.0)
690 697  
691 698 # Set boundaries
692   - bounds = self._make_2D(r68, ds['HDU_PSF'], None, 'deg')
693   - for b in bounds:
694   - irf['PSF_BOUNDS'].append(b)
  699 + #bounds = self._make_2D(r68, ds['HDU_PSF'], None, 'deg')
  700 + #for b in bounds:
  701 + # irf['PSF_BOUNDS'].append(b)
695 702 irf['PSF_BOUNDS'].append('PSF(GAUSS)')
696 703  
697 704 # Write boundary keywords
... ... @@ -825,9 +832,9 @@ class csroot2caldb(ctools.cscript):
825 832 sigma2D.SetBinContent(ieng+1,ioff+1,sigma)
826 833  
827 834 # Set boundaries
828   - bounds = self._make_2D(r68, ds['HDU_PSF'], None, 'deg')
829   - for b in bounds:
830   - irf['PSF_BOUNDS'].append(b)
  835 + #bounds = self._make_2D(r68, ds['HDU_PSF'], None, 'deg')
  836 + #for b in bounds:
  837 + # irf['PSF_BOUNDS'].append(b)
831 838 irf['PSF_BOUNDS'].append('PSF(KING)')
832 839  
833 840 # Write boundary keywords
... ... @@ -868,9 +875,9 @@ class csroot2caldb(ctools.cscript):
868 875 matrix = tfile.Get('EestOverEtrue_offaxis')
869 876  
870 877 # Set boundaries
871   - bounds = self._make_3D_migra(matrix, ds['HDU_EDISP'], None, '')
872   - for b in bounds:
873   - irf['EDISP_BOUNDS'].append(b)
  878 + #bounds = self._make_3D_migra(matrix, ds['HDU_EDISP'], None, '')
  879 + #for b in bounds:
  880 + # irf['EDISP_BOUNDS'].append(b)
874 881  
875 882 # Write boundary keywords
876 883 self._set_cif_keywords(ds['HDU_EDISP'], irf['EDISP_NAME'],
... ... @@ -921,9 +928,9 @@ class csroot2caldb(ctools.cscript):
921 928 self._renorm_onaxis(array, array_1D)
922 929  
923 930 # Set boundaries
924   - bounds = self._make_3D(array, ds['HDU_BGD'], None, 'deg')
925   - for b in bounds:
926   - irf['BGD_BOUNDS'].append(b)
  931 + #bounds = self._make_3D(array, ds['HDU_BGD'], None, 'deg')
  932 + #for b in bounds:
  933 + # irf['BGD_BOUNDS'].append(b)
927 934  
928 935 # Write boundary keywords
929 936 self._set_cif_keywords(ds['HDU_BGD'], irf['BGD_NAME'],
... ... @@ -1013,7 +1020,6 @@ class csroot2caldb(ctools.cscript):
1013 1020 # Return
1014 1021 return
1015 1022  
1016   -
1017 1023 def _renorm_onaxis(self, hist2D, hist1D):
1018 1024 """
1019 1025 Renormalise 2D histogram (energy,offset) on 1D histogram (energy)
... ...